[Fix] close #1997
This commit is contained in:
parent
bb03627627
commit
846ea95093
@ -8,7 +8,7 @@ from vnpy.trader.ui import MainWindow, create_qapp
|
|||||||
from vnpy.gateway.bitmex import BitmexGateway
|
from vnpy.gateway.bitmex import BitmexGateway
|
||||||
# from vnpy.gateway.futu import FutuGateway
|
# from vnpy.gateway.futu import FutuGateway
|
||||||
# from vnpy.gateway.ib import IbGateway
|
# from vnpy.gateway.ib import IbGateway
|
||||||
# from vnpy.gateway.ctp import CtpGateway
|
from vnpy.gateway.ctp import CtpGateway
|
||||||
# from vnpy.gateway.ctptest import CtptestGateway
|
# from vnpy.gateway.ctptest import CtptestGateway
|
||||||
# from vnpy.gateway.mini import MiniGateway
|
# from vnpy.gateway.mini import MiniGateway
|
||||||
# from vnpy.gateway.sopt import SoptGateway
|
# from vnpy.gateway.sopt import SoptGateway
|
||||||
@ -50,7 +50,7 @@ def main():
|
|||||||
main_engine = MainEngine(event_engine)
|
main_engine = MainEngine(event_engine)
|
||||||
|
|
||||||
# main_engine.add_gateway(BinanceGateway)
|
# main_engine.add_gateway(BinanceGateway)
|
||||||
# main_engine.add_gateway(CtpGateway)
|
main_engine.add_gateway(CtpGateway)
|
||||||
# main_engine.add_gateway(CtptestGateway)
|
# main_engine.add_gateway(CtptestGateway)
|
||||||
# main_engine.add_gateway(MiniGateway)
|
# main_engine.add_gateway(MiniGateway)
|
||||||
# main_engine.add_gateway(SoptGateway)
|
# main_engine.add_gateway(SoptGateway)
|
||||||
|
@ -479,6 +479,8 @@ class CtpTdApi(TdApi):
|
|||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Check if contract data received
|
||||||
|
if data["InstrumentID"] in symbol_exchange_map:
|
||||||
# Get buffered position object
|
# Get buffered position object
|
||||||
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
||||||
position = self.positions.get(key, None)
|
position = self.positions.get(key, None)
|
||||||
|
@ -478,6 +478,8 @@ class CtpTdApi(TdApi):
|
|||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Check if contract data received
|
||||||
|
if data["InstrumentID"] in symbol_exchange_map:
|
||||||
# Get buffered position object
|
# Get buffered position object
|
||||||
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
||||||
position = self.positions.get(key, None)
|
position = self.positions.get(key, None)
|
||||||
|
@ -491,7 +491,7 @@ class MiniTdApi(TdApi):
|
|||||||
|
|
||||||
def onRspQryInvestorPosition(self, data: dict, error: dict, reqid: int, last: bool):
|
def onRspQryInvestorPosition(self, data: dict, error: dict, reqid: int, last: bool):
|
||||||
""""""
|
""""""
|
||||||
if data:
|
if data and data["InstrumentID"] in symbol_exchange_map:
|
||||||
# Get buffered position object
|
# Get buffered position object
|
||||||
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
||||||
position = self.positions.get(key, None)
|
position = self.positions.get(key, None)
|
||||||
|
@ -491,7 +491,7 @@ class MiniTdApi(TdApi):
|
|||||||
|
|
||||||
def onRspQryInvestorPosition(self, data: dict, error: dict, reqid: int, last: bool):
|
def onRspQryInvestorPosition(self, data: dict, error: dict, reqid: int, last: bool):
|
||||||
""""""
|
""""""
|
||||||
if data:
|
if data and data["InstrumentID"] in symbol_exchange_map:
|
||||||
# Get buffered position object
|
# Get buffered position object
|
||||||
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
key = f"{data['InstrumentID'], data['PosiDirection']}"
|
||||||
position = self.positions.get(key, None)
|
position = self.positions.get(key, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user