From 273060340fa9529b9dda15c5332da3557ecc420c Mon Sep 17 00:00:00 2001 From: Chip Kent <5250374+chipkent@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:27:56 -0700 Subject: [PATCH 1/2] Delete examples/example_query_and_plot.py Delete a duplicate file. example_query_and_plot.py duplicates example_overview_image.py. --- examples/example_query_and_plot.py | 57 ------------------------------ 1 file changed, 57 deletions(-) delete mode 100644 examples/example_query_and_plot.py diff --git a/examples/example_query_and_plot.py b/examples/example_query_and_plot.py deleted file mode 100644 index 82f29e7f..00000000 --- a/examples/example_query_and_plot.py +++ /dev/null @@ -1,57 +0,0 @@ - -# Run this example in the Deephaven IDE Console - -import deephaven_ib as dhib - -print("==============================================================================================================") -print("==== ** Accept the connection in TWS **") -print("==============================================================================================================") - -client = dhib.IbSessionTws(host="localhost", port=7497) -client.connect() - -from ibapi.contract import Contract - -c1 = Contract() -c1.symbol = 'DIA' -c1.secType = 'STK' -c1.exchange = 'SMART' -c1.currency = 'USD' - -rc1 = client.get_registered_contract(c1) -print(rc1) - -c2 = Contract() -c2.symbol = 'SPY' -c2.secType = 'STK' -c2.exchange = 'SMART' -c2.currency = 'USD' - -rc2 = client.get_registered_contract(c2) -print(rc2) - -client.set_market_data_type(dhib.MarketDataType.REAL_TIME) -client.request_market_data(rc1) -client.request_market_data(rc2) -client.request_bars_realtime(rc1, bar_type=dhib.BarDataType.MIDPOINT) -client.request_bars_realtime(rc2, bar_type=dhib.BarDataType.MIDPOINT) - -bars_realtime = client.tables["bars_realtime"] - -bars_dia = bars_realtime.where("Symbol=`DIA`") -bars_spy = bars_realtime.where("Symbol=`SPY`") -bars_joined = bars_dia.view(["Timestamp", "TimestampEnd", "Dia=Close"]) \ - .natural_join(bars_spy, on="TimestampEnd", joins="Spy=Close") \ - .update("Ratio = Dia/Spy") - -from deephaven.plot import Figure - -plot_prices = Figure().plot_xy("DIA", t=bars_dia, x="TimestampEnd", y="Close") \ - .x_twin() \ - .plot_xy("SPY", t=bars_spy, x="TimestampEnd", y="Close") \ - .show() - -plot_ratio = Figure().plot_xy("Ratio", t=bars_joined, x="TimestampEnd", y="Ratio") \ - .show() - - From c5a974ed5f2255c2914216d67e82a50c9c88fe10 Mon Sep 17 00:00:00 2001 From: Chip Kent <5250374+chipkent@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:31:40 -0700 Subject: [PATCH 2/2] Update SPY data source in plot_prices --- examples/example_overview_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example_overview_image.py b/examples/example_overview_image.py index c705d3a5..82f29e7f 100644 --- a/examples/example_overview_image.py +++ b/examples/example_overview_image.py @@ -48,7 +48,7 @@ plot_prices = Figure().plot_xy("DIA", t=bars_dia, x="TimestampEnd", y="Close") \ .x_twin() \ - .plot_xy("SPY", t=bars_dia, x="TimestampEnd", y="Close") \ + .plot_xy("SPY", t=bars_spy, x="TimestampEnd", y="Close") \ .show() plot_ratio = Figure().plot_xy("Ratio", t=bars_joined, x="TimestampEnd", y="Ratio") \