v1.211.0

nautechsystems/nautilus_traderv1.211.0Feb 9, 2025by github-actions[bot]

AI Summary

This release introduces high-precision mode (128-bit integers) for value types to address precision and range issues. It also renames several instrument and module types for clarity and moves the SQL schema directory.

Key Highlights

  • Introduced high-precision mode for 128-bit integer backed value types
  • Renamed `OptionsContract` to `OptionContract` and `OptionsSpread` to `OptionSpread`
  • This is the final version using Poetry for package management

Breaking Changes

  • Renamed `OptionsContract` to `OptionContract` and `OptionsSpread` to `OptionSpread`
  • Renamed `InstrumentClass.FUTURE_SPREAD` to `InstrumentClass.FUTURES_SPREAD`
  • Renamed `event_logging` config option to `log_events`
  • Moved SQL schema directory to `schemas/sql`
  • Changed Arrow schemas to use `FixedSizeBinary` fields for precision modes
  • Changed `ws_connection_delay_secs` meaning for PolymarketDataClientConfig
  • Renamed `GATEIO` to `GATE_IO` for consistency
  • Removed `max_ws_reconnection_tries` for dYdX and Bybit configs

New Features

  • Added high-precision mode for 128-bit integer backed value types
  • Added instrument definitions range requests for `TardisHttpClient`
  • Added `log_commands` config option for logging filtering
  • Added `venue_position_id` parameter for `OrderStatusReport`
  • Added bars update support for `Portfolio` PnLs
  • Added `timeout_shutdown` config option
  • Added `BetSide` enum and `Bet`/`BetPosition` types for betting markets
  • Added `total_pnl` and `total_pnls` methods for `Portfolio`

Full Release Notes

# NautilusTrader 1.211.0 Beta

Released on 9th February 2025 (UTC).

This release introduces [high-precision mode](https://nautilustrader.io/docs/nightly/concepts/overview#value-types), where value types such as `Price`, `Quantity` and `Money` are now backed by 128-bit integers (instead of 64-bit), thereby increasing maximum precision to 16, and vastly expanding the allowable value ranges.

This will address precision and value range issues experienced by some crypto users, alleviate higher timeframe bar volume limitations, as well as future proofing the platform.

See the [RFC](https://github.com/nautechsystems/nautilus_trader/issues/2084) for more details. For an explanation on compiling with or without high-precision mode, see the [precision-mode](https://nautilustrader.io/docs/nightly/getting_started/installation/#precision-mode) section of the installation guide.

**For migrating data catalogs due to the breaking changes, see the [data migrations guide](https://nautilustrader.io/docs/nightly/concepts/data#data-migrations)**.

**This release will be the final version that uses Poetry for package and dependency management.**

### Enhancements
- Added `high-precision` mode for 128-bit integer backed value types (#2072), thanks @twitu
- Added instrument definitions range requests for `TardisHttpClient` with optional `start` and `end` filter parameters
- Added `quote_currency`, `base_currency`, `instrument_type`, `contract_type`, `active`, `start` and `end` filters for `TardisInstrumentProvider`
- Added `log_commands` config option for `ActorConfig`, `StrategyConfig`, `ExecAlgorithmConfig` for more efficient log filtering
- Added additional limit parameters for `BettingInstrument` constructor
- Added `venue_position_id` parameter for `OrderStatusReport`
- Added bars update support for `Portfolio` PnLs (#2239), thanks @faysou
- Added optional `params` for `Strategy` order management methods (symmetry with `Actor` data methods) (#2251), thanks @faysou
- Added heartbeats for Betfair clients to keep streams alive (more robust when initial subscription delays)
- Added `timeout_shutdown` config option for `NautilusKernelConfig`
- Added IOC time in force mapping for Betfair orders
- Added `min_market_start_time` and `max_market_start_time` time range filtering for `BetfairInstrumentProviderConfig`
- Added `default_min_notional` config option for `BetfairInstrumentProviderConfig`
- Added `stream_conflate_ms` config option for `BetfairDataClientConfig`
- Added `recv_window_ms` config option for `BybitDataClientConfig` and `BybitExecClientConfig`
- Added `open_check_open_only` config option for `LiveExecEngineConfig`
- Added `BetSide` enum (to support `Bet` and `BetPosition`)
- Added `Bet` and `BetPosition` for betting market risk and PnL calculations
- Added `total_pnl` and `total_pnls` methods for `Portfolio`
- Added optional `price` parameter for `Portfolio` unrealized PnL and net exposure methods

### Breaking Changes
- Renamed `OptionsContract` instrument to `OptionContract` for more technically correct terminology (singular)
- Renamed `OptionsSpread` instrument to `OptionSpread` for more technically correct terminology (singular)
- Renamed `options_contract` modules to `option_contract` (see above)
- Renamed `options_spread` modules to `option_spread` (see above)
- Renamed `InstrumentClass.FUTURE_SPREAD` to `InstrumentClass.FUTURES_SPREAD` for more technically correct terminology
- Renamed `event_logging` config option to `log_events`
- Renamed `BetfairExecClientConfig.request_account_state_period` to `request_account_state_secs`
- Moved SQL schema directory to `schemas/sql` (reinstall the Nautilus CLI with `make install-cli`)
- Changed `OrderBookDelta` Arrow schema to use `FixedSizeBinary` fields to support the new precision modes
- Changed `OrderBookDepth10` Arrow schema to use `FixedSizeBinary` fields to support the new precision modes
- Changed `QuoteTick` Arrow schema to use `FixedSizeBinary` fields to support the new precision modes
- Changed `TradeTick` Arrow schema to use `FixedSizeBinary` fields to support the new precision modes
- Changed `Bar` Arrow schema to use `FixedSizeBinary` fields to support the new precision modes
- Changed `BettingInstrument` default `min_notional` to `None`
- Changed meaning of `ws_connection_delay_secs` for [PolymarketDataClientConfig](https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/adapters/polymarket/config.py) to be **non-initial** delay (#2271)
- Changed `GATEIO` Tardis venue to `GATE_IO` for consistency with `CRYPTO_COM` and `BLOCKCHAIN_COM`
- Removed `max_ws_reconnection_tries` for dYdX configs (no longer applicable with infinite retries and exponential backoff)
- Removed `max_ws_reconnection_tries` for Bybit configs (no longer applicable with infinite retries and exponential backoff)
- Removed remaining `max_ws_reconnection_tries` for Bybit configs (#2290), thanks @sunlei

### Internal Improvements
- Added `ThrottledEnqueuer` for more efficient and robust live engines queue management and logging
- Added `OrderBookDeltaTestBuilder` in Rust to improve testing (#2234), thanks @filipmacek
- Added custom certificate loading for `SocketClient` TLS
- Added `check_nonempty_string` for string validation in Rust
- Improved Polymarket WebSocket subscription handling by configurable delay (#2271), thanks @ryantam626
- Improved `WebSocketClient` with state management, error handling, timeouts and robust reconnects with exponential backoff
- Improved `SocketClient` with state management, error handling, timeouts and robust reconnects with exponential backoff
- Improved `TradingNode` shutdown when running with `asyncio.run()` (more orderly handling of event loop)
- Improved `NautilusKernel` pending tasks cancellation on shutdown
- Improved `TardisHttpClient` requests and error handling
- Improved log file writer to strip ANSI escape codes and unprintable chars
- Improved `clean` make target behavior and added `distclean` make target (#2286), @demonkoryu
- Refined `Currency` `name` to accept non-ASCII characters (common for foreign currencies)
- Refactored CI with composite actions (#2242), thanks @sunlei
- Refactored Option Greeks feature (#2266), thanks @faysou
- Changed validation to allow zero commission for `PerContractFeeModel` (#2282), thanks @stefansimik
- Changed to use `mold` as the linker in CI (#2254), thanks @sunlei
- Ported market order processing for `OrderMatchingEngine` in Rust (#2202), thanks @filipmacek
- Ported limit order processing for `OrderMatchingEngine` in Rust (#2212), thanks @filipmacek
- Ported stop limit order processing for `OrderMatchingEngine` in Rust (#2225), thanks @filipmacek
- Ported `CancelOrder` processing for `OrderMatchingEngine` in Rust (#2231), thanks @filipmacek
- Ported `CancelAllOrders` processing for `OrderMatchingEngine` in Rust (#2253), thanks @filipmacek
- Ported `BatchCancelOrders` processing for `OrderMatchingEngine` in Rust (#2256), thanks @filipmacek
- Ported expire order processing for `OrderMatchingEngine` in Rust (#2259), thanks @filipmacek
- Ported modify order processing for `OrderMatchingEngine` in Rust (#2261), thanks @filipmacek
- Ported generate fresh account state for `SimulatedExchange` in Rust (#2272), thanks @filipmacek
- Ported adjust account for SimulatedExchange in Rust (#2273), thanks @filipmacek
- Continued porting `RiskEngine` to Rust (#2210), thanks @Pushkarm029
- Continued porting `ExecutionEngine` to Rust (#2214), thanks @Pushkarm029
- Continued porting `OrderEmulator` to Rust (#2219, #2226), thanks @Pushkarm029
- Moved `model` crate stubs into defaults (#2235), thanks @fhill2
- Upgraded `pyo3` crate to v0.23.4
- Upgraded `pyo3-async-runtimes` crate to v0.23.0

### Fixes
- Fixed `LiveTimer` immediate fire when start time zero (#2270), thanks for reporting @bartolootrit
- Fixed order book action parsing for Tardis (ensures zero sizes in snapshots work with the tighter validation for `action` vs `size`)
- Fixed PnL calculations for betting instruments in `Portfolio`
- Fixed net exposure for betting instruments in `Portfolio`
- Fixed backtest start and end time validation assertion (#2203), thanks @davidsblom
- Fixed `CustomData` import in `DataEngine` (#2207), thanks @graceyangfan and @faysou
- Fixed databento helper function (#2208), thanks @faysou
- Fixed live reconciliation of generated order fills to use the `venue_position_id` (when provided), thanks for reporting @sdk451
- Fixed `InstrumentProvider` initialization behavior when `reload` flag `True`, thanks @ryantam626
- Fixed handling of Binance HTTP error messages (not always JSON-parsable, leading to `msgspec.DecodeError`)
- Fixed `CARGO_TARGET_DIR` environment variable for build script (#2228), thanks @sunlei
- Fixed typo in `delta.rs` doc comment (#2230), thanks @eltociear
- Fixed memory leak in network PyO3 layer caused by the `gil-refs` feature (#2229), thanks for reporting @davidsblom
- Fixed reconnect handling for Betfair (#2232, #2288, #2289), thanks @limx0
- Fixed `instrument.id` null dereferences in error logs (#2237), thanks for reporting @ryantam626
- Fixed schema for listing markets of dYdX (#2240), thanks @davidsblom
- Fixed realized pnl calculation in `Portfolio` where flat positions were not included in cumulative sum (#2243), thanks @faysou
- Fixed update order in `Cache` for Rust (#2248), thanks @filipmacek
- Fixed websocket schema for market updates of dYdX (#2258), thanks @davidsblom
- Fixed handling of empty book messages for Tardis (resulted in `deltas` cannot be empty panicking)
- Fixed `Cache.bar_types` `aggregation_source` filtering, was incorrectly using `price_type` (#2269), thanks @faysou
- Fixed missing `combo` instrument type for Tardis integration
- Fixed quote tick processing from bars in `OrderMatchingEngine` resulting in sizes below the minimum increment (#2275), thanks for reporting @miller-moore
- Fixed initialization of `BinanceErrorCode`s requiring `int`
- Fixed resolution of Tardis `BINANCE_DELIVERY` venue for COIN-margined contracts
- Fixed hang in rate limiter (#2285), thanks @WyldeCat
- Fixed typo in `InstrumentProviderConfig` docstring (#2284), thanks @ikeepo
- Fixed handling of `tick_size_change` message for Polymarket

### Documentation Updates
- Added Databento overview tutorial (#2233, #2252), thanks @stefansimik
- Added docs for Actor (#2233), thanks @stefansimik
- Added docs for Portfolio limitations with bar data (#2233), thanks @stefansimik
- Added docs overview for example locations in repository (#2287), thanks @stefansimik
- Improved docstrings for Actor subscription and request methods
- Refined `streaming` parameter description (#2293), thanks @faysou and @stefansimik

### Deprecations
- The [talib](https://github.com/nautechsystems/nautilus_trader/tree/develop/nautilus_trader/indicators/ta_lib) subpackage for indicators is deprecated and will be removed in a future version, see [RFC](https://github.com/nautechsystems/nautilus_trader/issues/2206)