From 111f173aa008e5af62fb2be6df6e31ce881d1055 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 25 Jul 2018 22:57:15 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=E5=A2=9E=E5=8A=A0=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E4=BA=A4=E6=98=93RPC=E6=9C=8D=E5=8A=A1=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/CryptoTrader/BITMEX_connect.json | 4 ++-- vnpy/trader/app/algoTrading/algoEngine.py | 11 ++++++++++- .../trader/app/algoTrading}/testRpc.py | 0 3 files changed, 12 insertions(+), 3 deletions(-) rename {examples/CryptoTrader => vnpy/trader/app/algoTrading}/testRpc.py (100%) diff --git a/examples/CryptoTrader/BITMEX_connect.json b/examples/CryptoTrader/BITMEX_connect.json index baeb638b..4aef1612 100644 --- a/examples/CryptoTrader/BITMEX_connect.json +++ b/examples/CryptoTrader/BITMEX_connect.json @@ -1,6 +1,6 @@ { - "apiKey": "dVOUiqMzayJSW8gCGax_zWpy", - "apiSecret": "dTh0NWAvGA3h9YczL90R1MGxGc_BZtG05EJ3MoiMYRvtS5mL", + "apiKey": "", + "apiSecret": "", "sessionCount": 3, "symbols": ["XBTUSD", "EOSM18", "XRPM18"] } \ No newline at end of file diff --git a/vnpy/trader/app/algoTrading/algoEngine.py b/vnpy/trader/app/algoTrading/algoEngine.py index 22214811..b3d855dc 100644 --- a/vnpy/trader/app/algoTrading/algoEngine.py +++ b/vnpy/trader/app/algoTrading/algoEngine.py @@ -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 @@ -238,7 +242,8 @@ class AlgoEngine(object): history, {'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 diff --git a/examples/CryptoTrader/testRpc.py b/vnpy/trader/app/algoTrading/testRpc.py similarity index 100% rename from examples/CryptoTrader/testRpc.py rename to vnpy/trader/app/algoTrading/testRpc.py