alt喂价安装
https://github.com/pch957/btsprice GITHUB
https://bitsharestalk.org/index.php/topic,20529.msg268242.html#msg268242 论坛
代码:
pip3 install btsprice
pip3 install btsprice --upgrade
git clone
https://github.com/pch957/btsprice.gitcd btsprice
python3 setup.py install --user
btsprice --config config.json
------------------------------------------
需要安装
autobahn安装0.12.1
这是btsprice的一个依赖版本过高
或者改源代码
/usr/local/lib/python3.4/dist-packages/btspusher/wamp.py
把
from autobahn.websocket.protocol import parseWsUr1
改成
from autobahn.websocket.util import parse_url
在把这个文件里的parseWsUrl改成parse_url
就OK了
我是改的代码
---------------------------------------------------------
建立config.json文件
地址:https://github.com/pch957/btsprice/blob/master/config.json.sample
#####################
{
"witness": "",
"timer_minute": 2,
"asset_list": [
"BTC", "SILVER", "GOLD", "TRY", "SGD", "HKD", "NZD", "CNY", "TCNY",
"MXN", "CAD", "CHF", "AUD", "GBP", "JPY", "EUR", "USD", "KRW", "TUSD", "ARS"],
"cli_wallet": {
"host" : "localhost",
"port" : 8092,
"user" : "",
"passwd" : "",
"unlock" : ""
},
"price_limit": {
"common": "only update price feed when the change rate is between 1% ~ 50%",
"change_min": 1,
"change_max": 50,
"common": "spread bid price to price*(1+spread), ask price to price*(1-spread)",
"common": "excute the order book, get the real price",
"spread": 0.01,
"common": "we use the average price in this time",
"filter_minute": 30
},
"market_weight": {
"poloniex_btc": 1,
"yunbi_cny": 1,
"btc38_cny": 1,
"btc38_btc": 1,
"bter_cny": 0
},
"asset_config": {
"default": {
"core_exchange_factor": 1.01,
"maintenance_collateral_ratio": 1750,
"maximum_short_squeeze_ratio": 1100
},
"TCNY": {"maximum_short_squeeze_ratio": 1001},
"TUSD": {"maximum_short_squeeze_ratio": 1001}
},
"pusher": {
"common": "set enable to 1, if you want to subscribe data from pusher service",
"enable": "1",
"user": "",
"password": ""
}
}
####################
注意把tcny和tusd删除掉,这个有喂价权限限制。
并修改
"witness": "", ------------->"witness": "delegate.XXXXX",
"host" : "localhost", ------------->"host" : "127.0.0.1",
"port" : 8092, ------------->"port" : 8095, #这个看钱包怎么启动的端口
"unlock" : "" ------------->"unlock" : "钱包解锁密码"
"timer_minute": 2, #这里是检测时间,每过2分钟检测,有变动喂价
同时,钱包要用以下启动
./programs/cli_wallet/cli_wallet -H 127.0.0.1:8095 -s ws://127.0.0.1:8090 #端口8095要对上号
-------------------
然后启动,不需要做定时任务
btsprice --config config.json