From f67cb4086475c3ff169db46144da0906ffd503b1 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 5 Dec 2017 13:24:33 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=E6=B7=BB=E5=8A=A0OptionMaster=E4=B8=8B?= =?UTF-8?q?=E7=9A=84CTP=E8=AF=81=E5=88=B8=E6=8E=A5=E5=8F=A3ctpsecGateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/OptionMaster/CTPSEC_connect.json | 7 +++++++ examples/OptionMaster/CTP_connect.json | 10 +++++----- examples/OptionMaster/ctpsecGateway/__init__.py | 10 ++++++++++ .../OptionMaster/data/TRADE_MARKET_110100001088sop.dat | 1 - examples/OptionMaster/run.py | 3 +++ vnpy/trader/gateway/ctpGateway/ctpGateway.py | 1 + 6 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 examples/OptionMaster/CTPSEC_connect.json create mode 100644 examples/OptionMaster/ctpsecGateway/__init__.py delete mode 100644 examples/OptionMaster/data/TRADE_MARKET_110100001088sop.dat diff --git a/examples/OptionMaster/CTPSEC_connect.json b/examples/OptionMaster/CTPSEC_connect.json new file mode 100644 index 00000000..85eacb25 --- /dev/null +++ b/examples/OptionMaster/CTPSEC_connect.json @@ -0,0 +1,7 @@ +{ + "brokerID": "2001", + "mdAddress": "tcp://125.64.36.26:51213", + "tdAddress": "tcp://125.64.36.26:51205", + "userID": "请联系经纪商申请", + "password": "请联系经纪商申请" +} \ No newline at end of file diff --git a/examples/OptionMaster/CTP_connect.json b/examples/OptionMaster/CTP_connect.json index e4bfa6b8..85eacb25 100644 --- a/examples/OptionMaster/CTP_connect.json +++ b/examples/OptionMaster/CTP_connect.json @@ -1,7 +1,7 @@ { - "brokerID": "9999", - "mdAddress": "tcp://180.168.146.187:10011", - "tdAddress": "tcp://180.168.146.187:10001", - "userID": "simnow申请", - "password": "simnow申请" + "brokerID": "2001", + "mdAddress": "tcp://125.64.36.26:51213", + "tdAddress": "tcp://125.64.36.26:51205", + "userID": "请联系经纪商申请", + "password": "请联系经纪商申请" } \ No newline at end of file diff --git a/examples/OptionMaster/ctpsecGateway/__init__.py b/examples/OptionMaster/ctpsecGateway/__init__.py new file mode 100644 index 00000000..46b1e399 --- /dev/null +++ b/examples/OptionMaster/ctpsecGateway/__init__.py @@ -0,0 +1,10 @@ +# encoding: UTF-8 + +from vnpy.trader import vtConstant +from vnpy.trader.gateway.ctpGateway import CtpGateway + +gatewayClass = CtpGateway +gatewayName = 'CTPSEC' +gatewayDisplayName = 'CTP证券' +gatewayType = vtConstant.GATEWAYTYPE_FUTURES +gatewayQryEnabled = True diff --git a/examples/OptionMaster/data/TRADE_MARKET_110100001088sop.dat b/examples/OptionMaster/data/TRADE_MARKET_110100001088sop.dat deleted file mode 100644 index dff3957f..00000000 --- a/examples/OptionMaster/data/TRADE_MARKET_110100001088sop.dat +++ /dev/null @@ -1 +0,0 @@ -tBr8RMewRABqiW7HBOkrkg== \ No newline at end of file diff --git a/examples/OptionMaster/run.py b/examples/OptionMaster/run.py index fac0164f..16926371 100644 --- a/examples/OptionMaster/run.py +++ b/examples/OptionMaster/run.py @@ -18,6 +18,8 @@ from vnpy.trader.uiMainWindow import MainWindow # 加载底层接口 from vnpy.trader.gateway import (secGateway, ctpGateway) +import ctpsecGateway + # 加载上层应用 from vnpy.trader.app import (riskManager, optionMaster) @@ -37,6 +39,7 @@ def main(): # 添加交易接口 me.addGateway(secGateway) me.addGateway(ctpGateway) + me.addGateway(ctpsecGateway) # 添加上层应用 me.addApp(riskManager) diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index 20f98c79..21f8c118 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -48,6 +48,7 @@ exchangeMap[EXCHANGE_SHFE] = 'SHFE' exchangeMap[EXCHANGE_CZCE] = 'CZCE' exchangeMap[EXCHANGE_DCE] = 'DCE' exchangeMap[EXCHANGE_SSE] = 'SSE' +exchangeMap[EXCHANGE_SZSE] = 'SZSE' exchangeMap[EXCHANGE_INE] = 'INE' exchangeMap[EXCHANGE_UNKNOWN] = '' exchangeMapReverse = {v:k for k,v in exchangeMap.items()}