[Fix] only subscribe if contract data found

This commit is contained in:
vn.py 2019-09-19 16:07:32 +08:00
parent 5e8a648874
commit 2322406a93

View File

@ -221,11 +221,12 @@ class SpreadDataEngine:
# Subscribe market data # Subscribe market data
contract = self.main_engine.get_contract(vt_symbol) contract = self.main_engine.get_contract(vt_symbol)
req = SubscribeRequest( if contract:
contract.symbol, req = SubscribeRequest(
contract.exchange contract.symbol,
) contract.exchange
self.main_engine.subscribe(req, contract.gateway_name) )
self.main_engine.subscribe(req, contract.gateway_name)
return leg return leg