[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", "apiKey": "",
"apiSecret": "dTh0NWAvGA3h9YczL90R1MGxGc_BZtG05EJ3MoiMYRvtS5mL", "apiSecret": "",
"sessionCount": 3, "sessionCount": 3,
"symbols": ["XBTUSD", "EOSM18", "XRPM18"] "symbols": ["XBTUSD", "EOSM18", "XRPM18"]
} }

View File

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