You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Renamed `OptionKind``kind` parameter and property to `option_kind` (better clarity)
17
+
- Renamed `OptionsContract` Arrow schema field `kind` to `option_kind`
18
+
- Changed `level_file` log level to `OFF` (file logging is off by default)
19
+
20
+
### Fixes
21
+
- Fixed memory leak for catalog queries (#1430), thanks @twitu
22
+
- Fixed `DataEngine` order book snapshot timer names (could not parse instrument IDs with hyphens), thanks for reporting @x-zho14 and @dimitar-petrov
23
+
- Fixed `LoggingConfig` parsing of `WARNING` log level (was not being recognized), thanks for reporting @davidsblom
24
+
- Fixed Binance Futures `QuoteTick` parsing to capture event time for `ts_event`, thanks for reporting @x-zho14
25
+
26
+
---
27
+
1
28
# NautilusTrader 1.183.0 Beta
2
29
3
30
Released on 12th January 2024 (UTC).
@@ -7,7 +34,7 @@ Released on 12th January 2024 (UTC).
7
34
- Added `InstrumentClass.BOND`
8
35
- Added `MessageBusConfig``use_trader_prefix` and `use_trader_id` options (provides more control over stream names)
9
36
- Added `CacheConfig.drop_instruments_on_reset` (default true to retain current behavior)
10
-
- Implemented core logging interface via the `log`library, thanks @twitu
37
+
- Implemented core logging interface via the `log`crate, thanks @twitu
11
38
- Implemented global atomic clock in Rust (improves performance and ensures properly monotonic timestamps in real-time), thanks @twitu
12
39
- Improved Interactive Brokers adapter raising docker `RuntimeError` only when needed (not when using TWS), thanks @rsmb7z
13
40
- Upgraded core HTTP client to latest `hyper` and `reqwest`, thanks @ayush-sb
@@ -42,7 +69,7 @@ Released on 12th January 2024 (UTC).
42
69
- Fixed `BinanceSpotInstrumentProvider` fee loading key error for partial instruments load, thanks for reporting @doublier1
43
70
- Fixed Binance API key configuration parsing for testnet (was falling through to non-testnet env vars)
44
71
- Fixed TWAP execution algorithm scheduled size handling when first order should be for the entire size, thanks for reporting @pcgm-team
45
-
- Added `BinanceErrorCode.SERVER_BUSY` (-1008). Also added to the retry error codes.
72
+
- Added `BinanceErrorCode.SERVER_BUSY` (-1008), also added to the retry error codes
46
73
- Added `BinanceOrderStatus.EXPIRED_IN_MATCH` which is when an order was canceled by the exchange due self-trade prevention (STP), thanks for reporting @doublier1
47
74
48
75
---
@@ -207,7 +234,7 @@ This will be the final release with support for Python 3.9.
207
234
- Moved `manage_gtd_expiry` from `Strategy.submit_order(...)` and `Strategy.submit_order_list(...)` to `StrategyConfig` (simpler and allows re-activiting any GTD timers on start)
208
235
209
236
### Fixes
210
-
- Fixed `LimitIfTouchedOrder.create` (exec_algorithm_params were not being passed in)
237
+
- Fixed `LimitIfTouchedOrder.create` (`exec_algorithm_params` were not being passed in)
211
238
- Fixed `OrderEmulator` start-up processing of OTO contingent orders (when position from parent is open)
212
239
- Fixed `SandboxExecutionClientConfig``kw_only=True` to allow importing without initializing
213
240
- Fixed `OrderBook` pickling (did not include all attributes), thanks @limx0
@@ -282,7 +309,7 @@ this change.
282
309
Released on 31st July 2023 (UTC).
283
310
284
311
### Enhancements
285
-
- Implemented string interning with the [ustr](https://github.com/anderslanglands/ustr)library, thanks @twitu
312
+
- Implemented string interning with the [ustr](https://github.com/anderslanglands/ustr)crate, thanks @twitu
286
313
- Added `SyntheticInstrument` capability, including dynamic derivation formulas
287
314
- Added `Order.commissions()` convenience method (also added to state snapshot dictionaries)
288
315
- Added `Cache` position and order state snapshots (configure via `CacheConfig`)
Copy file name to clipboardExpand all lines: docs/integrations/ib.md
+23-3
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,14 @@
1
1
# Interactive Brokers
2
2
3
-
Interactive Brokers (IB) is a trading platform that allows trading in a wide range of financial instruments, including stocks, options, futures, currencies, bonds, funds, and cryptocurrencies. NautilusTrader offers an adapter to integrate with IB using their [Trader Workstation (TWS) API](https://interactivebrokers.github.io/tws-api/index.html) through their Python library, [ibapi](https://github.com/nautechsystems/ibapi).
3
+
Interactive Brokers (IB) is a trading platform that allows trading across a wide range of financial instruments, including stocks, options, futures, currencies, bonds, funds, and cryptocurrencies. NautilusTrader offers an adapter to integrate with IB using their [Trader Workstation (TWS) API](https://interactivebrokers.github.io/tws-api/index.html) through their Python library, [ibapi](https://github.com/nautechsystems/ibapi).
4
4
5
5
The TWS API serves as an interface to IB's standalone trading applications: TWS and IB Gateway. Both can be downloaded from the IB website. If you haven't installed TWS or IB Gateway yet, refer to the [Initial Setup](https://interactivebrokers.github.io/tws-api/initial_setup.html) guide. In NautilusTrader, you'll establish a connection to one of these applications via the `InteractiveBrokersClient`.
6
6
7
7
Alternatively, you can start with a [dockerized version](https://github.com/gnzsnz/ib-gateway-docker) of the IB Gateway, particularly useful when deploying trading strategies on a hosted cloud platform. This requires having [Docker](https://www.docker.com/) installed on your machine, along with the [docker](https://pypi.org/project/docker/) Python package, which NautilusTrader conveniently includes as an extra package.
8
8
9
-
**Note**: The standalone TWS and IB Gateway applications necessitate manual input of username, password, and trading mode (live or paper) at startup. The dockerized version of the IB Gateway handles these steps programmatically.
9
+
```{note}
10
+
The standalone TWS and IB Gateway applications necessitate manual input of username, password, and trading mode (live or paper) at startup. The dockerized version of the IB Gateway handles these steps programmatically.
11
+
```
10
12
11
13
## Installation
12
14
@@ -22,7 +24,9 @@ For installation via poetry, use:
22
24
poetry add "nautilus_trader[ib,docker]"
23
25
```
24
26
25
-
**Note**: Because IB does not provide wheels for `ibapi`, NautilusTrader [repackages](https://pypi.org/project/nautilus-ibapi/) it for release on PyPI.
27
+
```{note}
28
+
Because IB does not provide wheels for `ibapi`, NautilusTrader [repackages]( https://pypi.org/project/nautilus-ibapi/) it for release on PyPI.
29
+
```
26
30
27
31
28
32
## Getting Started
@@ -65,6 +69,22 @@ The adapter includes several major components:
65
69
-`InteractiveBrokersDataClient`: Connects to the Gateway for streaming market data.
66
70
-`InteractiveBrokersExecutionClient`: Handles account information and executes trades.
67
71
72
+
## The Interactive Brokers Client
73
+
74
+
The `InteractiveBrokersClient` serves as the central component of the IB adapter, overseeing a range of critical functions. These include establishing and maintaining connections, handling API errors, executing trades, and gathering various types of data such as market data, contract/instrument data, and account details.
75
+
76
+
To ensure efficient management of these diverse responsibilities, the `InteractiveBrokersClient` is divided into several specialized mixin classes. This modular approach enhances manageability and clarity. The key subcomponents are:
77
+
-`InteractiveBrokersClientConnectionMixin`: This class is dedicated to managing the connection with TWS/Gateway.
78
+
-`InteractiveBrokersClientErrorMixin`: It focuses on addressing all encountered errors and warnings.
79
+
-`InteractiveBrokersClientAccountMixin`: Responsible for handling requests related to account information and positions.
80
+
-`InteractiveBrokersClientContractMixin`: Handles retrieving contracts (instruments) data
81
+
-`InteractiveBrokersClientMarketDataMixin`: Handles market data requests, subscriptions and data processing
82
+
-`InteractiveBrokersClientOrderMixin`: Oversees all aspects of order placement and management.
83
+
84
+
```{tip}
85
+
To troubleshoot TWS API incoming message issues, consider starting at the `InteractiveBrokersClient._process_message` method, which acts as the primary gateway for processing all messages received from the API.
86
+
```
87
+
68
88
## Instruments & Contracts
69
89
70
90
In IB, a NautilusTrader `Instrument` is equivalent to a [Contract](https://interactivebrokers.github.io/tws-api/contracts.html). Contracts can be either a [basic contract](https://interactivebrokers.github.io/tws-api/classIBApi_1_1Contract.html) or a more [detailed](https://interactivebrokers.github.io/tws-api/classIBApi_1_1ContractDetails.html) version (ContractDetails). The adapter models these using `IBContract` and `IBContractDetails` classes. The latter includes critical data like order types and trading hours, which are absent in the basic contract. As a result, `IBContractDetails` can be converted to an `Instrument` while `IBContract` cannot.
0 commit comments