Skip to content

Commit

Permalink
Release 1.177.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Aug 25, 2023
2 parents 32b0e70 + 0dc7268 commit e658ba6
Show file tree
Hide file tree
Showing 273 changed files with 13,684 additions and 5,557 deletions.
2 changes: 1 addition & 1 deletion .docker/nautilus_trader.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN (cd nautilus_core && cargo build --release)

COPY nautilus_trader ./nautilus_trader
COPY README.md ./
RUN poetry install --only main
RUN poetry install --only main --all-extras
RUN poetry build -f wheel
RUN python -m pip install ./dist/*whl --force
RUN find /usr/local/lib/python3.11/site-packages -name "*.pyc" -exec rm -f {} \;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
fail-fast: false
matrix:
arch: [x64]
os: [ubuntu-20.04, ubuntu-latest, macos-latest, macos-13, windows-latest]
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
name: publish-wheels - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.obj
*.lib
*.log
*.patch
*.prof
*.rdb
*.xml
Expand Down Expand Up @@ -35,6 +36,7 @@ dist/
env/
log/
logs/
secrets/
*temp/
*target/
venv*/
Expand All @@ -50,5 +52,6 @@ examples/backtest/notebooks/catalog
nautilus_trader/**/.gitignore
nautilus_trader/test_kit/mocks/.nautilus/
tests/test_data/catalog/
bench_data/

!tests/integration_tests/adapters/betfair/responses/*.log
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: end-of-file-fixer
types_or: [python, cython, rust]
- id: trailing-whitespace
types_or: [python, cython]
types_or: [rust, cython, python]
- id: debug-statements
- id: detect-private-key
- id: check-builtin-literals
Expand Down Expand Up @@ -60,7 +60,7 @@ repos:
# Python/Cython formatting and linting
##############################################################################
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.0.0
rev: v3.0.1
hooks:
- id: add-trailing-comma
name: add-trailing-comma
Expand All @@ -76,7 +76,7 @@ repos:
exclude: "docs/_pygments/monokai.py"

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.5.1
hooks:
- id: mypy
args: [
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ format:
(cd nautilus_core && cargo +nightly fmt)

.PHONY: pre-commit
pre-commit: format
pre-commit:
pre-commit run --all-files

.PHONY: pre-flight
pre-flight: format pre-commit cargo-test build-debug pytest

.PHONY: ruff
ruff:
ruff check . --fix
Expand Down
9 changes: 5 additions & 4 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.71.0+ | 3.9+ |
| `macOS (x86_64)` | 1.71.0+ | 3.9+ |
| `macOS (arm64)` | 1.71.0+ | 3.9+ |
| `Windows (x86_64)` | 1.71.0+ | 3.9+ |
| `Linux (x86_64)` | 1.71.1+ | 3.9+ |
| `macOS (x86_64)` | 1.71.1+ | 3.9+ |
| `macOS (arm64)` | 1.71.1+ | 3.9+ |
| `Windows (x86_64)` | 1.71.1+ | 3.9+ |

- **Website:** https://nautilustrader.io
- **Docs:** https://docs.nautilustrader.io
Expand Down Expand Up @@ -233,6 +233,7 @@ A `Makefile` is provided to automate most installation and build tasks for devel
- `make clean` -- **CAUTION** Cleans all non-source artifacts from the repository
- `make docs` -- Builds the documentation HTML using Sphinx
- `make pre-commit` -- Runs the pre-commit checks over all files
- `make pre-flight` -- Runs pre-commit, makes a clean debug build and runs all tests (except performance tests)
- `make ruff` -- Runs ruff over all files using the `pyproject.toml` config
- `make pytest` -- Runs all tests with `pytest` (except performance tests)
- `make pytest-coverage` -- Same as `make pytest` and additionally runs with test coverage and produces a report
Expand Down
62 changes: 49 additions & 13 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# NautilusTrader 1.177.0 Beta

Released on 26th August 2023 (UTC).

This release includes a large breaking change to quote tick bid and ask price property and
parameter naming. This was done in the interest of maintaining our generally explicit naming
standards, and has caused confusion for some users in the past. Data using 'bid' and 'ask' columns should
still work with the legacy data wranglers, as columns are renamed under the hood to accommodate
this change.

### Enhancements
- Added `ActorExecutor` with `Actor` API for creating and running threaded tasks in live environments
- Added `OrderEmulated` event and associated `OrderStatus.EMULATED` enum variant
- Added `OrderReleased` event and associated `OrderStatus.RELEASED` enum variant
- Added `BacktestVenueConfig.use_position_ids` option (default true to retain current behavior)
- Added `Cache.exec_spawn_total_quantity(...)` convenience method
- Added `Cache.exec_spawn_total_filled_qty(...)` convenience method
- Added `Cache.exec_spawn_total_leaves_qty(...)` convenience method
- Added `WebSocketClient.send_text`, thanks @twitu
- Implemented string interning for `TimeEvent`

### Breaking Changes
- Renamed `QuoteTick.bid` to `bid_price` including all associated parameters (for explicit naming standards)
- Renamed `QuoteTick.ask` to `ask_price` including all associated parameters (for explicit naming standards)

### Fixes
- Fixed execution algorithm `position_id` assignment in `HEDGING` mode
- Fixed `OrderMatchingEngine` processing of emulated orders
- Fixed `OrderEmulator` processing of exec algorithm orders
- Fixed `ExecutionEngine` processing of exec algorithm orders (exec spawn IDs)
- Fixed `Cache` emulated order indexing (were not being properly discarded from the set when closed)
- Fixed `RedisCacheDatabase` loading of transformed `LIMIT` orders
- Fixed a connection issue with the IB client, thanks @dkharrat and @rsmb7z

---

# NautilusTrader 1.176.0 Beta

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

---
Expand All @@ -74,7 +110,7 @@ We recommend you do not upgrade to this version if you're using the Betfair adap
- Added core Rust `SocketClient` based on `tokio` `TcpStream`, thanks @twitu
- Added `quote_quantity` parameter to determine if order quantity is denominated in quote currency
- Added `trigger_instrument_id` parameter to trigger emulated orders from alternative instrument prices
- 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)
- 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)
- Added `ExecEngineConfig.filter_unclaimed_external_orders` options, if unclaimed order events with an `EXTERNAL` strategy ID should be filtered/dropped
- Changed `BinanceHttpClient` to use new core HTTP client
- Defined public API for data, can now import directly from `nautilus_trader.model.data` (denest namespace)
Expand Down Expand Up @@ -442,7 +478,7 @@ Released on 12th December 2022 (UTC).

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

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

### Fixes
- Fixed limit order `IOC` and `FOK` behaviour, thanks @limx0 for identifying
- Fixed limit order `IOC` and `FOK` behavior, thanks @limx0 for identifying
- Fixed FTX `CryptoFuture` instrument parsing, thanks @limx0
- Fixed missing imports in data catalog example notebook, thanks @gaugau3000
- Fixed order update behaviour, affected orders:
- Fixed order update behavior, affected orders:
- `LIMIT_IF_TOUCHED`
- `MARKET_IF_TOUCHED`
- `MARKET_TO_LIMIT`
Expand Down Expand Up @@ -808,7 +844,7 @@ None

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

### Fixes
- Fixed behaviour of `IOC` and `FOK` time in force instructions
- Fixed behavior of `IOC` and `FOK` time in force instructions
- Fixed Binance bar resolution parsing

---
Expand Down Expand Up @@ -2159,7 +2195,7 @@ symbol string, a primary `Venue`, `AssetClass` and `AssetType` properties.

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

The behaviour of the `StopLimitOrder` continued to be fixed and refined.
The behavior of the `StopLimitOrder` continued to be fixed and refined.
`SimulatedExchange` was refactored further to reduce complexity.

### Breaking Changes
Expand All @@ -2170,7 +2206,7 @@ None

### Fixes
- `TRIGGERED` states in order FSM
- `StopLimitOrder` triggering behaviour
- `StopLimitOrder` triggering behavior
- `OrderFactory.stop_limit` missing `post_only` and `hidden`
- `Order` and `StopLimitOrder` `__repr__` string (duplicate id)

Expand All @@ -2181,10 +2217,10 @@ None
## Release Notes

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

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

Expand All @@ -2198,7 +2234,7 @@ None
- Add `risk` subpackage to group risk components

### Fixes
- `StopLimitOrder` triggering behaviour
- `StopLimitOrder` triggering behavior
- All flake8 warnings

---
Expand Down
10 changes: 10 additions & 0 deletions docs/api_reference/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
:member-order: bysource
```

## Executor

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

```{eval-rst}
.. automodule:: nautilus_trader.common.factories
:show-inheritance:
Expand Down
8 changes: 8 additions & 0 deletions docs/api_reference/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
:member-order: bysource
```

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

```{eval-rst}
.. automodule:: nautilus_trader.execution.matching_core
:show-inheritance:
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ cpdef list orders_for_exec_algorithm(
As well as more specifically querying the orders for a certain execution series/spawn:

```python
cpdef list orders_for_exec_spawn(self, ClientOrderId client_order_id):
cpdef list orders_for_exec_spawn(self, ClientOrderId exec_spawn_id):
"""
Return all orders for the given execution spawn ID (if found).
Will also include the primary (original) order.
Parameters
----------
client_order_id : ClientOrderId
exec_spawn_id : ClientOrderId
The execution algorithm spawning primary (original) client order ID.
Returns
Expand Down
6 changes: 3 additions & 3 deletions docs/concepts/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ important for market makers, or traders seeking to restrict the order to a liqui

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

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

### Display Quantity
Expand Down
4 changes: 2 additions & 2 deletions docs/developer_guide/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ their own standard libraries.

Great care will be taken with the use of Rusts `unsafe` facility - which just enables a small set of additional language features, thereby changing
the contract between the interface and caller, shifting some responsibility for guaranteeing correctness
from the Rust compiler, and onto us. The goal is to realize the advantages of the `unsafe` facility, whilst avoiding _any_ undefined behaviour.
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).
from the Rust compiler, and onto us. The goal is to realize the advantages of the `unsafe` facility, whilst avoiding _any_ undefined behavior.
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).

## Safety Policy
To maintain the high standards of correctness the project strives for, it's necessary to specify a reasonable policy
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ deleted when the container is deleted.
- To get started, install docker:
- Go to [docker.com](https://docs.docker.com/get-docker/) and follow the instructions
- From a terminal, download the latest image
- `docker pull ghcr.io/nautechsystems/jupyterlab:develop`
- `docker pull ghcr.io/nautechsystems/jupyterlab:develop --platform linux/amd64`
- Run the docker container, exposing the jupyter port:
- `docker run -p 8888:8888 ghcr.io/nautechsystems/jupyterlab:develop`
- Open your web browser to `localhost:{port}`
Expand Down Expand Up @@ -196,7 +196,7 @@ venue = BacktestVenueConfig(
oms_type="NETTING",
account_type="MARGIN",
base_currency="USD",
starting_balances=["1_000_000 USD"]
starting_balances=["1_000_000 USD"],
)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/backtest_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def parser(line):
dt = pd.Timestamp(datetime.datetime.strptime(ts.decode(), "%Y%m%d %H%M%S%f"), tz='UTC')
yield QuoteTick(
instrument_id=AUDUSD.id,
bid=Price.from_str(bid.decode()),
ask=Price.from_str(ask.decode()),
bid_price=Price.from_str(bid.decode()),
ask_price=Price.from_str(ask.decode()),
bid_size=Quantity.from_int(100_000),
ask_size=Quantity.from_int(100_000),
ts_event=dt_to_unix_nanos(dt),
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/loading_external_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def parser(data, instrument_id):
dt = pd.Timestamp(datetime.datetime.strptime(data['timestamp'].decode(), "%Y%m%d %H%M%S%f"), tz='UTC')
yield QuoteTick(
instrument_id=instrument_id,
bid=Price.from_str(data['bid'].decode()),
ask=Price.from_str(data['ask'].decode()),
bid_price=Price.from_str(data["bid_price"].decode()),
ask_price=Price.from_str(data["ask_price"].decode()),
bid_size=Quantity.from_int(100_000),
ask_size=Quantity.from_int(100_000),
ts_event=dt_to_unix_nanos(dt),
Expand Down Expand Up @@ -158,7 +158,7 @@ process_files(
glob_path=input_files,
reader=CSVReader(
block_parser=lambda x: parser(x, instrument_id=instrument.id),
header=['timestamp', 'bid', 'ask', 'volume'],
header=["timestamp", "bid", "ask", "volume"],
chunked=False,
as_dataframe=False,
),
Expand Down
Loading

0 comments on commit e658ba6

Please sign in to comment.