[Mod]update readme.md

This commit is contained in:
vn.py 2019-04-17 15:46:49 +08:00
parent 194ccdb09c
commit 71995aeb13
2 changed files with 21 additions and 6 deletions

View File

@ -34,10 +34,23 @@ vn.py是一套基于Python的开源量化交易系统开发框架于2015年1
* BitMEX (bitmex):数字货币期货、期权、永续合约
* OKEX (okex):数字货币现货
* HUOBI(huobi):数字货币现货
* Bitfinex(bitfinex):数字货币现货
* 1Token(onetoken):数字货币券商(现货、期货)
3. 开箱即用的各类量化策略交易应用vnpy.app
* cta_strategyCTA策略引擎模块在保持易用性的同时允许用户针对CTA类策略运行过程中委托的报撤行为进行细粒度控制降低交易滑点、实现高频策略
* cta_backtesterCTA策略回测模块无需使用Jupyter Notebook直接使用图形界面直接进行策略回测分析、参数优化等相关工作
* algo_trading算法交易模块提供多种常用的智能交易算法TWAP、Sniper、Iceberg、BestLimit等等支持常用算法配置保存
* csv_loaderCSV历史数据加载器用于加载CSV格式文件中的历史数据到平台数据库中用于策略的回测研究以及实盘初始化等功能支持自定义数据表头格式
4. Python交易API接口封装vnpy.api提供上述交易接口的底层对接实现。

View File

@ -39,8 +39,11 @@ from vnpy.trader.event import EVENT_TIMER
REST_HOST = "https://1token.trade/api"
DATA_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/tick"
TRADE_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/trade"
# DATA_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/tick"
# TRADE_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/trade"
DATA_WEBSOCKET_HOST = "wss://cdn.1tokentrade.cn/api/v1/ws/tick"
TRADE_WEBSOCKET_HOST = "wss://cdn.1tokentrade.cn/api/v1/ws/trade"
DIRECTION_VT2ONETOKEN = {Direction.LONG: "b", Direction.SHORT: "s"}
DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()}
@ -555,6 +558,7 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
def on_packet(self, packet: dict):
""""""
# Reply
if "uri" in packet:
channel = packet["uri"]
@ -564,12 +568,12 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
data = packet["code"]
else:
data = None
# Push
elif "action" in packet:
channel = packet["action"]
data = packet.get("data", None)
# Other
else:
print(packet)
return
callback = self.callbacks.get(channel, None)
@ -634,9 +638,7 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
def on_order(self, data: dict):
""""""
print("--------------------------")
for order_data in data:
print(order_data)
contract_symbol = order_data["contract"]
exchange_str, symbol = contract_symbol.split("/")
timestamp = order_data["entrust_time"][11:19]