1
1
import datetime
2
-
3
- from ib_insync import Contract
2
+ from typing import Tuple
4
3
from ib_insync import IB
5
4
6
5
from sysbrokers .IB .ib_connection import connectionIB
@@ -83,7 +82,7 @@ def __init__(
83
82
self ._cache = Cache (self )
84
83
85
84
@property
86
- def cache (self ):
85
+ def cache (self ) -> Cache :
87
86
return self ._cache
88
87
89
88
@property
@@ -103,7 +102,7 @@ def log(self):
103
102
return self ._log
104
103
105
104
def error_handler (
106
- self , reqid : int , error_code : int , error_string : str , contract : Contract
105
+ self , reqid : int , error_code : int , error_string : str , contract : ibContract
107
106
):
108
107
"""
109
108
Error handler called from server
@@ -130,7 +129,7 @@ def error_handler(
130
129
# just a general message
131
130
self .broker_message (msg = msg , log = log_to_use )
132
131
133
- def _get_log_for_contract (self , contract : Contract ) -> logger :
132
+ def _get_log_for_contract (self , contract : ibContract ) -> logger :
134
133
if contract is None :
135
134
log_to_use = self .log .setup ()
136
135
else :
@@ -197,9 +196,14 @@ def contract_details(
197
196
ib_contract_pattern : ibContract ,
198
197
allow_expired : bool = False ,
199
198
allow_multiple_contracts : bool = False ,
200
- ):
201
- contract_details = self .cache .get (
202
- self ._contract_details , ib_contract_pattern , allow_expired = allow_expired
199
+ ) -> Tuple [ibContract , list ]:
200
+
201
+ # contract_details = self.cache.get(
202
+ # self._contract_details, ib_contract_pattern, allow_expired=allow_expired
203
+ # )
204
+ # FIXME TRY WITHOUT CACHING FOR NOW
205
+ contract_details = self ._contract_details (
206
+ ib_contract_pattern , allow_expired = allow_expired
203
207
)
204
208
205
209
if len (contract_details ) == 0 :
@@ -215,7 +219,7 @@ def contract_details(
215
219
216
220
def _contract_details (
217
221
self , ib_contract_pattern : ibContract , allow_expired : bool = False
218
- ):
222
+ ) -> list :
219
223
ib_contract_pattern .includeExpired = allow_expired
220
224
221
225
return self .ib .reqContractDetails (ib_contract_pattern )
0 commit comments