From 71995aeb138efa2828c67d3e9b4ee03024bc2dfa Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 17 Apr 2019 15:46:49 +0800 Subject: [PATCH] [Mod]update readme.md --- README.md | 13 +++++++++++++ vnpy/gateway/onetoken/onetoken_gateway.py | 14 ++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 39a31811..bd11cf35 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,23 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1 * BitMEX (bitmex):数字货币期货、期权、永续合约 + * OKEX (okex):数字货币现货 + + * HUOBI(huobi):数字货币现货 + + * Bitfinex(bitfinex):数字货币现货 + + * 1Token(onetoken):数字货币券商(现货、期货) + + 3. 开箱即用的各类量化策略交易应用(vnpy.app): * cta_strategy:CTA策略引擎模块,在保持易用性的同时,允许用户针对CTA类策略运行过程中委托的报撤行为进行细粒度控制(降低交易滑点、实现高频策略) + * cta_backtester:CTA策略回测模块,无需使用Jupyter Notebook,直接使用图形界面直接进行策略回测分析、参数优化等相关工作 + + * algo_trading:算法交易模块,提供多种常用的智能交易算法:TWAP、Sniper、Iceberg、BestLimit等等,支持常用算法配置保存 + * csv_loader:CSV历史数据加载器,用于加载CSV格式文件中的历史数据到平台数据库中,用于策略的回测研究以及实盘初始化等功能,支持自定义数据表头格式 4. Python交易API接口封装(vnpy.api),提供上述交易接口的底层对接实现。 diff --git a/vnpy/gateway/onetoken/onetoken_gateway.py b/vnpy/gateway/onetoken/onetoken_gateway.py index e245fd85..080d5bac 100644 --- a/vnpy/gateway/onetoken/onetoken_gateway.py +++ b/vnpy/gateway/onetoken/onetoken_gateway.py @@ -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]