Skip to content

Commit

Permalink
Release 1.191.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Apr 20, 2024
2 parents 5f31d43 + 0b0d031 commit 0eb0b56
Show file tree
Hide file tree
Showing 598 changed files with 21,417 additions and 10,732 deletions.
107 changes: 95 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
arch: [x64]
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
defaults:
run:
Expand All @@ -25,7 +25,6 @@ jobs:

steps:
- name: Free disk space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
Expand All @@ -37,7 +36,6 @@ jobs:
swap-storage: true

- name: Install runner dependencies
if: runner.os == 'Linux'
run: sudo apt-get install -y curl clang git libssl-dev make pkg-config

- name: Checkout repository
Expand All @@ -62,6 +60,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get Python version
run: |
version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))")
echo "PYTHON_VERSION=$version" >> $GITHUB_ENV
- name: Get Poetry version from poetry-version
run: |
version=$(cat poetry-version)
Expand All @@ -76,7 +79,6 @@ jobs:
run: python -m pip install --upgrade pip setuptools wheel pre-commit msgspec

- name: Install TA-Lib (Linux)
if: runner.os == 'Linux'
run: |
make install-talib
poetry run pip install ta-lib
Expand All @@ -86,7 +88,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set poetry cache-dir
run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV
Expand All @@ -96,34 +98,110 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.POETRY_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Run pre-commit
run: |
# pre-commit run --hook-stage manual gitlint-ci
pre-commit run --all-files
- name: Install Redis (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install redis-server
redis-server --daemonize yes
- name: Run nautilus_core cargo tests (Linux)
if: runner.os == 'Linux'
run: |
cargo install cargo-nextest
make cargo-test
- name: Run tests (Linux)
if: runner.os == 'Linux'
run: |
make pytest
make test-examples
build-windows:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/nightly'
strategy:
fail-fast: false
matrix:
arch: [x64]
os: [windows-latest]
python-version: ["3.10", "3.11", "3.12"]
defaults:
run:
shell: bash
name: build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
BUILD_MODE: debug
RUST_BACKTRACE: 1

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get Rust version from rust-toolchain.toml
id: rust-version
run: |
version=$(awk -F\" '/version/ {print $2}' nautilus_core/rust-toolchain.toml)
echo "Rust toolchain version $version"
echo "RUST_VERSION=$version" >> $GITHUB_ENV
working-directory: ${{ github.workspace }}

- name: Set up Rust tool-chain (Linux, Windows) stable
uses: actions-rust-lang/[email protected]
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt, clippy

- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Get Python version
run: |
version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))")
echo "PYTHON_VERSION=$version" >> $GITHUB_ENV
- name: Get Poetry version from poetry-version
run: |
version=$(cat poetry-version)
echo "POETRY_VERSION=$version" >> $GITHUB_ENV
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}

- name: Install build dependencies
run: python -m pip install --upgrade pip setuptools wheel pre-commit msgspec

- name: Setup cached pre-commit
id: cached-pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set poetry cache-dir
run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV

- name: Poetry cache
id: cached-poetry
uses: actions/cache@v4
with:
path: ${{ env.POETRY_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Run pre-commit
run: |
# pre-commit run --hook-stage manual gitlint-ci
pre-commit run --all-files
# Run tests without parallel build (avoids linker errors)
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: |
poetry install --with test --all-extras
poetry run pytest --ignore=tests/performance_tests --new-first --failed-first
Expand Down Expand Up @@ -172,6 +250,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Get Python version
run: |
version=$(python -c "import sys; print('.'.join(map(str, sys.version_info[:3])))")
echo "PYTHON_VERSION=$version" >> $GITHUB_ENV
- name: Get Poetry version from poetry-version
run: |
version=$(cat poetry-version)
Expand All @@ -190,7 +273,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set poetry cache-dir
run: echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV
Expand All @@ -200,7 +283,7 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.POETRY_CACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Run pre-commit
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
*.tar.gz*
*.zip

*.dbz
*.dbn
*.dbn.zst
!/nautilus_core/adapters/src/databento/test_data/*

.benchmarks*
.coverage*
Expand Down Expand Up @@ -65,6 +67,7 @@ examples/backtest/notebooks/catalog
nautilus_trader/**/.gitignore
nautilus_trader/test_kit/mocks/.nautilus/
tests/test_data/catalog/
tests/unit_tests/catalog/
tests/unit_tests/persistence/catalog
bench_data/

Expand Down
10 changes: 4 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
# General checks
##############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: forbid-new-submodules
- id: fix-encoding-pragma
Expand Down Expand Up @@ -73,7 +73,7 @@ repos:
types: [python]

- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.4.0
hooks:
- id: black
types_or: [python, pyi]
Expand All @@ -82,7 +82,7 @@ repos:
exclude: "docs/_pygments/monokai.py"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.3.7
hooks:
- id: ruff
args: ["--fix"]
Expand Down Expand Up @@ -115,10 +115,8 @@ repos:
hooks:
- id: mypy
args: [
"--ignore-missing-imports",
"--config", "pyproject.toml",
"--allow-incomplete-defs",
"--no-strict-optional", # Fixing in progress
"--warn-no-return",
]
additional_dependencies: [
msgspec,
Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ docs-python: install-just-deps-all

.PHONY: docs-rust
docs-rust:
(cd nautilus_core && RUSTDOCFLAGS="--enable-index-page -Zunstable-options --deny warnings" cargo +nightly doc --no-deps)
(cd nautilus_core && RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --no-deps)

.PHONY: clippy
clippy:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

| Platform | Rust | Python |
| :----------------- | :------ | :----- |
| `Linux (x86_64)` | 1.77.0+ | 3.10+ |
| `macOS (x86_64)` | 1.77.0+ | 3.10+ |
| `macOS (arm64)` | 1.77.0+ | 3.10+ |
| `Windows (x86_64)` | 1.77.0+ | 3.10+ |
| `Linux (x86_64)` | 1.77.1+ | 3.10+ |
| `macOS (x86_64)` | 1.77.1+ | 3.10+ |
| `macOS (arm64)` | 1.77.1+ | 3.10+ |
| `Windows (x86_64)` | 1.77.1+ | 3.10+ |

- **Website:** https://nautilustrader.io
- **Docs:** https://docs.nautilustrader.io
Expand Down Expand Up @@ -145,7 +145,7 @@ into a unified interface. The following integrations are currently supported:
| [Binance](https://binance.com) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/binance.html) |
| [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) |
| [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) |
| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/building-orange) | |
| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/bybit.html) |
| [Databento](https://databento.com) | `DATABENTO` | Data Provider | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://docs.nautilustrader.io/integrations/databento.html) |
| [Interactive Brokers](https://www.interactivebrokers.com) | `INTERACTIVE_BROKERS` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://docs.nautilustrader.io/integrations/ib.html) |

Expand Down
45 changes: 45 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# NautilusTrader 1.191.0 Beta

Released on 20th April 2024 (UTC).

### Enhancements
- Implemented `FeeModel` including `FixedFeeModel` and `MakerTakerFeeModel` (#1584), thanks @rsmb7z
- Implemented `TradeTickDataWrangler.process_bar_data` (#1585), thanks @rsmb7z
- Implemented multiple timeframe bar execution (will use lowest timeframe per instrument)
- Optimized `LiveTimer` efficiency and accuracy with `tokio` timer under the hood
- Optimized `QuoteTickDataWrangler` and `TradeTickDataWrangler` (#1590), thanks @rsmb7z
- Standardized adapter client logging (handle more logging from client base classes)
- Simplified and consolidated Rust `OrderBook` design
- Improved `CacheDatabaseAdapter` graceful close and thread join
- Improved `MessageBus` graceful close and thread join
- Improved `modify_order` error logging when order values remain unchanged
- Added `RecordFlag` enum for Rust and Python
- Interactive Brokers further improvements and fixes, thanks @rsmb7z
- Ported Bias indicator to Rust, thanks @Pushkarm029

### Breaking Changes
- Reordered `OrderBookDelta` params `flags` and `sequence` and removed default 0 values (more explicit and less chance of mismatches)
- Reordered `OrderBook` params `flags` and `sequence` and removed default 0 values (more explicit and less chance of mismatches)
- Added `flags` parameter to `OrderBook.add`
- Added `flags` parameter to `OrderBook.update`
- Added `flags` parameter to `OrderBook.delete`
- Changed Arrow schema for all instruments: added `info` binary field
- Changed Arrow schema for `CryptoFuture`: added `is_inverse` boolean field
- Renamed both `OrderBookMbo` and `OrderBookMbp` to `OrderBook` (consolidated)
- Renamed `Indicator.handle_book_mbo` and `Indicator.handle_book_mbp` to `handle_book` (consolidated)
- Renamed `register_serializable_object` to `register_serializable_type` (also renames first param from `obj` to `cls`)

### Fixes
- Fixed `MessageBus` pattern resolving (fixes a performance regression where topics published with no subscribers would always re-resolve)
- Fixed `BacktestNode` streaming data management (was not clearing between chunks), thanks for the report @dpmabo
- Fixed `RiskEngine` cumulative notional calculations for margin accounts (was incorrectly using base currency when selling)
- Fixed selling `Equity` instruments with `CASH` account and `NETTING` OMS incorrectly rejecting (should be able to reduce position)
- Fixed Databento bars decoding (was incorrectly applying display factor)
- Fixed `Binance` bar (kline) to use `close_time` for `ts_event` was `opentime` (#1591), thanks for reporting @OnlyC
- Fixed `AccountMarginExceeded` error condition (margin must actually be exceeded now, and can be zero)
- Fixed `ParquetDataCatalog` path globbing which was including all paths with substrings of specified instrument IDs

---

# NautilusTrader 1.190.0 Beta

Released on 22nd March 2024 (UTC).
Expand All @@ -11,6 +54,8 @@ Released on 22nd March 2024 (UTC).
- Improved Binance execution client ping listen key error handling and logging
- Improved Redis cache adapter and message bus error handling and logging
- Improved Redis port parsing (`DatabaseConfig.port` can now be either a string or integer)
- Ported ChandeMomentumOscillator indicator to Rust, thanks @Pushkarm029
- Ported VIDYA indicator to Rust, thanks @Pushkarm029
- Refactored `InteractiveBrokersEWrapper`, thanks @rsmb7z
- Redact Redis passwords in strings and logs
- Upgraded `redis` crate to 0.25.2 which bumps up TLS dependencies, and turned on `tls-rustls-webpki-roots` feature flag
Expand Down
6 changes: 3 additions & 3 deletions docs/concepts/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ compatibility across different environments where color rendering is not support
It's possible to use `Logger` objects directly, and these can be initialized anywhere (very similar to the Python built-in `logging` API).

If you ***aren't*** using an object which already initializes a `NautilusKernel` (and logging) such as `BacktestEngine` or `TradingNode`,
then you can initialize a logging in the following way:
then you can initialize logging in the following way:
```python
from nautilus_trader.common.component import init_logging
from nautilus_trader.common.component import Logger

init_logging()
log_guard = init_logging()
logger = Logger("MyLogger")
```

Expand All @@ -118,5 +118,5 @@ See the `init_logging` [API Reference](../api_reference/common.md#init_logging)
```

```{warning}
Only one logging system can be initialized per process with an `init_logging` call.
Only one logging system can be initialized per process with an `init_logging` call, and the `LogGuard` which is returned must be kept alive for the lifetime of the program.
```
6 changes: 3 additions & 3 deletions docs/concepts/message_bus.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ Most Nautilus built-in objects are serializable, dictionaries `dict[str, Any]` c
Additional custom types can be registered by calling the following registration function from the `serialization` subpackage:

```python
def register_serializable_object(
obj,
def register_serializable_type(
cls,
to_dict: Callable[[Any], dict[str, Any]],
from_dict: Callable[[dict[str, Any]], Any],
):
...
```

- `obj` The object to register
- `cls` The type to register
- `to_dict` The delegate to instantiate a dict of primitive types from the object
- `from_dict` The delegate to instantiate the object from a dict of primitive types

Expand Down
Loading

0 comments on commit 0eb0b56

Please sign in to comment.