[Add]增加算法交易RPC服务的数据推送功能

This commit is contained in:
vn.py 2018-07-25 22:57:15 +08:00
parent 2b9d165e86
commit 111f173aa0
3 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"apiKey": "dVOUiqMzayJSW8gCGax_zWpy",
"apiSecret": "dTh0NWAvGA3h9YczL90R1MGxGc_BZtG05EJ3MoiMYRvtS5mL",
"apiKey": "",
"apiSecret": "",
"sessionCount": 3,
"symbols": ["XBTUSD", "EOSM18", "XRPM18"]
}

View File

@ -228,6 +228,10 @@ class AlgoEngine(object):
event.dict_['data'] = d
self.eventEngine.put(event)
# RPC推送
if self.rpcServer:
self.rpcServer.publish('AlgoTrading', event)
# 保存数据到数据库
history = self.historyDict.setdefault(algoName, {})
history['algoName'] = algoName
@ -239,6 +243,7 @@ class AlgoEngine(object):
{'algoName': algoName},
True)
#----------------------------------------------------------------------
def putParamEvent(self, algo, d):
"""更新参数"""
@ -249,6 +254,10 @@ class AlgoEngine(object):
event.dict_['data'] = d
self.eventEngine.put(event)
# RPC推送
if self.rpcServer:
self.rpcServer.publish('AlgoTrading', event)
# 保存数据到数据库
history = self.historyDict.setdefault(algoName, {})
history['algoName'] = algoName