Skip to content

Commit

Permalink
Fix DH queries that are broken.
Browse files Browse the repository at this point in the history
Better error messages.
  • Loading branch information
chipkent committed May 1, 2024
1 parent 7aa5b8c commit 2905ca6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/deephaven_ib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def annotate_ticks(t):

return rst

def deephaven_ib_float_value(s: str) -> Optional[float]:
def deephaven_ib_float_value(s: Optional[str]) -> Optional[float]:
if not s:
return NULL_DOUBLE

Expand Down Expand Up @@ -638,7 +638,7 @@ def deephaven_ib_parse_note(note:str, key:str) -> Optional[str]:
"orders_status": tables_raw["raw_orders_status"] \
.last_by("PermId") \
.move_columns_up(["ReceiveTime", "PermId", "ClientId", "OrderId", "ParentId"]),
"bars_historical": annotate_ticks(tables_raw["raw_bars_historical"]).last_by(["Request", "Timestamp", "ContractId"]),
"bars_historical": annotate_ticks(tables_raw["raw_bars_historical"]).last_by(["RequestId", "Timestamp", "ContractId"]),
"bars_realtime": annotate_ticks(tables_raw["raw_bars_realtime"]),
"ticks_efp": annotate_ticks(tables_raw["raw_ticks_efp"]),
"ticks_generic": annotate_ticks(tables_raw["raw_ticks_generic"]),
Expand Down Expand Up @@ -692,8 +692,12 @@ def get_registered_contract(self, contract: Contract) -> RegisteredContract:
"""

self._assert_connected()
cd = self._client.contract_registry.request_contract_details_blocking(contract)
return RegisteredContract(query_contract=contract, contract_details=cd)

try:
cd = self._client.contract_registry.request_contract_details_blocking(contract)
return RegisteredContract(query_contract=contract, contract_details=cd)
except Exception as e:
raise Exception(f"Error getting registered contract: contract={contract} {e}")

def request_contracts_matching(self, pattern: str) -> Request:
"""Request contracts matching a pattern. Results are returned in the ``contracts_matching`` table.
Expand Down

0 comments on commit 2905ca6

Please sign in to comment.