Skip to content

Commit

Permalink
Release 1.200.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers authored Sep 7, 2024
2 parents 7a496b4 + 3d382f7 commit 5823764
Show file tree
Hide file tree
Showing 477 changed files with 42,985 additions and 3,252 deletions.
File renamed without changes.
10 changes: 6 additions & 4 deletions .docker/nautilus_trader.dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
FROM python:3.12-slim as base
FROM python:3.12-slim AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
PYO3_PYTHON="/usr/local/bin/python3" \
POETRY_VERSION=1.8.3 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
RUST_TOOLCHAIN="stable" \
BUILD_MODE="release"
BUILD_MODE="release" \
CC="clang"
ENV PATH="/root/.cargo/bin:$POETRY_HOME/bin:$PATH"
WORKDIR $PYSETUP_PATH

FROM base as builder
FROM base AS builder

# Install build deps
RUN apt-get update && \
Expand Down Expand Up @@ -44,6 +46,6 @@ RUN python -m pip install ./dist/*whl --force --no-deps
RUN find /usr/local/lib/python3.12/site-packages -name "*.pyc" -exec rm -f {} \;

# Final application image
FROM base as application
FROM base AS application

COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,17 @@ jobs:
env:
BUILD_MODE: debug
RUST_BACKTRACE: 1
# CARGO_BUILD_TARGET: aarch64-apple-darwin

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

- name: Free up disk space (macOS)
run: |
sudo rm -rf ~/Library/Caches/*
sudo rm -rf ~/Library/Developer/Xcode/DerivedData/*
sudo rm -rf /Library/Developer/CommandLineTools
- name: Get Rust version from rust-toolchain.toml
id: rust-version
run: |
Expand All @@ -304,7 +309,7 @@ jobs:
toolchain: ${{ env.RUST_VERSION }}
override: true
components: rustfmt, clippy
# target: aarch64-apple-darwin
target: aarch64-apple-darwin

- name: Set up Python environment
uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ repos:
exclude: "docs/_pygments/monokai.py"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.4
hooks:
- id: ruff
args: ["--fix"]
Expand Down Expand Up @@ -112,7 +112,7 @@ repos:
]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
args: [
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

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

[![](https://dcbadge.limes.pink/api/server/AUWVs3XaCS)](https://discord.gg/AUWVs3XaCS)

Expand Down Expand Up @@ -129,10 +129,11 @@ The following integrations are currently supported:
| [Binance Futures](https://www.binance.com/en/futures) | `BINANCE` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://nautilustrader.io/docs/latest/integrations/binance.html) |
| [Bybit](https://www.bybit.com) | `BYBIT` | Crypto Exchange (CEX) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://nautilustrader.io/docs/latest/integrations/bybit.html) |
| [Databento](https://databento.com) | `DATABENTO` | Data Provider | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://nautilustrader.io/docs/latest/integrations/databento.html) |
| [dYdX](https://dydx.exchange/) | `DYDX` | Crypto Exchange (DEX) | ![status](https://img.shields.io/badge/beta-yellow) | [Guide](https://nautilustrader.io/docs/latest/integrations/dydx.html) |
| [Interactive Brokers](https://www.interactivebrokers.com) | `INTERACTIVE_BROKERS` | Brokerage (multi-venue) | ![status](https://img.shields.io/badge/stable-green) | [Guide](https://nautilustrader.io/docs/latest/integrations/ib.html) |

- **ID:** The default client ID for the integrations adapter clients
- **Type:** The type of integration (often the venue type)
- **ID**: The default client ID for the integrations adapter clients
- **Type**: The type of integration (often the venue type)

### Status
- `building`: Under construction and likely not in a usable state
Expand Down
60 changes: 52 additions & 8 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# NautilusTrader 1.200.0 Beta

Released on 7th September 2024 (UTC).

### Enhancements
- Added dYdX integration (#1861, #1868, #1873, #1874, #1875, #1877, #1879, #1880, #1882, #1886, #1887, #1890, #1891, #1896, #1901, #1903, #1907, #1910, #1911, #1913), thanks @davidsblom
- Added composite bar types, bars aggregated from other bar types (#1859, #1885, #1888, #1894, #1905), thanks @faysou
- Added `OrderBookDeltas.batch` for batching groups of deltas based on record flags (batch until `F_LAST`)
- Added `OrderBookDeltas` batching support for `ParquetDataCatalog` (use `data_cls` of `OrderBookDeltas` to batch with the same flags method as live adapters)
- Added `RetryManagerPool` to abstract common retry functionality for all adapters
- Added `InstrumentClose` functionality for `OrderMatchingEngine`, thanks @limx0
- Added `BacktestRunConfig.dispose_on_completion` config setting to control post-run disposal behavior for each internal backtest engine (`True` by default to retain current behavior)
- Added `recv_window_ms` config setting for `BinanceExecClientConfig`
- Added `sl_time_in_force` and `tp_time_in_force` parameters to `OrderFactory.bracket(...)` method
- Added custom `client_order_id` parameters to `OrderFactory` methods
- Added support for Binance RSA and Ed25519 API key types (#1908), thanks @NextThread
- Added `multiplier` parameter for `CryptoPerpetual` (default 1)
- Implemented `BybitExecutionClient` retry logic for `submit_order`, `modify_order`, `cancel_order` and `cancel_all_orders`
- Improved error modeling and handling in Rust (#1866), thanks @twitu
- Improved `HttpClient` error handling and added `HttpClientError` exception for Python (#1872), thanks @twitu
- Improved `WebSocketClient` error handling and added `WebSocketClientError` exception for Python (#1876), thanks @twitu
- Improved `WebSocketClient.send_text` efficiency (now accepts UTF-8 encoded bytes, rather than a Python string)
- Improved `@customdataclass` decorator with `date` field and refined `__repr__` (#1900, #1906, #1909), thanks @faysou
- Improved standardization of `OrderBookDeltas` parsing and records flags for crypto venues
- Refactored `RedisMessageBusDatabase` to tokio tasks
- Refactored `RedisCacheDatabase` to tokio tasks
- Upgraded `tokio` crate to v1.40.0

### Breaking Changes
- Renamed `heartbeat_interval` to `heartbeat_interval_secs` (more explicitly indicates time units)
- Moved `heartbeat_interval_secs` config setting to `MessageBusConfig` (the message bus handles external stream processing)
- Changed `WebSocketClient.send_text(...)` to take `data` as `bytes` rather than `str`
- Changed `CryptoPerpetual` Arrow schema to include `multiplier` field
- Changed `CryptoFuture` Arrow schema to include `multiplier` field

### Fixes
- Fixed `OrderBook` memory deallocation in Python finalizer (memory was not being freed on object destruction), thanks for reporting @zeyuhuan
- Fixed `Order` tags serialization (was not concatenating to a single string), thanks for reporting @DevRoss
- Fixed `types_filter` serialization in `MessageBusConfig` during kernel setup
- Fixed `InstrumentProvider` handling of `load_ids_on_start` when elements are already `InstrumentId`s
- Fixed `InstrumentProviderConfig` hashing for `filters` field

---

# NautilusTrader 1.199.0 Beta

Released on 19th August 2024 (UTC).
Expand Down Expand Up @@ -98,7 +142,7 @@ Released on 5th July 2024 (UTC).
### Enhancements
- Added `request_order_book_snapshot` method (#1745), thanks @graceyangfan
- Added order book data validation for `BacktestNode` when a venue `book_type` is `L2_MBP` or `L3_MBO`
- Added Bybit demo account support (set `is_demo` to True in configs)
- Added Bybit demo account support (set `is_demo` to `True` in configs)
- Added Bybit stop order types (`STOP_MARKET`, `STOP_LIMIT`, `MARKET_IF_TOUCHED`, `LIMIT_IF_TOUCHED`, `TRAILING_STOP_MARKET`)
- Added Binance venue option for adapter configurations (#1738), thanks @DevRoss
- Added Betfair amend order quantity support (#1687 and #1751), thanks @imemo88 and @limx0
Expand Down Expand Up @@ -299,7 +343,7 @@ Released on 20th April 2024 (UTC).
- 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 `BinanceBar` (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

Expand Down Expand Up @@ -612,7 +656,7 @@ This release adds support for Python 3.12.

### Fixes
- Fixed missing `trader_id` in `Position` dictionary representation, thanks @filipmacek
- Fixed conversion of fixed precision integers to floats (should be dividing to avoid rounding errors), thanks for reporting @filipmacek
- Fixed conversion of fixed-point integers to floats (should be dividing to avoid rounding errors), thanks for reporting @filipmacek
- Fixed daily timestamp parsing for Interactive Brokers, thanks @benjaminsingleton
- Fixed live reconciliation trade processing for partially filled then canceled orders
- Fixed `RiskEngine` cumulative notional risk check for `CurrencyPair` SELL orders on multi-currency cash accounts
Expand Down Expand Up @@ -650,7 +694,7 @@ Released on 3rd November 2023 (UTC).

### Fixes
- Fixed `ParquetDataCatalog` file writing template, thanks @limx0
- Fixed `Binance` all orders requests which would omit order reports when using a `start` param
- Fixed Binance all orders requests which would omit order reports when using a `start` param
- Fixed managed GTD orders past expiry cancellation on restart (orders were not being canceled)
- Fixed managed GTD orders cancel timer on order cancel (timers were not being canceled)
- Fixed `BacktestEngine` logging error with immediate stop (caused by certain timestamps being `None`)
Expand Down Expand Up @@ -797,7 +841,7 @@ Released on 31st July 2023 (UTC).
- Added `Actor.pending_requests()` convenience method
- Added `USDP` (Pax Dollar) and `TUSD` (TrueUSD) stablecoins
- Improved `OrderMatchingEngine` handling when no fills (an error is now logged)
- Improved `Binance` live clients logging
- Improved Binance live clients logging
- Upgraded Cython to v3.0.0 stable

### Breaking Changes
Expand Down Expand Up @@ -886,7 +930,7 @@ Released on 19th May 2023 (UTC).
### Enhancements
- Improved handling for backtest account blow-up scenarios (balance negative or margin exceeded)
- Added `AccountMarginExceeded` exception and refined `AccountBalanceNegative`
- Various improvements to `Binance` clients error handling and logging
- Various improvements to Binance clients error handling and logging
- Improve Binance HTTP error messages

### Fixes
Expand Down Expand Up @@ -1034,7 +1078,7 @@ Released on 18th February 2023 (UTC).
### Enhancements
- Complete overhaul and improvements to Binance adapter(s), thanks @poshcoe
- Added Binance aggregated trades functionality with `use_agg_trade_ticks`, thanks @poshcoe
- Added `time_bars_timestamp_on_close` option for configurable bar timestamping (true by default)
- Added `time_bars_timestamp_on_close` option for configurable bar timestamping (`True` by default)
- Added `OrderFactory.generate_client_order_id()` (calls internal generator)
- Added `OrderFactory.generate_order_list_id()` (calls internal generator)
- Added `OrderFactory.create_list(...)` as easier method for creating order lists
Expand Down Expand Up @@ -2635,7 +2679,7 @@ improved fill modelling assumptions and customizations.
- `LiveLogger` now exhibits better blocking behavior and logging

### Fixes
- Various patches to the `Betfair` adapter
- Various patches to the Betfair adapter
- Documentation builds

---
Expand Down
26 changes: 23 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import platform
import shutil
import subprocess
import sys
import sysconfig
from pathlib import Path

Expand Down Expand Up @@ -46,12 +47,19 @@
################################################################################
# RUST BUILD
################################################################################

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

if platform.system() == "Linux":
# Use clang as the default compiler
os.environ["CC"] = "clang"
os.environ["LDSHARED"] = "clang -shared"

TARGET_DIR = Path.cwd() / "nautilus_core" / "target" / BUILD_MODE
if platform.system() == "Darwin" and platform.machine() == "arm64":
TARGET_DIR = Path.cwd() / "nautilus_core" / "target" / "aarch64-apple-darwin" / BUILD_MODE
os.environ["CFLAGS"] = "-arch arm64"
os.environ["LDFLAGS"] = "-arch arm64 -w"


if platform.system() == "Windows":
# Linker error 1181
Expand Down Expand Up @@ -87,6 +95,10 @@ def _build_rust_libs() -> None:
raise ValueError(f"Invalid `RUST_TOOLCHAIN` '{RUST_TOOLCHAIN}'")

build_options = " --release" if BUILD_MODE == "release" else ""

if platform.system() == "Darwin" and platform.machine() == "arm64":
build_options += " --target aarch64-apple-darwin"

print("Compiling Rust libraries...")

cmd_args = [
Expand Down Expand Up @@ -347,7 +359,7 @@ def build() -> None:
print(f"System: {platform.system()} {platform.machine()}")
print(f"Clang: {_get_clang_version()}")
print(f"Rust: {_get_rustc_version()}")
print(f"Python: {platform.python_version()}")
print(f"Python: {platform.python_version()} ({sys.executable})")
print(f"Cython: {cython_compiler_version}")
print(f"NumPy: {np.__version__}\n")

Expand All @@ -358,7 +370,15 @@ def build() -> None:
print(f"ANNOTATION_MODE={ANNOTATION_MODE}")
print(f"PARALLEL_BUILD={PARALLEL_BUILD}")
print(f"COPY_TO_SOURCE={COPY_TO_SOURCE}")
print(f"PYO3_ONLY={PYO3_ONLY}\n")
print(f"PYO3_ONLY={PYO3_ONLY}")

CFLAGS = os.environ.get("CFLAGS")
if CFLAGS:
print(f"CFLAGS={CFLAGS}")

LDFLAGS = os.environ.get("LDFLAGS")
if LDFLAGS:
print(f"LDFLAGS={LDFLAGS}\n")

print("Starting build...")
ts_start = datetime.datetime.now(datetime.timezone.utc)
Expand Down
69 changes: 69 additions & 0 deletions docs/api_reference/adapters/bybit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Bybit

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Config

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.config
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Factories

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.factories
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Enums

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.common.enums
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Providers

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.providers
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Data

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.data
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

## Execution

```{eval-rst}
.. automodule:: nautilus_trader.adapters.bybit.execution
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```
Loading

0 comments on commit 5823764

Please sign in to comment.