Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support historical data bar updates #113

Merged
merged 7 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ These tables include:
* `ticks_trade`: real-time tick market data of trade prices requested via `request_tick_data_historical` or `request_tick_data_realtime`.
* `ticks_bid_ask`: real-time tick market data of bid and ask prices requested via `request_tick_data_historical` or `request_tick_data_realtime`.
* `ticks_mid_point`: real-time tick market data of mid-point prices requested via `request_tick_data_historical` or `request_tick_data_realtime`.
* `bars_historical`: historical price bars requested via `request_bars_historical`.
* `bars_historical`: historical price bars requested via `request_bars_historical`. Real-time bars change as new data arrives.
* `bars_realtime`: real-time price bars requested via `request_bars_realtime`.
* Order Management System (OMS)
* `orders_submitted`: submitted orders **FOR THE THE CLIENT'S ID**. A client ID of 0 contains manually entered orders. Automatically populated.
Expand Down
4 changes: 2 additions & 2 deletions src/deephaven_ib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ class IbSessionTws:
* **ticks_trade**: real-time tick market data of trade prices requested via ``request_tick_data_historical`` or ``request_tick_data_realtime``.
* **ticks_bid_ask**: real-time tick market data of bid and ask prices requested via ``request_tick_data_historical`` or ``request_tick_data_realtime``.
* **ticks_mid_point**: real-time tick market data of mid-point prices requested via ``request_tick_data_historical`` or ``request_tick_data_realtime``.
* **bars_historical**: historical price bars requested via ``request_bars_historical``.
* **bars_historical**: historical price bars requested via ``request_bars_historical``. Real-time bars change as new data arrives.
* **bars_realtime**: real-time price bars requested via ``request_bars_realtime``.
####
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"]),
"bars_historical": annotate_ticks(tables_raw["raw_bars_historical"]).last_by(["Request", "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
4 changes: 4 additions & 0 deletions src/deephaven_ib/_tws/tws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ def historicalDataEnd(self, reqId: int, start: str, end: str):
# do not ned to implement
EWrapper.historicalDataEnd(self, reqId, start, end)

def historicalDataUpdate(self, reqId: int, bar: BarData):
EWrapper.historicalDataUpdate(self, reqId, bar)
self._table_writers["bars_historical"].write_row([reqId, *logger_bar_data.vals(bar)])

####
# reqRealTimeBars
####
Expand Down
Loading