Skip to content

Commit f7289d0

Browse files
authored
Documentation and bug fixes from user testing (#30)
* Updated slack links. Clarified wording based on feedback. * Document paper trading setup. Note that accepting connections may not be needed. * Reduce log spamming for unmapped values. * Changed wording based upon review. * Changed wording based upon review.
1 parent 914a113 commit f7289d0

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ An [Interactive Brokers](https://www.interactivebrokers.com/) integration for [D
1212
with about $200B of customer equity. Quants and hedge funds often choose [Interactive Brokers](https://www.interactivebrokers.com/) because of its low trading costs and API that facilitates automated trading. With low minimum account balances,
1313
it is also an attractive choice for individual investors.
1414

15-
[Deephaven](https://deephaven.io) is the real-time query engine that runs the quantitative trading of the world's largest
16-
hedge funds, banks, and exchanges. [Deephaven](https://deephaven.io) makes working with real-time data easy and
15+
[Deephaven](https://deephaven.io) is the real-time query engine that is the backbone for the quantitative trading of the
16+
world's largest hedge funds, banks, and exchanges. [Deephaven](https://deephaven.io) makes working with real-time data easy and
1717
facilitates very concise and easy-to-read code. With [Deephaven](https://deephaven.io), quants can create new models
1818
and get them into production quickly, traders can monitor the market and their portfolios, and
1919
managers can monitor risk.
2020

2121
[deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) combines the low-cost trading of
2222
[Interactive Brokers](https://www.interactivebrokers.com/) with the analytical power and ease of use of
2323
[Deephaven Community Core](https://github.com/deephaven/deephaven-core) to yield an open, quantitative
24-
trading platform. Basically, it provides an open platform for building a quantitative hedge fund or for performing
25-
quantitative trading in your personal account.
24+
trading platform. Basically, it provides an open platform for building quantitative trading strategies and
25+
custom analytics. You can build something simple, like a portfolio monitor, or something complex, like a
26+
fully-automated, multi-strategy quantitative hedge fund.
2627

2728
[deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) supports trading essentially all common
2829
exchange traded products. These include:
@@ -54,27 +55,35 @@ For more details, see:
5455
For help with [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib):
5556
* [deephaven-ib Docs](https://deephaven-examples.github.io/deephaven-ib/)
5657
* [Gitter: A relaxed chat room about all things Deephaven](https://gitter.im/deephaven/deephaven)
57-
* [Deephaven Community Slack](https://http://deephavencommunity.slack.com/)
58+
* [Deephaven Community Slack](https://join.slack.com/t/deephavencommunity/shared_invite/zt-11x3hiufp-DmOMWDAvXv_pNDUlVkagLQ)
5859

5960
For Deephaven how-to guides, see:
6061
* [Deephaven Tutorial](https://deephaven.io/core/docs/tutorials/overview/)
6162
* [Deephaven Coummunity Core Documentation](https://deephaven.io/core/docs/).
6263

6364
For help with [Deephaven](https://deephaven.io):
6465
* [Gitter: A relaxed chat room about all things Deephaven](https://gitter.im/deephaven/deephaven)
65-
* [Deephaven Community Slack](https://http://deephavencommunity.slack.com/)
66+
* [Deephaven Community Slack](https://join.slack.com/t/deephavencommunity/shared_invite/zt-11x3hiufp-DmOMWDAvXv_pNDUlVkagLQ)
6667
* [Deephaven Community Core Discussions](https://github.com/deephaven/deephaven-core/discussions)
6768

6869

69-
# Available Data
70+
# Data Available in Deephaven
71+
72+
The [Deephaven](https://deephaven.io) query engine is built around the concept of tables, which are similar to Pandas dataframes.
73+
Unlike Pandas dataframes, [Deephaven](https://deephaven.io) tables can dynamically update as new data is streamed in.
74+
As input tables change, the [Deephaven](https://deephaven.io) query engine ensures that all queries, no matter how complex,
75+
are kept up-to-date.
7076

71-
[deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) stores all data as dynamically updating
72-
[Deephaven](https://deephaven.io) tables. [Deephaven](https://deephaven.io) tables are extremely powerful and can
73-
express complex logic concisely.
77+
Once data is converted to a [Deephaven](https://deephaven.io) table, it can be used in queries with any other
78+
[Deephaven](https://deephaven.io) tables.
7479

75-
## TWS data
80+
## IB TWS data
7681

77-
Tables available from [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php) include:
82+
Data available from [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php) can be accessed
83+
as [Deephaven](https://deephaven.io) tables by using [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib).
84+
As data streams in, the tables and queries using them will automatically update.
85+
86+
These tables include:
7887

7988
* General
8089
* `errors`: an error log
@@ -122,7 +131,7 @@ Most tables include a `ReceiveTime` column. This column indicates the time the
122131

123132
## Your data
124133

125-
[Deephaven](https://deephaven.io) can load data from:
134+
You may want to combine data from other sources with your IB data. [Deephaven](https://deephaven.io) can load data from:
126135
* [CSV](https://deephaven.io/core/docs/how-to-guides/csv-import/)
127136
* [Parquet](https://deephaven.io/core/docs/how-to-guides/parquet-flat/)
128137
* [Kafka](https://deephaven.io/core/docs/how-to-guides/kafka-topics/).
@@ -153,20 +162,22 @@ To setup and configure the system:
153162
1) Launch [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php).
154163
1) In [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php), click on the gear in the
155164
upper right corner. ![](docs/assets/config-gear.png)
156-
In API->Settings, make sure:
165+
In `API->Settings`, make sure:
157166

158167
* "Enable ActiveX and Socket Clients" is selected.
159168
* "Allow connections from localhost only" is not selected.
160169
* "Read-Only API" is selected if you want to prevent trade submission from [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib).
161170

162171
Also, note the "Socket port" value. It is needed when connecting [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib).
163172
![](docs/assets/config-api.png)
173+
1) [For Paper Trading] Log into the [Interactive Brokers Web Interface](https://interactivebrokers.com/).
174+
1) [For Paper Trading] In the [Interactive Brokers Web Interface](https://interactivebrokers.com/), navigate to `Account->Settings->Paper Trading Account` and make sure that "Share real-time market data subscriptions with paper trading account?" is set to true.
164175

165176
## Launch
166177
To launch the system:
167178

168179
1) Launch [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php).
169-
1) Accept incoming connections to [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php).
180+
1) Accept incoming connections to [IB Trader Workstation (TWS)](https://www.interactivebrokers.com/en/trading/tws.php). (May not be required for all sessions.)
170181
![](docs/assets/allow-connections.png)
171182
1) Build the Docker images:
172183
```bash
@@ -192,6 +203,10 @@ To get help on running the system:
192203

193204
# Use deephaven-ib
194205

206+
To use [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib), you will need to open the [Deephaven Web IDE](http://localhost:10000/ide/)
207+
by navigating to [http://localhost:10000/ide/](http://localhost:10000/ide/) in your web browser. The following commands
208+
can be executed in the console.
209+
195210
## Connect to TWS
196211

197212
All [deephaven-ib](https://github.com/deephaven-examples/deephaven-ib) sessions need to first create a client for interacting

src/deephaven_ib/_internal/tablewriter.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Functionality for creating Deephaven tables."""
22

33
import logging
4-
from typing import List, Any, Sequence, Union, Dict
4+
from typing import List, Any, Sequence, Union, Set
55
import collections
66

77
import deephaven.DateTimeUtils as dtu
@@ -78,6 +78,7 @@ def write_row(self, values: List) -> None:
7878

7979
ArrayStringSet = jpy.get_type("io.deephaven.stringset.ArrayStringSet")
8080

81+
_unmapped_values_already_logged:Set[str] = set()
8182

8283
def map_values(value, map, default=lambda v: f"UNKNOWN({v})") -> Any:
8384
""" Maps one set of values to another. A default value is used if the value is not in the map. """
@@ -88,7 +89,12 @@ def map_values(value, map, default=lambda v: f"UNKNOWN({v})") -> Any:
8889
try:
8990
return map[value]
9091
except KeyError:
91-
logging.error(f"Unmapped value: '{value}'\n{trace_str()}\n-----")
92+
msg = f"Unmapped value. Please file an issue at https://github.com/deephaven-examples/deephaven-ib/issues: '{value}'\n{trace_str()}\n-----"
93+
94+
if msg not in _unmapped_values_already_logged:
95+
_unmapped_values_already_logged.add(msg)
96+
logging.error(msg)
97+
9298
return default(value)
9399

94100

0 commit comments

Comments
 (0)