Skip to content

Commit e658ba6

Browse files
authored
Release 1.177.0
See release notes.
2 parents 32b0e70 + 0dc7268 commit e658ba6

File tree

273 files changed

+13684
-5557
lines changed

Some content is hidden

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

273 files changed

+13684
-5557
lines changed

.docker/nautilus_trader.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN (cd nautilus_core && cargo build --release)
3434

3535
COPY nautilus_trader ./nautilus_trader
3636
COPY README.md ./
37-
RUN poetry install --only main
37+
RUN poetry install --only main --all-extras
3838
RUN poetry build -f wheel
3939
RUN python -m pip install ./dist/*whl --force
4040
RUN find /usr/local/lib/python3.11/site-packages -name "*.pyc" -exec rm -f {} \;

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
fail-fast: false
191191
matrix:
192192
arch: [x64]
193-
os: [ubuntu-20.04, ubuntu-latest, macos-latest, macos-13, windows-latest]
193+
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
194194
python-version: ["3.9", "3.10", "3.11"]
195195
name: publish-wheels - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
196196
runs-on: ${{ matrix.os }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.obj
88
*.lib
99
*.log
10+
*.patch
1011
*.prof
1112
*.rdb
1213
*.xml
@@ -35,6 +36,7 @@ dist/
3536
env/
3637
log/
3738
logs/
39+
secrets/
3840
*temp/
3941
*target/
4042
venv*/
@@ -50,5 +52,6 @@ examples/backtest/notebooks/catalog
5052
nautilus_trader/**/.gitignore
5153
nautilus_trader/test_kit/mocks/.nautilus/
5254
tests/test_data/catalog/
55+
bench_data/
5356

5457
!tests/integration_tests/adapters/betfair/responses/*.log

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
types_or: [python, cython, rust]
1313
- id: trailing-whitespace
14-
types_or: [python, cython]
14+
types_or: [rust, cython, python]
1515
- id: debug-statements
1616
- id: detect-private-key
1717
- id: check-builtin-literals
@@ -60,7 +60,7 @@ repos:
6060
# Python/Cython formatting and linting
6161
##############################################################################
6262
- repo: https://github.com/asottile/add-trailing-comma
63-
rev: v3.0.0
63+
rev: v3.0.1
6464
hooks:
6565
- id: add-trailing-comma
6666
name: add-trailing-comma
@@ -76,7 +76,7 @@ repos:
7676
exclude: "docs/_pygments/monokai.py"
7777

7878
- repo: https://github.com/astral-sh/ruff-pre-commit
79-
rev: v0.0.280
79+
rev: v0.0.285
8080
hooks:
8181
- id: ruff
8282
args: ["--fix"]
@@ -105,7 +105,7 @@ repos:
105105
]
106106

107107
- repo: https://github.com/pre-commit/mirrors-mypy
108-
rev: v1.4.1
108+
rev: v1.5.1
109109
hooks:
110110
- id: mypy
111111
args: [

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ format:
4545
(cd nautilus_core && cargo +nightly fmt)
4646

4747
.PHONY: pre-commit
48-
pre-commit: format
48+
pre-commit:
4949
pre-commit run --all-files
5050

51+
.PHONY: pre-flight
52+
pre-flight: format pre-commit cargo-test build-debug pytest
53+
5154
.PHONY: ruff
5255
ruff:
5356
ruff check . --fix

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
| Platform | Rust | Python |
1717
| :----------------- | :------ | :----- |
18-
| `Linux (x86_64)` | 1.71.0+ | 3.9+ |
19-
| `macOS (x86_64)` | 1.71.0+ | 3.9+ |
20-
| `macOS (arm64)` | 1.71.0+ | 3.9+ |
21-
| `Windows (x86_64)` | 1.71.0+ | 3.9+ |
18+
| `Linux (x86_64)` | 1.71.1+ | 3.9+ |
19+
| `macOS (x86_64)` | 1.71.1+ | 3.9+ |
20+
| `macOS (arm64)` | 1.71.1+ | 3.9+ |
21+
| `Windows (x86_64)` | 1.71.1+ | 3.9+ |
2222

2323
- **Website:** https://nautilustrader.io
2424
- **Docs:** https://docs.nautilustrader.io
@@ -233,6 +233,7 @@ A `Makefile` is provided to automate most installation and build tasks for devel
233233
- `make clean` -- **CAUTION** Cleans all non-source artifacts from the repository
234234
- `make docs` -- Builds the documentation HTML using Sphinx
235235
- `make pre-commit` -- Runs the pre-commit checks over all files
236+
- `make pre-flight` -- Runs pre-commit, makes a clean debug build and runs all tests (except performance tests)
236237
- `make ruff` -- Runs ruff over all files using the `pyproject.toml` config
237238
- `make pytest` -- Runs all tests with `pytest` (except performance tests)
238239
- `make pytest-coverage` -- Same as `make pytest` and additionally runs with test coverage and produces a report

RELEASES.md

+49-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# NautilusTrader 1.177.0 Beta
2+
3+
Released on 26th August 2023 (UTC).
4+
5+
This release includes a large breaking change to quote tick bid and ask price property and
6+
parameter naming. This was done in the interest of maintaining our generally explicit naming
7+
standards, and has caused confusion for some users in the past. Data using 'bid' and 'ask' columns should
8+
still work with the legacy data wranglers, as columns are renamed under the hood to accommodate
9+
this change.
10+
11+
### Enhancements
12+
- Added `ActorExecutor` with `Actor` API for creating and running threaded tasks in live environments
13+
- Added `OrderEmulated` event and associated `OrderStatus.EMULATED` enum variant
14+
- Added `OrderReleased` event and associated `OrderStatus.RELEASED` enum variant
15+
- Added `BacktestVenueConfig.use_position_ids` option (default true to retain current behavior)
16+
- Added `Cache.exec_spawn_total_quantity(...)` convenience method
17+
- Added `Cache.exec_spawn_total_filled_qty(...)` convenience method
18+
- Added `Cache.exec_spawn_total_leaves_qty(...)` convenience method
19+
- Added `WebSocketClient.send_text`, thanks @twitu
20+
- Implemented string interning for `TimeEvent`
21+
22+
### Breaking Changes
23+
- Renamed `QuoteTick.bid` to `bid_price` including all associated parameters (for explicit naming standards)
24+
- Renamed `QuoteTick.ask` to `ask_price` including all associated parameters (for explicit naming standards)
25+
26+
### Fixes
27+
- Fixed execution algorithm `position_id` assignment in `HEDGING` mode
28+
- Fixed `OrderMatchingEngine` processing of emulated orders
29+
- Fixed `OrderEmulator` processing of exec algorithm orders
30+
- Fixed `ExecutionEngine` processing of exec algorithm orders (exec spawn IDs)
31+
- Fixed `Cache` emulated order indexing (were not being properly discarded from the set when closed)
32+
- Fixed `RedisCacheDatabase` loading of transformed `LIMIT` orders
33+
- Fixed a connection issue with the IB client, thanks @dkharrat and @rsmb7z
34+
35+
---
36+
137
# NautilusTrader 1.176.0 Beta
238

339
Released on 31st July 2023 (UTC).
@@ -16,7 +52,7 @@ Released on 31st July 2023 (UTC).
1652
- Added `BinanceExecClientConfig.use_reduce_only` option (default true to retain current behavior)
1753
- Added `BinanceExecClientConfig.use_position_ids` option (default true to retain current behavior)
1854
- Added `BinanceExecClientConfig.treat_expired_as_canceled` option (default false to retain current behavior)
19-
- Added `BacktestVenueConfig.use_reduct_only` option (default true to retain current behaviour)
55+
- Added `BacktestVenueConfig.use_reduce_only` option (default true to retain current behavior)
2056
- Added `MessageBus.is_pending_request(...)` method
2157
- Added `Level` API for core `OrderBook` (exposes the bid and ask levels for the order book)
2258
- Added `Actor.is_pending_request(...)` convenience method
@@ -53,7 +89,7 @@ Released on 31st July 2023 (UTC).
5389
- Fixed Binance commission rates requests for `InstrumentProvider`
5490
- Fixed Binance `TriggerType` parsing #1154, thanks for reporting @davidblom603
5591
- Fixed Binance order parsing of invalid orders in execution reports #1157, thanks for reporting @graceyangfan
56-
- Fixed `BinanceOrderType` members to include undocumented `INSURANCE_FUND`, thanks for reporting @Tzumx
92+
- Extended `BinanceOrderType` enum members to include undocumented `INSURANCE_FUND`, thanks for reporting @Tzumx
5793
- Extended `BinanceSpotPermissions` enum members #1161, thanks for reporting @davidblom603
5894

5995
---
@@ -74,7 +110,7 @@ We recommend you do not upgrade to this version if you're using the Betfair adap
74110
- Added core Rust `SocketClient` based on `tokio` `TcpStream`, thanks @twitu
75111
- Added `quote_quantity` parameter to determine if order quantity is denominated in quote currency
76112
- Added `trigger_instrument_id` parameter to trigger emulated orders from alternative instrument prices
77-
- Added `use_random_ids` to `add_venue(...)` method, controls whether venue order, position and trade IDs will be random UUID4s (no change to current behaviour)
113+
- Added `use_random_ids` to `add_venue(...)` method, controls whether venue order, position and trade IDs will be random UUID4s (no change to current behavior)
78114
- Added `ExecEngineConfig.filter_unclaimed_external_orders` options, if unclaimed order events with an `EXTERNAL` strategy ID should be filtered/dropped
79115
- Changed `BinanceHttpClient` to use new core HTTP client
80116
- Defined public API for data, can now import directly from `nautilus_trader.model.data` (denest namespace)
@@ -442,7 +478,7 @@ Released on 12th December 2022 (UTC).
442478

443479
### Fixes
444480
- Fixed `OrderBook` sorting for bid side, thanks @gaugau3000
445-
- Fixed `MARKET_TO_LIMIT` order initial fill behaviour
481+
- Fixed `MARKET_TO_LIMIT` order initial fill behavior
446482
- Fixed `BollingerBands` indicator mid-band calculations, thanks zhp (Discord)
447483

448484
---
@@ -640,10 +676,10 @@ Released on September 14th 2022 (UTC).
640676
- De-cythonized live data and execution client base classes for usability
641677

642678
### Fixes
643-
- Fixed limit order `IOC` and `FOK` behaviour, thanks @limx0 for identifying
679+
- Fixed limit order `IOC` and `FOK` behavior, thanks @limx0 for identifying
644680
- Fixed FTX `CryptoFuture` instrument parsing, thanks @limx0
645681
- Fixed missing imports in data catalog example notebook, thanks @gaugau3000
646-
- Fixed order update behaviour, affected orders:
682+
- Fixed order update behavior, affected orders:
647683
- `LIMIT_IF_TOUCHED`
648684
- `MARKET_IF_TOUCHED`
649685
- `MARKET_TO_LIMIT`
@@ -808,7 +844,7 @@ None
808844

809845
### Enhancements
810846
- Improved error handling for invalid state triggers
811-
- Improved component state transition behaviour and logging
847+
- Improved component state transition behavior and logging
812848
- Improved `TradingNode` disposal flow
813849
- Implemented core monotonic clock
814850
- Implemented logging in Rust
@@ -882,7 +918,7 @@ Released on 10th May 2022 (UTC).
882918
- The `bypass_logging` config option will also now bypass the `BacktestEngine` logger
883919

884920
### Fixes
885-
- Fixed behaviour of `IOC` and `FOK` time in force instructions
921+
- Fixed behavior of `IOC` and `FOK` time in force instructions
886922
- Fixed Binance bar resolution parsing
887923

888924
---
@@ -2159,7 +2195,7 @@ symbol string, a primary `Venue`, `AssetClass` and `AssetType` properties.
21592195

21602196
This is a patch release which applies various fixes and refactorings.
21612197

2162-
The behaviour of the `StopLimitOrder` continued to be fixed and refined.
2198+
The behavior of the `StopLimitOrder` continued to be fixed and refined.
21632199
`SimulatedExchange` was refactored further to reduce complexity.
21642200

21652201
### Breaking Changes
@@ -2170,7 +2206,7 @@ None
21702206

21712207
### Fixes
21722208
- `TRIGGERED` states in order FSM
2173-
- `StopLimitOrder` triggering behaviour
2209+
- `StopLimitOrder` triggering behavior
21742210
- `OrderFactory.stop_limit` missing `post_only` and `hidden`
21752211
- `Order` and `StopLimitOrder` `__repr__` string (duplicate id)
21762212

@@ -2181,10 +2217,10 @@ None
21812217
## Release Notes
21822218

21832219
The main thrust of this release is to refine some subtleties relating to order
2184-
matching and amendment behaviour for improved realism. This involved a fairly substantial refactoring
2220+
matching and amendment behavior for improved realism. This involved a fairly substantial refactoring
21852221
of `SimulatedExchange` to manage its complexity, and support extending the order types.
21862222

2187-
The `post_only` flag for LIMIT orders now results in the expected behaviour regarding
2223+
The `post_only` flag for LIMIT orders now results in the expected behavior regarding
21882224
when a marketable limit order will become a liquidity `TAKER` during order placement
21892225
and amendment.
21902226

@@ -2198,7 +2234,7 @@ None
21982234
- Add `risk` subpackage to group risk components
21992235

22002236
### Fixes
2201-
- `StopLimitOrder` triggering behaviour
2237+
- `StopLimitOrder` triggering behavior
22022238
- All flake8 warnings
22032239

22042240
---

docs/api_reference/common.md

+10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
:member-order: bysource
3333
```
3434

35+
## Executor
36+
37+
```{eval-rst}
38+
.. automodule:: nautilus_trader.common.executor
39+
:show-inheritance:
40+
:inherited-members:
41+
:members:
42+
:member-order: bysource
43+
```
44+
3545
```{eval-rst}
3646
.. automodule:: nautilus_trader.common.factories
3747
:show-inheritance:

docs/api_reference/execution.md

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
:member-order: bysource
3939
```
4040

41+
```{eval-rst}
42+
.. automodule:: nautilus_trader.execution.manager
43+
:show-inheritance:
44+
:inherited-members:
45+
:members:
46+
:member-order: bysource
47+
```
48+
4149
```{eval-rst}
4250
.. automodule:: nautilus_trader.execution.matching_core
4351
:show-inheritance:

docs/concepts/execution.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,15 @@ cpdef list orders_for_exec_algorithm(
278278
As well as more specifically querying the orders for a certain execution series/spawn:
279279

280280
```python
281-
cpdef list orders_for_exec_spawn(self, ClientOrderId client_order_id):
281+
cpdef list orders_for_exec_spawn(self, ClientOrderId exec_spawn_id):
282282
"""
283283
Return all orders for the given execution spawn ID (if found).
284284
285285
Will also include the primary (original) order.
286286
287287
Parameters
288288
----------
289-
client_order_id : ClientOrderId
289+
exec_spawn_id : ClientOrderId
290290
The execution algorithm spawning primary (original) client order ID.
291291
292292
Returns

docs/concepts/orders.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ important for market makers, or traders seeking to restrict the order to a liqui
6363

6464
### Reduce Only
6565
An order which is set as `reduce_only` will only ever reduce an existing position on an instrument, and
66-
never open a new position (if already flat). The exact behaviour of this instruction can vary between
67-
exchanges, however the behaviour as per the Nautilus `SimulatedExchange` is typical of a live exchange.
66+
never open a new position (if already flat). The exact behavior of this instruction can vary between
67+
exchanges, however the behavior as per the Nautilus `SimulatedExchange` is typical of a live exchange.
6868

69-
- Order will be cancelled if the associated position is closed (becomes flat)
69+
- Order will be canceled if the associated position is closed (becomes flat)
7070
- Order quantity will be reduced as the associated positions size reduces
7171

7272
### Display Quantity

docs/developer_guide/rust.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ their own standard libraries.
2323

2424
Great care will be taken with the use of Rusts `unsafe` facility - which just enables a small set of additional language features, thereby changing
2525
the contract between the interface and caller, shifting some responsibility for guaranteeing correctness
26-
from the Rust compiler, and onto us. The goal is to realize the advantages of the `unsafe` facility, whilst avoiding _any_ undefined behaviour.
27-
The definition for what the Rust language designers consider undefined behaviour can be found in the [language reference](https://doc.rust-lang.org/stable/reference/behavior-considered-undefined.html).
26+
from the Rust compiler, and onto us. The goal is to realize the advantages of the `unsafe` facility, whilst avoiding _any_ undefined behavior.
27+
The definition for what the Rust language designers consider undefined behavior can be found in the [language reference](https://doc.rust-lang.org/stable/reference/behavior-considered-undefined.html).
2828

2929
## Safety Policy
3030
To maintain the high standards of correctness the project strives for, it's necessary to specify a reasonable policy

docs/getting_started/quick_start.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ deleted when the container is deleted.
1414
- To get started, install docker:
1515
- Go to [docker.com](https://docs.docker.com/get-docker/) and follow the instructions
1616
- From a terminal, download the latest image
17-
- `docker pull ghcr.io/nautechsystems/jupyterlab:develop`
17+
- `docker pull ghcr.io/nautechsystems/jupyterlab:develop --platform linux/amd64`
1818
- Run the docker container, exposing the jupyter port:
1919
- `docker run -p 8888:8888 ghcr.io/nautechsystems/jupyterlab:develop`
2020
- Open your web browser to `localhost:{port}`
@@ -196,7 +196,7 @@ venue = BacktestVenueConfig(
196196
oms_type="NETTING",
197197
account_type="MARGIN",
198198
base_currency="USD",
199-
starting_balances=["1_000_000 USD"]
199+
starting_balances=["1_000_000 USD"],
200200
)
201201
```
202202

docs/guides/backtest_example.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def parser(line):
7474
dt = pd.Timestamp(datetime.datetime.strptime(ts.decode(), "%Y%m%d %H%M%S%f"), tz='UTC')
7575
yield QuoteTick(
7676
instrument_id=AUDUSD.id,
77-
bid=Price.from_str(bid.decode()),
78-
ask=Price.from_str(ask.decode()),
77+
bid_price=Price.from_str(bid.decode()),
78+
ask_price=Price.from_str(ask.decode()),
7979
bid_size=Quantity.from_int(100_000),
8080
ask_size=Quantity.from_int(100_000),
8181
ts_event=dt_to_unix_nanos(dt),

docs/guides/loading_external_data.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def parser(data, instrument_id):
6666
dt = pd.Timestamp(datetime.datetime.strptime(data['timestamp'].decode(), "%Y%m%d %H%M%S%f"), tz='UTC')
6767
yield QuoteTick(
6868
instrument_id=instrument_id,
69-
bid=Price.from_str(data['bid'].decode()),
70-
ask=Price.from_str(data['ask'].decode()),
69+
bid_price=Price.from_str(data["bid_price"].decode()),
70+
ask_price=Price.from_str(data["ask_price"].decode()),
7171
bid_size=Quantity.from_int(100_000),
7272
ask_size=Quantity.from_int(100_000),
7373
ts_event=dt_to_unix_nanos(dt),
@@ -158,7 +158,7 @@ process_files(
158158
glob_path=input_files,
159159
reader=CSVReader(
160160
block_parser=lambda x: parser(x, instrument_id=instrument.id),
161-
header=['timestamp', 'bid', 'ask', 'volume'],
161+
header=["timestamp", "bid", "ask", "volume"],
162162
chunked=False,
163163
as_dataframe=False,
164164
),

0 commit comments

Comments
 (0)