Skip to content

Commit 622014e

Browse files
authored
Release 1.180.0
See release notes.
2 parents ef4d72e + 7db5619 commit 622014e

File tree

337 files changed

+6421
-3459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+6421
-3459
lines changed

.deepsource.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version = 1
2+
3+
[[analyzers]]
4+
name = "rust"
5+
6+
[analyzers.meta]
7+
msrv = "stable"
8+
9+
[[analyzers]]
10+
name = "shell"
11+
12+
[[analyzers]]
13+
name = "python"
14+
15+
[analyzers.meta]
16+
runtime_version = "3.x.x"

.github/workflows/build.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
arch: [x64]
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
python-version: ["3.9", "3.10", "3.11"]
18+
python-version: ["3.10", "3.11"]
1919
defaults:
2020
run:
2121
shell: bash
@@ -89,7 +89,9 @@ jobs:
8989
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
9090

9191
- name: Run pre-commit
92-
run: pre-commit run --all-files
92+
run: |
93+
# pre-commit run --hook-stage manual gitlint-ci
94+
pre-commit run --all-files
9395
9496
- name: Install Redis (macOS)
9597
if: runner.os == 'macOS'

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
arch: [x64]
2020
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python-version: ["3.9", "3.10", "3.11"]
21+
python-version: ["3.10", "3.11"]
2222
defaults:
2323
run:
2424
shell: bash
@@ -245,7 +245,7 @@ jobs:
245245
matrix:
246246
arch: [x64]
247247
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
248-
python-version: ["3.9", "3.10", "3.11"]
248+
python-version: ["3.10", "3.11"]
249249
defaults:
250250
run:
251251
shell: bash
@@ -318,9 +318,9 @@ jobs:
318318
- name: Set release output
319319
id: vars
320320
run: |
321-
echo "ASSET_PATH=$(find ./dist -mindepth 1 -print -quit)" >> $ GITHUB_ENV
321+
echo "ASSET_PATH=$(find ./dist -mindepth 1 -print -quit)" >> $GITHUB_ENV
322322
cd dist
323-
echo "ASSET_NAME=$(printf '%s\0' * | awk 'BEGIN{RS="\0"} {print; exit}')" >> $ GITHUB_ENV
323+
echo "ASSET_NAME=$(printf '%s\0' * | awk 'BEGIN{RS="\0"} {print; exit}')" >> $GITHUB_ENV
324324
325325
- name: Upload release asset
326326
id: upload-release-asset-unix

.gitlint

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[general]
2+
ignore=body-is-missing,body-min-length
3+
4+
[title-max-length]
5+
line-length=80
6+
7+
[title-min-length]
8+
min-length=5

.pre-commit-config.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ repos:
2424
- id: check-xml
2525
- id: check-yaml
2626

27+
- repo: https://github.com/jorisroovers/gitlint
28+
rev: v0.19.1
29+
hooks:
30+
- id: gitlint
31+
# - id: gitlint-ci
32+
2733
- repo: https://github.com/codespell-project/codespell
2834
rev: v2.2.6
2935
hooks:
@@ -67,7 +73,7 @@ repos:
6773
types: [python]
6874

6975
- repo: https://github.com/psf/black
70-
rev: 23.10.0
76+
rev: 23.10.1
7177
hooks:
7278
- id: black
7379
types_or: [python, pyi]
@@ -76,7 +82,7 @@ repos:
7682
exclude: "docs/_pygments/monokai.py"
7783

7884
- repo: https://github.com/astral-sh/ruff-pre-commit
79-
rev: v0.1.1
85+
rev: v0.1.3
8086
hooks:
8187
- id: ruff
8288
args: ["--fix"]

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To contribute, follow these steps:
1616
6. The CI system will run the full test-suite over your code including all unit and integration tests, so include appropriate tests
1717
with the PR.
1818

19-
7. [Codacy](https://www.codacy.com/) will perform an automated code review.
19+
7. [Deepsource](https://deepsource.io) will perform an automated code review.
2020
Fix any issues which cause a failed check, and add the commit to your PR.
2121

2222
8. You will also be required to sign a standard Contributor License Agreement (CLA), which is administered automatically through [CLA Assistant](https://cla-assistant.io/).

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# <img src="https://github.com/nautechsystems/nautilus_trader/blob/develop/docs/_images/nautilus-trader-logo.png" width="500">
22

3-
[![codacy-quality](https://api.codacy.com/project/badge/Grade/a1d3ccf7bccb4483b091975681a5cb23)](https://app.codacy.com/gh/nautechsystems/nautilus_trader?utm_source=github.com&utm_medium=referral&utm_content=nautechsystems/nautilus_trader&utm_campaign=Badge_Grade_Dashboard)
43
[![codecov](https://codecov.io/gh/nautechsystems/nautilus_trader/branch/master/graph/badge.svg?token=DXO9QQI40H)](https://codecov.io/gh/nautechsystems/nautilus_trader)
54
![pythons](https://img.shields.io/pypi/pyversions/nautilus_trader)
65
![pypi-version](https://img.shields.io/pypi/v/nautilus_trader)
@@ -15,10 +14,10 @@
1514

1615
| Platform | Rust | Python |
1716
| :----------------- | :------ | :----- |
18-
| `Linux (x86_64)` | 1.73.0+ | 3.9+ |
19-
| `macOS (x86_64)` | 1.73.0+ | 3.9+ |
20-
| `macOS (arm64)` | 1.73.0+ | 3.9+ |
21-
| `Windows (x86_64)` | 1.73.0+ | 3.9+ |
17+
| `Linux (x86_64)` | 1.73.0+ | 3.10+ |
18+
| `macOS (x86_64)` | 1.73.0+ | 3.10+ |
19+
| `macOS (arm64)` | 1.73.0+ | 3.10+ |
20+
| `Windows (x86_64)` | 1.73.0+ | 3.10+ |
2221

2322
- **Website:** https://nautilustrader.io
2423
- **Docs:** https://docs.nautilustrader.io
@@ -140,14 +139,15 @@ NautilusTrader is designed in a modular way to work with 'adapters' which provid
140139
connectivity to data publishers and/or trading venues - converting their raw API
141140
into a unified interface. The following integrations are currently supported:
142141

143-
| Name | ID | Type | Status | Docs |
144-
| :-------------------------------------------------------- | :-------- | :---------------------- | :------------------------------------------------------ | :---------------------------------------------------------------- |
145-
| [Betfair](https://betfair.com) | `BETFAIR` | Sports Betting Exchange | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) |
146-
| [Binance](https://binance.com) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
147-
| [Binance US](https://binance.us) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
148-
| [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
149-
| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | |
150-
| [Interactive Brokers](https://www.interactivebrokers.com) | `IB` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) |
142+
| Name | ID | Type | Status | Docs |
143+
| :-------------------------------------------------------- | :---------- | :---------------------- | :------------------------------------------------------ | :---------------------------------------------------------------- |
144+
| [Betfair](https://betfair.com) | `BETFAIR` | Sports betting exchange | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/betfair.html) |
145+
| [Binance](https://binance.com) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
146+
| [Binance US](https://binance.us) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
147+
| [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
148+
| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | |
149+
| [Databento](https://databento.com) | `DATABENTO` | Data provider | ![status](https://img.shields.io/badge/building-orange) | |
150+
| [Interactive Brokers](https://www.interactivebrokers.com) | `IB` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) |
151151

152152
Refer to the [Integrations](https://docs.nautilustrader.io/integrations/index.html) documentation for further details.
153153

RELEASES.md

+49-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
# NautilusTrader 1.180.0 Beta
2+
3+
Released on 3rd November 2023 (UTC).
4+
5+
### Enhancements
6+
- Improved internal latency for live engines by using `loop.call_soon_threadsafe(...)`
7+
- Improved `RedisCacheDatabase` client connection error handling with retries
8+
- Added `WebSocketClient` connection headers, thanks @ruthvik125 and @twitu
9+
- Added `support_contingent_orders` option for venues (to simulate venues which do not support contingent orders)
10+
- Added `StrategyConfig.manage_contingent_orders` option (to automatically manage **open** contingenct orders)
11+
- Added `FuturesContract.activation_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
12+
- Added `OptionsContract.activation_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
13+
- Added `CryptoFuture.activation_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
14+
- Added `FuturesContract.expiration_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
15+
- Added `OptionsContract.expiration_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
16+
- Added `CryptoFuture.expiration_utc` property which returns a `pd.Timestamp` tz-aware (UTC)
17+
18+
### Breaking Changes
19+
- Renamed `FuturesContract.expiry_date` to `expiration_ns` (and associated params) as `uint64_t` UNIX nanoseconds
20+
- Renamed `OptionsContract.expiry_date` to `expiration_ns` (and associated params) as `uint64_t` UNIX nanoseconds
21+
- Renamed `CryptoFuture.expiry_date` to `expiration_ns` (and associated params) as `uint64_t` UNIX nanoseconds
22+
- Changed `FuturesContract` arrow schema
23+
- Changed `OptionsContract` arrow schema
24+
- Changed `CryptoFuture` arrow schema
25+
- Transformed orders will now retain the original `ts_init` timestamp
26+
- Removed unimplemented `batch_more` option for `Strategy.modify_order`
27+
- Removed `InstrumentProvider.venue` property (redundant as a provider may have many venues)
28+
- Dropped support for Python 3.9
29+
30+
### Fixes
31+
- Fixed `ParquetDataCatalog` file writing template, thanks @limx0
32+
- Fixed `Binance` all orders requests which would omit order reports when using a `start` param
33+
- Fixed managed GTD orders past expiry cancellation on restart (orders were not being canceled)
34+
- Fixed managed GTD orders cancel timer on order cancel (timers were not being canceled)
35+
- Fixed `BacktestEngine` logging error with immediate stop (caused by certain timestamps being `None`)
36+
- Fixed `BacktestNode` exceptions during backtest runs preventing next sequential run, thanks for reporting @cavan-black
37+
- Fixed `BinanceSpotPersmission` value error by relaxing typing for `BinanceSpotSymbolInfo.permissions`
38+
- Interactive Brokers adapter various fixes, thanks @rsmb7z
39+
40+
---
41+
142
# NautilusTrader 1.179.0 Beta
243

344
Released on 22nd October 2023 (UTC).
@@ -153,7 +194,7 @@ Released on 31st July 2023 (UTC).
153194
- Fixed dictionary representation of orders for `venue_order_id` (for three order types)
154195
- Fixed `Currency` registration with core global map on creation
155196
- Fixed serialization of `OrderInitialized.exec_algorithm_params` to spec (bytes rather than string)
156-
- Fixed assignment of position IDs for contingency orders (when parent filled)
197+
- Fixed assignment of position IDs for contingent orders (when parent filled)
157198
- Fixed `PENDING_CANCEL` -> `EXPIRED` as valid state transition (real world possibility)
158199
- Fixed fill handling of `reduce_only` orders when partially filled
159200
- Fixed Binance reconciliation which was requesting reports for the same symbol multiple times
@@ -231,8 +272,8 @@ Released on 19th May 2023 (UTC).
231272
- Fixed handling of emulated order contingencies (not based on status of spawned algorithm orders)
232273
- Fixed sending execution algorithm commands from strategy
233274
- Fixed `OrderEmulator` releasing of already closed orders
234-
- Fixed `MatchingEngine` processing of reduce only for child contingency orders
235-
- Fixed `MatchingEngine` position ID assignment for child contingency orders
275+
- Fixed `MatchingEngine` processing of reduce only for child contingent orders
276+
- Fixed `MatchingEngine` position ID assignment for child contingent orders
236277
- Fixed `Actor` handling of historical data from requests (will now call `on_historical_data` regardless of state), thanks for reporting @miller-moore
237278
- Fixed pyarrow schema dictionary index keys being too narrow (int8 -> int16), thanks for reporting @rterbush
238279

@@ -279,15 +320,15 @@ Released on 30th April 2023 (UTC).
279320
- Added `TWAPExecAlgorithm` and `TWAPExecAlgorithmConfig` to examples
280321
- Build out `ExecAlgorithm` base class for implementing 'first class' execution algorithms
281322
- Rewired execution for improved flow flexibility between emulated orders, execution algorithms and the `RiskEngine`
282-
- Improved handling for `OrderEmulator` updating of contingency orders from execution algorithms
323+
- Improved handling for `OrderEmulator` updating of contingent orders from execution algorithms
283324
- Defined public API for instruments, can now import directly from `nautilus_trader.model.instruments` (denest namespace)
284325
- Defined public API for orders, can now import directly from `nautilus_trader.model.orders` (denest namespace)
285326
- Defined public API for order book, can now import directly from `nautilus_trader.model.orderbook` (denest namespace)
286327
- Now stripping debug symbols after build (reduced binary sizes)
287328
- Refined build and added additional `debug` Makefile convenience targets
288329

289330
### Fixes
290-
- Fixed processing of contingency orders when in a pending update state
331+
- Fixed processing of contingent orders when in a pending update state
291332
- Fixed calculation of PnL for flipped positions (only book realized PnL against open position)
292333
- Fixed `WebSocketClient` session disconnect, thanks for reporting @miller-moore
293334
- Added missing `BinanceSymbolFilterType.NOTIONAL`
@@ -596,7 +637,7 @@ Released on 28th November 2022 (UTC).
596637
- Renamed `Instrument.get_cost_currency(...)` to `Instrument.get_settlement_currency(...)` (more accurate terminology)
597638

598639
### Enhancements
599-
- Added emulated contingency orders capability to `OrderEmulator`
640+
- Added emulated contingent orders capability to `OrderEmulator`
600641
- Moved `test_kit` module to main package to support downstream project/package testing
601642

602643
### Fixes
@@ -628,7 +669,7 @@ Released on 18th November 2022 (UTC).
628669
- Fixed bar aggregation start times for bar specs outside typical intervals (60-SECOND rather than 1-MINUTE etc)
629670
- Fixed backtest engine main loop ordering of time events with identically timestamped data
630671
- Fixed `ModifyOrder` message `str` and `repr` when no quantity
631-
- Fixed OCO contingency orders which were actually implemented as OUO for backtests
672+
- Fixed OCO contingent orders which were actually implemented as OUO for backtests
632673
- Fixed various bugs for Interactive Brokers integration, thanks @limx0 and @rsmb7z
633674
- Fixed pyarrow version parsing, thanks @ghill2
634675
- Fixed returning venue from InstrumentId, thanks @rsmb7z
@@ -1444,7 +1485,7 @@ Released on 12th September 2021.
14441485
- Added order custom user tags
14451486
- Added `Actor.register_warning_event` (also applicable to `TradingStrategy`)
14461487
- Added `Actor.deregister_warning_event` (also applicable to `TradingStrategy`)
1447-
- Added `ContingencyType` enum (for contingency orders in an `OrderList`)
1488+
- Added `ContingencyType` enum (for contingent orders in an `OrderList`)
14481489
- All order types can now be `reduce_only` (#437)
14491490
- Refined backtest configuration options
14501491
- Improved efficiency of `UUID4` using the Rust `fastuuid` Python bindings

build.py

-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import annotations
4-
53
import itertools
64
import os
75
import platform
@@ -50,9 +48,6 @@
5048
# Use clang as the default compiler
5149
os.environ["CC"] = "clang"
5250
os.environ["LDSHARED"] = "clang -shared"
53-
# elif platform.system() == "Windows":
54-
# os.environ["CC"] = "cl"
55-
# os.environ["CXX"] = "cl"
5651

5752
TARGET_DIR = Path.cwd() / "nautilus_core" / "target" / BUILD_MODE
5853

@@ -148,15 +143,8 @@ def _build_extensions() -> list[Extension]:
148143
extra_compile_args = []
149144
extra_link_args = RUST_LIBS
150145

151-
if platform.system() == "Darwin":
152-
extra_compile_args.append("-Wno-unreachable-code-fallthrough")
153-
extra_link_args.append("-flat_namespace")
154-
extra_link_args.append("-undefined")
155-
extra_link_args.append("suppress")
156-
157146
if platform.system() != "Windows":
158147
# Suppress warnings produced by Cython boilerplate
159-
extra_compile_args.append("-Wno-parentheses-equality")
160148
extra_compile_args.append("-Wno-unreachable-code")
161149
if BUILD_MODE == "release":
162150
extra_compile_args.append("-O2")

docs/concepts/adapters.md

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ as configured:
6262
- All instruments are automatically loaded on start:
6363

6464
```python
65+
from nautilus_trader.config import InstrumentProviderConfig
66+
6567
InstrumentProviderConfig(load_all=True)
6668
```
6769

@@ -124,6 +126,10 @@ cpdef void request_instrument(self, InstrumentId instrument_id, ClientId client_
124126
The handler on the `ExecutionClient`:
125127

126128
```python
129+
from nautilus_trader.core.uuid import UUID4
130+
from nautilus_trader.model.data import DataType
131+
from nautilus_trader.model.identifiers import InstrumentId
132+
127133
# nautilus_trader/adapters/binance/spot/data.py
128134
def request_instrument(self, instrument_id: InstrumentId, correlation_id: UUID4):
129135
instrument: Optional[Instrument] = self._instrument_provider.find(instrument_id)

0 commit comments

Comments
 (0)