Skip to content

Commit 3db0827

Browse files
authored
Release 1.192.0
See release notes.
2 parents 0eb0b56 + 380169c commit 3db0827

File tree

465 files changed

+18890
-7423
lines changed

Some content is hidden

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

465 files changed

+18890
-7423
lines changed

.docker/docker-compose.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: '3.5'
2+
3+
services:
4+
postgres:
5+
container_name: nautilus-database
6+
image: postgres
7+
environment:
8+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
9+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pass}
10+
POSTGRES_DATABASE: nautilus
11+
PGDATA: /data/postgres
12+
volumes:
13+
- nautilus-database:/data/postgres
14+
ports:
15+
- "5432:5432"
16+
networks:
17+
- nautilus-network
18+
restart: unless-stopped
19+
20+
pgadmin:
21+
container_name: nautilus-pgadmin
22+
image: dpage/pgadmin4
23+
environment:
24+
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@mail.com}
25+
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
26+
volumes:
27+
- pgadmin:/root/.pgadmin
28+
ports:
29+
- "${PGADMIN_PORT:-5051}:80"
30+
networks:
31+
- nautilus-network
32+
restart: unless-stopped
33+
34+
redis:
35+
container_name: nautilus-redis
36+
image: redis
37+
ports:
38+
- 6379:6379
39+
restart: unless-stopped
40+
networks:
41+
- nautilus-network
42+
43+
networks:
44+
nautilus-network:
45+
46+
volumes:
47+
nautilus-database:
48+
pgadmin:

.docker/nautilus_trader.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ENV PYTHONUNBUFFERED=1 \
44
PIP_NO_CACHE_DIR=off \
55
PIP_DISABLE_PIP_VERSION_CHECK=on \
66
PIP_DEFAULT_TIMEOUT=100 \
7-
POETRY_VERSION=1.8.2 \
7+
POETRY_VERSION=1.8.3 \
88
POETRY_HOME="/opt/poetry" \
99
POETRY_VIRTUALENVS_CREATE=false \
1010
POETRY_NO_INTERACTION=1 \

.github/workflows/build.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ jobs:
2222
env:
2323
BUILD_MODE: debug
2424
RUST_BACKTRACE: 1
25+
services:
26+
redis:
27+
image: redis
28+
ports:
29+
- 6379:6379
30+
options: >-
31+
--health-cmd "redis-cli ping"
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
postgres:
36+
image: postgres
37+
env:
38+
POSTGRES_USER: postgres
39+
POSTGRES_PASSWORD: pass
40+
POSTGRES_DB: nautilus
41+
ports:
42+
- 5432:5432
43+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2544

2645
steps:
2746
- name: Free disk space (Ubuntu)
@@ -105,10 +124,16 @@ jobs:
105124
# pre-commit run --hook-stage manual gitlint-ci
106125
pre-commit run --all-files
107126
108-
- name: Install Redis (Linux)
127+
- name: Install Nautilus CLI and run init postgres
109128
run: |
110-
sudo apt-get install redis-server
111-
redis-server --daemonize yes
129+
make install-cli
130+
nautilus database init --schema ${{ github.workspace }}/schema
131+
env:
132+
POSTGRES_HOST: localhost
133+
POSTGRES_PORT: 5432
134+
POSTGRES_USERNAME: postgres
135+
POSTGRES_PASSWORD: pass
136+
POSTGRES_DATABASE: nautilus
112137

113138
- name: Run nautilus_core cargo tests (Linux)
114139
run: |
@@ -209,7 +234,8 @@ jobs:
209234
PARALLEL_BUILD: false
210235

211236
build-macos:
212-
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/nightly'
237+
if: github.ref == 'refs/heads/master'
238+
# if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/nightly'
213239
strategy:
214240
fail-fast: false
215241
matrix:
@@ -290,11 +316,6 @@ jobs:
290316
# pre-commit run --hook-stage manual gitlint-ci
291317
pre-commit run --all-files
292318
293-
- name: Install Redis (macOS)
294-
run: |
295-
brew install redis
296-
redis-server --daemonize yes
297-
298319
- name: Run nautilus_core cargo tests (macOS)
299320
run: |
300321
cargo install cargo-nextest

.github/workflows/coverage.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@ jobs:
1414
python-version: ["3.10"] # Fails on 3.11 due Cython
1515
name: build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
1616
runs-on: ${{ matrix.os }}
17+
services:
18+
redis:
19+
image: redis
20+
ports:
21+
- 6379:6379
22+
options: >-
23+
--health-cmd "redis-cli ping"
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
postgres:
28+
image: postgres
29+
env:
30+
POSTGRES_USER: postgres
31+
POSTGRES_PASSWORD: pass
32+
POSTGRES_DB: nautilus
33+
ports:
34+
- 5432:5432
35+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
1736

1837
steps:
1938
- name: Free disk space (Ubuntu)
@@ -90,10 +109,16 @@ jobs:
90109
path: ${{ env.POETRY_CACHE_DIR }}
91110
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
92111

93-
- name: Install Redis
112+
- name: Install Nautilus CLI and run init postgres
94113
run: |
95-
sudo apt-get install redis-server
96-
redis-server --daemonize yes
114+
make install-cli
115+
nautilus database init --schema ${{ github.workspace }}/schema
116+
env:
117+
POSTGRES_HOST: localhost
118+
POSTGRES_PORT: 5432
119+
POSTGRES_USERNAME: postgres
120+
POSTGRES_PASSWORD: pass
121+
POSTGRES_DATABASE: nautilus
97122

98123
- name: Run tests with coverage
99124
run: make pytest-coverage

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ jobs:
3535
uses: docker/setup-buildx-action@v3
3636

3737
- name: Login to GHCR
38-
uses: docker/login-action@v3
38+
uses: docker/login-action@v3.1.0
3939
with:
4040
registry: ghcr.io
4141
username: ${{ github.repository_owner }}
4242
password: ${{ secrets.PACKAGES_TOKEN }}
4343

4444
- name: Get branch name
4545
id: branch-name
46-
uses: tj-actions/branch-names@v7.0.7
46+
uses: tj-actions/branch-names@v8.0.1
4747

4848
- name: Build nautilus_trader image (nightly)
4949
if: ${{ steps.branch-name.outputs.current_branch == 'nightly' }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*.env
1818
*.tar.gz*
1919
*.zip
20+
*.iml
2021

2122
*.dbz
2223
*.dbn

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ repos:
7373
types: [python]
7474

7575
- repo: https://github.com/psf/black
76-
rev: 24.4.0
76+
rev: 24.4.2
7777
hooks:
7878
- id: black
7979
types_or: [python, pyi]
@@ -82,7 +82,7 @@ repos:
8282
exclude: "docs/_pygments/monokai.py"
8383

8484
- repo: https://github.com/astral-sh/ruff-pre-commit
85-
rev: v0.3.7
85+
rev: v0.4.4
8686
hooks:
8787
- id: ruff
8888
args: ["--fix"]
@@ -111,7 +111,7 @@ repos:
111111
]
112112

113113
- repo: https://github.com/pre-commit/mirrors-mypy
114-
rev: v1.9.0
114+
rev: v1.10.0
115115
hooks:
116116
- id: mypy
117117
args: [

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ docs-python: install-just-deps-all
7070

7171
.PHONY: docs-rust
7272
docs-rust:
73-
(cd nautilus_core && RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --no-deps)
73+
(cd nautilus_core && RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all-features --no-deps --workspace --exclude tokio-tungstenite)
7474

7575
.PHONY: clippy
7676
clippy:
@@ -137,6 +137,14 @@ docker-build-jupyter:
137137
docker-push-jupyter:
138138
docker push ${IMAGE}:jupyter
139139

140+
.PHONY: start-services
141+
start-services:
142+
docker-compose -f .docker/docker-compose.yml up -d
143+
144+
.PHONY: stop-services
145+
stop-services:
146+
docker-compose -f .docker/docker-compose.yml down
147+
140148
.PHONY: pytest
141149
pytest:
142150
bash scripts/test.sh
@@ -153,11 +161,6 @@ test-examples:
153161
install-talib:
154162
bash scripts/install-talib.sh
155163

156-
.PHONY: init-db
157-
init-db:
158-
(cd nautilus_core && cargo run --bin init-db)
159-
160-
.PHONY: drop-db
161-
drop-db:
162-
(cd nautilus_core && cargo run --bin drop-db)
163-
164+
.PHONY: install-cli
165+
install-cli:
166+
(cd nautilus_core && cargo install --path cli --bin nautilus)

README.md

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
| Platform | Rust | Python |
1717
| :----------------- | :------ | :----- |
18-
| `Linux (x86_64)` | 1.77.1+ | 3.10+ |
19-
| `macOS (x86_64)` | 1.77.1+ | 3.10+ |
20-
| `macOS (arm64)` | 1.77.1+ | 3.10+ |
21-
| `Windows (x86_64)` | 1.77.1+ | 3.10+ |
18+
| `Linux (x86_64)` | 1.78.0+ | 3.10+ |
19+
| `macOS (x86_64)` | 1.78.0+ | 3.10+ |
20+
| `macOS (arm64)` | 1.78.0+ | 3.10+ |
21+
| `Windows (x86_64)` | 1.78.0+ | 3.10+ |
2222

2323
- **Website:** https://nautilustrader.io
2424
- **Docs:** https://docs.nautilustrader.io
@@ -44,8 +44,8 @@ including FX, Equities, Futures, Options, CFDs, Crypto and Betting - across mult
4444

4545
## Features
4646

47-
- **Fast** - C-level speed through Rust and Cython. Asynchronous networking with [uvloop](https://github.com/MagicStack/uvloop)
48-
- **Reliable** - Type safety through Rust and Cython. Redis backed performant state persistence
47+
- **Fast** - Core written in Rust with asynchronous networking using [tokio](https://crates.io/crates/tokio)
48+
- **Reliable** - Type safety and thread safety through Rust. Redis backed performant state persistence
4949
- **Portable** - OS independent, runs on Linux, macOS, Windows. Deploy using Docker
5050
- **Flexible** - Modular adapters mean any REST, WebSocket, or FIX API can be integrated
5151
- **Advanced** - Time in force `IOC`, `FOK`, `GTD`, `AT_THE_OPEN`, `AT_THE_CLOSE`, advanced order types and conditional triggers. Execution instructions `post-only`, `reduce-only`, and icebergs. Contingency order lists including `OCO`, `OTO`
@@ -76,7 +76,8 @@ express the granular time and event dependent complexity of real-time trading, w
7676
proven to be more suitable due to their inherently higher performance, and type safety.
7777

7878
One of the key advantages of NautilusTrader here, is that this reimplementation step is now circumvented - as the critical core components of the platform
79-
have all been written entirely in Rust or Cython. This means we're using the right tools for the job, where systems programming languages compile performant binaries,
79+
have all been written entirely in [Rust](https://www.rust-lang.org/) or [Cython](https://cython.org/).
80+
This means we're using the right tools for the job, where systems programming languages compile performant binaries,
8081
with CPython C extension modules then able to offer a Python native environment, suitable for professional quantitative traders and trading firms.
8182

8283
## Why Python?
@@ -91,16 +92,6 @@ implementing large performance-critical systems. Cython has addressed a lot of t
9192
of a statically typed language, embedded into Pythons rich ecosystem of software libraries and
9293
developer/user communities.
9394

94-
## What is Cython?
95-
96-
[Cython](https://cython.org) is a compiled programming language which aims to be a superset of the Python programming
97-
language, designed to give C-like performance with code that is written in Python - with
98-
optional C-inspired syntax.
99-
100-
The project heavily utilizes Cython to provide static type safety and increased performance
101-
for Python through [C extension modules](https://docs.python.org/3/extending/extending.html). The vast majority of the production code is actually
102-
written in Cython, however the libraries can be accessed from both Python and Cython.
103-
10495
## What is Rust?
10596

10697
[Rust](https://www.rust-lang.org/) is a multi-paradigm programming language designed for performance and safety, especially safe
@@ -111,9 +102,8 @@ Rust’s rich type system and ownership model guarantees memory-safety and threa
111102
eliminating many classes of bugs at compile-time.
112103

113104
The project increasingly utilizes Rust for core performance-critical components. Python language binding is handled through
114-
Cython, with static libraries linked at compile-time before the wheel binaries are packaged, so a user
115-
does not need to have Rust installed to run NautilusTrader. In the future as more Rust code is introduced,
116-
[PyO3](https://pyo3.rs/latest) will be leveraged for easier Python bindings.
105+
Cython and [PyO3](https://pyo3.rs/latest), with static libraries linked at compile-time before the wheel binaries are packaged, so a user
106+
does not need to have Rust installed to run NautilusTrader.
117107

118108
This project makes the [Soundness Pledge](https://raphlinus.github.io/rust/2020/01/18/soundness-pledge.html):
119109

@@ -124,15 +114,6 @@ This project makes the [Soundness Pledge](https://raphlinus.github.io/rust/2020/
124114

125115
![Architecture](https://github.com/nautechsystems/nautilus_trader/blob/develop/docs/_images/architecture-overview.png?raw=true "architecture")
126116

127-
## Quality Attributes
128-
129-
- Reliability
130-
- Performance
131-
- Modularity
132-
- Testability
133-
- Maintainability
134-
- Deployability
135-
136117
## Integrations
137118

138119
NautilusTrader is designed in a modular way to work with _adapters_ which provide
@@ -238,8 +219,8 @@ A `Makefile` is provided to automate most installation and build tasks for devel
238219
- `make install-debug` -- Same as `make install` but with `debug` build mode
239220
- `make install-just-deps` -- Installs just the `main`, `dev` and `test` dependencies (does not install package)
240221
- `make install-just-deps-all` -- Same as `make install-just-deps` and additionally installs `docs` dependencies
241-
- `make build` -- Runs the Cython build script in `release` build mode (default)
242-
- `make build-debug` -- Runs the Cython build script in `debug` build mode
222+
- `make build` -- Runs the build script in `release` build mode (default)
223+
- `make build-debug` -- Runs the build script in `debug` build mode
243224
- `make build-wheel` -- Runs the Poetry build with a wheel format in `release` mode
244225
- `make build-wheel-debug` -- Runs the Poetry build with a wheel format in `debug` mode
245226
- `make clean` -- **CAUTION** Cleans all non-source artifacts from the repository

RELEASES.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# NautilusTrader 1.192.0 Beta
2+
3+
Released on 18th May 2024 (UTC).
4+
5+
### Enhancements
6+
- Added Nautilus CLI (see [docs](https://docs.nautilustrader.io/nightly/developer_guide/index.html)) (#1602), many thanks @filipmacek
7+
- Added `Cfd` and `Commodity` instruments with Interactive Brokers support (#1604), thanks @DracheShiki
8+
- Added `OrderMatchingEngine` futures and options contract activation and expiration simulation
9+
- Added Sandbox example with Interactive Brokers (#1618), thanks @rsmb7z
10+
- Added `ParquetDataCatalog` S3 support (#1620), thanks @benjaminsingleton
11+
- Added `Bar.from_raw_arrays_to_list` (#1623), thanks @rsmb7z
12+
- Added `SandboxExecutionClientConfig.bar_execution` option (#1646), thanks @davidsblom
13+
- Improved venue order ID generation and assignment (it was previously possible for the `OrderMatchingEngine` to generate multiple IDs for the same order)
14+
- Improved `LiveTimer` robustness and flexibility by not requiring positive intervals or stop times in the future (will immediately produce a time event), thanks for reporting @davidsblom
15+
16+
### Breaking Changes
17+
- Removed `allow_cash_positions` config (simplify to the most common use case, spot trading should track positions)
18+
- Changed `tags` param and return type from `str` to `list[str]` (more naturally expresses multiple tags)
19+
- Changed `Order.to_dict()` `commission` and `linked_order_id` fields to lists of strings rather than comma separated strings
20+
- Changed `OrderMatchingEngine` to no longer process internally aggregated bars for execution (no tests failed, but still classifying as a behavior change), thanks for reporting @davidsblom
21+
22+
### Fixes
23+
- Fixed `CashAccount` PnL and balance calculations (was adjusting filled quantity based on open position quantity - causing a desync and incorrect balance values)
24+
- Fixed `from_str` for `Price`, `Quantity` and `Money` when input string contains underscores in Rust, thanks for reporting @filipmacek
25+
- Fixed `Money` string parsing where the value from `str(money)` can now be passed to `Money.from_str`
26+
- Fixed `TimeEvent` equality (now based on the event `id` rather than the event `name`)
27+
- Fixed `ParquetDataCatalog` bar queries by `instrument_id` which were no longer returning data (the intent is to use `bar_type`, however using `instrument_id` now returns all matching bars)
28+
- Fixed venue order ID generation and application in sandbox mode (was previously generating additional venue order IDs), thanks for reporting @rsmb7z and @davidsblom
29+
- Fixed multiple fills causing overfills in sandbox mode (`OrderMatchingEngine` now caching filled quantity to prevent this) (#1642), thanks @davidsblom
30+
- Fixed `leaves_qty` exception message underflow (now correctly displays the projected negative leaves quantity)
31+
- Fixed Interactive Brokers contract details parsing (#1615), thanks @rsmb7z
32+
- Fixed Interactive Brokers portfolio registration (#1616), thanks @rsmb7z
33+
- Fixed Interactive Brokers `IBOrder` attributes assignment (#1634), thanks @rsmb7z
34+
- Fixed IBKR reconnection after gateway/TWS disconnection (#1622), thanks @benjaminsingleton
35+
- Fixed Binance Futures account balance calculation (was over stating `free` balance with margin collateral, which could result in a negative `locked` balance)
36+
- Fixed Betfair stream reconnection and avoid multiple reconnect attempts (#1644), thanks @imemo88
37+
38+
---
39+
140
# NautilusTrader 1.191.0 Beta
241

342
Released on 20th April 2024 (UTC).

0 commit comments

Comments
 (0)