[Mod]update readme.md
This commit is contained in:
parent
194ccdb09c
commit
71995aeb13
13
README.md
13
README.md
@ -34,10 +34,23 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1
|
|||||||
|
|
||||||
* BitMEX (bitmex):数字货币期货、期权、永续合约
|
* BitMEX (bitmex):数字货币期货、期权、永续合约
|
||||||
|
|
||||||
|
* OKEX (okex):数字货币现货
|
||||||
|
|
||||||
|
* HUOBI(huobi):数字货币现货
|
||||||
|
|
||||||
|
* Bitfinex(bitfinex):数字货币现货
|
||||||
|
|
||||||
|
* 1Token(onetoken):数字货币券商(现货、期货)
|
||||||
|
|
||||||
|
|
||||||
3. 开箱即用的各类量化策略交易应用(vnpy.app):
|
3. 开箱即用的各类量化策略交易应用(vnpy.app):
|
||||||
|
|
||||||
* cta_strategy:CTA策略引擎模块,在保持易用性的同时,允许用户针对CTA类策略运行过程中委托的报撤行为进行细粒度控制(降低交易滑点、实现高频策略)
|
* cta_strategy:CTA策略引擎模块,在保持易用性的同时,允许用户针对CTA类策略运行过程中委托的报撤行为进行细粒度控制(降低交易滑点、实现高频策略)
|
||||||
|
|
||||||
|
* cta_backtester:CTA策略回测模块,无需使用Jupyter Notebook,直接使用图形界面直接进行策略回测分析、参数优化等相关工作
|
||||||
|
|
||||||
|
* algo_trading:算法交易模块,提供多种常用的智能交易算法:TWAP、Sniper、Iceberg、BestLimit等等,支持常用算法配置保存
|
||||||
|
|
||||||
* csv_loader:CSV历史数据加载器,用于加载CSV格式文件中的历史数据到平台数据库中,用于策略的回测研究以及实盘初始化等功能,支持自定义数据表头格式
|
* csv_loader:CSV历史数据加载器,用于加载CSV格式文件中的历史数据到平台数据库中,用于策略的回测研究以及实盘初始化等功能,支持自定义数据表头格式
|
||||||
|
|
||||||
4. Python交易API接口封装(vnpy.api),提供上述交易接口的底层对接实现。
|
4. Python交易API接口封装(vnpy.api),提供上述交易接口的底层对接实现。
|
||||||
|
@ -39,8 +39,11 @@ from vnpy.trader.event import EVENT_TIMER
|
|||||||
|
|
||||||
|
|
||||||
REST_HOST = "https://1token.trade/api"
|
REST_HOST = "https://1token.trade/api"
|
||||||
DATA_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/tick"
|
# DATA_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/tick"
|
||||||
TRADE_WEBSOCKET_HOST = "wss://1token.trade/api/v1/ws/trade"
|
# 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_VT2ONETOKEN = {Direction.LONG: "b", Direction.SHORT: "s"}
|
||||||
DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()}
|
DIRECTION_ONETOKEN2VT = {v: k for k, v in DIRECTION_VT2ONETOKEN.items()}
|
||||||
@ -555,6 +558,7 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
|
|||||||
|
|
||||||
def on_packet(self, packet: dict):
|
def on_packet(self, packet: dict):
|
||||||
""""""
|
""""""
|
||||||
|
# Reply
|
||||||
if "uri" in packet:
|
if "uri" in packet:
|
||||||
channel = packet["uri"]
|
channel = packet["uri"]
|
||||||
|
|
||||||
@ -564,12 +568,12 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
|
|||||||
data = packet["code"]
|
data = packet["code"]
|
||||||
else:
|
else:
|
||||||
data = None
|
data = None
|
||||||
|
# Push
|
||||||
elif "action" in packet:
|
elif "action" in packet:
|
||||||
channel = packet["action"]
|
channel = packet["action"]
|
||||||
data = packet.get("data", None)
|
data = packet.get("data", None)
|
||||||
|
# Other
|
||||||
else:
|
else:
|
||||||
print(packet)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
callback = self.callbacks.get(channel, None)
|
callback = self.callbacks.get(channel, None)
|
||||||
@ -634,9 +638,7 @@ class OnetokenTradeWebsocketApi(WebsocketClient):
|
|||||||
|
|
||||||
def on_order(self, data: dict):
|
def on_order(self, data: dict):
|
||||||
""""""
|
""""""
|
||||||
print("--------------------------")
|
|
||||||
for order_data in data:
|
for order_data in data:
|
||||||
print(order_data)
|
|
||||||
contract_symbol = order_data["contract"]
|
contract_symbol = order_data["contract"]
|
||||||
exchange_str, symbol = contract_symbol.split("/")
|
exchange_str, symbol = contract_symbol.split("/")
|
||||||
timestamp = order_data["entrust_time"][11:19]
|
timestamp = order_data["entrust_time"][11:19]
|
||||||
|
Loading…
Reference in New Issue
Block a user