Skip to content

Commit ca9c119

Browse files
author
rob
committed
temp remove caching of contract details#
1 parent b8b4f64 commit ca9c119

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Diff for: sysbrokers/IB/client/ib_client.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime
2-
3-
from ib_insync import Contract
2+
from typing import Tuple
43
from ib_insync import IB
54

65
from sysbrokers.IB.ib_connection import connectionIB
@@ -83,7 +82,7 @@ def __init__(
8382
self._cache = Cache(self)
8483

8584
@property
86-
def cache(self):
85+
def cache(self) -> Cache:
8786
return self._cache
8887

8988
@property
@@ -103,7 +102,7 @@ def log(self):
103102
return self._log
104103

105104
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
107106
):
108107
"""
109108
Error handler called from server
@@ -130,7 +129,7 @@ def error_handler(
130129
# just a general message
131130
self.broker_message(msg=msg, log=log_to_use)
132131

133-
def _get_log_for_contract(self, contract: Contract) -> logger:
132+
def _get_log_for_contract(self, contract: ibContract) -> logger:
134133
if contract is None:
135134
log_to_use = self.log.setup()
136135
else:
@@ -197,9 +196,14 @@ def contract_details(
197196
ib_contract_pattern: ibContract,
198197
allow_expired: bool = False,
199198
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
203207
)
204208

205209
if len(contract_details) == 0:
@@ -215,7 +219,7 @@ def contract_details(
215219

216220
def _contract_details(
217221
self, ib_contract_pattern: ibContract, allow_expired: bool = False
218-
):
222+
) -> list:
219223
ib_contract_pattern.includeExpired = allow_expired
220224

221225
return self.ib.reqContractDetails(ib_contract_pattern)

0 commit comments

Comments
 (0)