[Add] support for Level 2 data of CtpGateway
This commit is contained in:
parent
75f11862bc
commit
ccdde7ee22
@ -313,6 +313,28 @@ class CtpMdApi(MdApi):
|
|||||||
ask_volume_1=data["AskVolume1"],
|
ask_volume_1=data["AskVolume1"],
|
||||||
gateway_name=self.gateway_name
|
gateway_name=self.gateway_name
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if data["BidPrice2"]:
|
||||||
|
tick.bid_price_2 = data["BidPrice2"]
|
||||||
|
tick.bid_price_3 = data["BidPrice3"]
|
||||||
|
tick.bid_price_4 = data["BidPrice4"]
|
||||||
|
tick.bid_price_5 = data["BidPrice5"]
|
||||||
|
|
||||||
|
tick.ask_price_2 = data["AskPrice2"]
|
||||||
|
tick.ask_price_3 = data["AskPrice3"]
|
||||||
|
tick.ask_price_4 = data["AskPrice4"]
|
||||||
|
tick.ask_price_5 = data["AskPrice5"]
|
||||||
|
|
||||||
|
tick.bid_volume_2 = data["BidVolume2"]
|
||||||
|
tick.bid_volume_3 = data["BidVolume3"]
|
||||||
|
tick.bid_volume_4 = data["BidVolume4"]
|
||||||
|
tick.bid_volume_5 = data["BidVolume5"]
|
||||||
|
|
||||||
|
tick.ask_volume_2 = data["AskVolume2"]
|
||||||
|
tick.ask_volume_3 = data["AskVolume3"]
|
||||||
|
tick.ask_volume_4 = data["AskVolume4"]
|
||||||
|
tick.ask_volume_5 = data["AskVolume5"]
|
||||||
|
|
||||||
self.gateway.on_tick(tick)
|
self.gateway.on_tick(tick)
|
||||||
|
|
||||||
def connect(self, address: str, userid: str, password: str, brokerid: int):
|
def connect(self, address: str, userid: str, password: str, brokerid: int):
|
||||||
|
Loading…
Reference in New Issue
Block a user