Skip to content

Commit 68c2e56

Browse files
authored
Release 1.171.0
See release notes.
2 parents afdf8d9 + c09984e commit 68c2e56

File tree

175 files changed

+3553
-1822
lines changed

Some content is hidden

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

175 files changed

+3553
-1822
lines changed

.dockerignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
33
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
44

5+
.git/
6+
**/.pack
7+
58
# User-specific stuff
69
.idea/**/workspace.xml
710
.idea/**/tasks.xml
@@ -200,4 +203,4 @@ cython_debug/
200203

201204
# Nautilus
202205
docs/
203-
tests/
206+
tests/

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
arch: [x64]
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
python-version: ["3.9", "3.10", "3.11"]
18+
python-version: ["3.9", "3.10"]
1919
name: build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
2020
runs-on: ${{ matrix.os }}
2121
env:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
.idea/
2222
.ipynb_checkpoints
2323
.mypy_cache/
24-
.nox/
2524
.profile/
2625
.pytest_cache/
2726
.python-version
27+
.ruff_cache/
2828
.vscode/
2929

3030
__pycache__

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
- id: check-yaml
2626

2727
- repo: https://github.com/codespell-project/codespell
28-
rev: v2.2.2
28+
rev: v2.2.4
2929
hooks:
3030
- id: codespell
3131
description: Checks for common misspellings.
@@ -84,7 +84,7 @@ repos:
8484
args: ["--settings-file", "pyproject.toml", "."]
8585

8686
- repo: https://github.com/psf/black
87-
rev: 23.1.0
87+
rev: 23.3.0
8888
hooks:
8989
- id: black
9090
types_or: [python, pyi]
@@ -93,7 +93,7 @@ repos:
9393
exclude: "docs/_pygments/monokai.py"
9494

9595
- repo: https://github.com/pre-commit/mirrors-mypy
96-
rev: v1.0.1
96+
rev: v1.1.1
9797
hooks:
9898
- id: mypy
9999
args: [
@@ -111,7 +111,7 @@ repos:
111111
]
112112

113113
- repo: https://github.com/charliermarsh/ruff-pre-commit
114-
rev: v0.0.254
114+
rev: v0.0.260
115115
hooks:
116116
- id: ruff
117117

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
| Platform | Rust | Python |
1717
|:------------------|:----------|:-------|
18-
| Linux (x86\_64) | `1.68.0+` | `3.9+` |
19-
| macOS (x86\_64) | `1.68.0+` | `3.9+` |
20-
| Windows (x86\_64) | `1.68.0+` | `3.9+` |
18+
| Linux (x86\_64) | `1.68.2+` | `3.9+` |
19+
| macOS (x86\_64) | `1.68.2+` | `3.9+` |
20+
| Windows (x86\_64) | `1.68.2+` | `3.9+` |
2121

2222
- **Website:** https://nautilustrader.io
2323
- **Docs:** https://docs.nautilustrader.io

RELEASES.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# NautilusTrader 1.171.0 Beta
2+
3+
Released on 30th March 2023 (UTC).
4+
5+
### Breaking Changes
6+
- Renamed all position `net_qty` fields and parameters to `signed_qty` (more accurate naming)
7+
- `NautilusKernelConfig` removed all `log_*` config options (replaced by `logging` with `LoggingConfig`)
8+
- Trading `CurrencyPair` instruments with a _single-currency_ `CASH` account type no longer permitted (unrealistic)
9+
- Changed `PositionEvent` parquet schemas (renamed `net_qty` field to `signed_qty`)
10+
11+
### Enhancements
12+
- Added `LoggingConfig` to consolidate logging configs, offering various file options and per component level filters
13+
- Added `BacktestVenueConfig.bar_execution` to control whether bar data moves the matching engine markets (reinstated)
14+
- Added optional `request_id` for actor data requests (aids processing responses), thanks @rsmb7z
15+
- Added `Position.signed_decimal_qty()`
16+
- Now using above signed quantity for `Portfolio` net position calculation, and `LiveExecutionEngine` reconciliation comparisons
17+
18+
### Fixes
19+
- Fixed `BacktestEngine` clock and logger handling (had a redundant extra logger and not swapping live clock in post run)
20+
- Fixed `close_position` order event publishing and cache persistence for `MarketOrder` and `SubmitOrder`, thanks for reporting @rsmb7z
21+
22+
---
23+
124
# NautilusTrader 1.170.0 Beta
225

326
Released on 11th March 2023 (UTC).

build.py

+18-22
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@
4848
os.environ["CC"] = "clang"
4949
os.environ["LDSHARED"] = "clang -shared"
5050

51-
TARGET_DIR = os.path.join(os.getcwd(), "nautilus_core", "target", BUILD_MODE)
51+
TARGET_DIR = Path.cwd() / "nautilus_core" / "target" / BUILD_MODE
5252

5353
if platform.system() == "Windows":
54+
# Linker error 1181
5455
# https://docs.microsoft.com/en-US/cpp/error-messages/tool-errors/linker-tools-error-lnk1181?view=msvc-170&viewFallbackFrom=vs-2019
55-
os.environ["LIBPATH"] = os.environ.get("LIBPATH", "") + f":{TARGET_DIR}"
5656
RUST_LIB_PFX = ""
5757
RUST_STATIC_LIB_EXT = "lib"
5858
RUST_DYLIB_EXT = "dll"
59-
TARGET_DIR = TARGET_DIR.replace(BUILD_MODE, "x86_64-pc-windows-msvc/" + BUILD_MODE)
6059
elif platform.system() == "Darwin":
6160
RUST_LIB_PFX = "lib"
6261
RUST_STATIC_LIB_EXT = "a"
@@ -68,27 +67,24 @@
6867

6968
# Directories with headers to include
7069
RUST_INCLUDES = ["nautilus_trader/core/includes"]
71-
RUST_LIBS = [
72-
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_common.{RUST_STATIC_LIB_EXT}",
73-
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_core.{RUST_STATIC_LIB_EXT}",
74-
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_model.{RUST_STATIC_LIB_EXT}",
75-
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_persistence.{RUST_STATIC_LIB_EXT}",
70+
RUST_LIB_PATHS: list[Path] = [
71+
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_common.{RUST_STATIC_LIB_EXT}",
72+
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_core.{RUST_STATIC_LIB_EXT}",
73+
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_model.{RUST_STATIC_LIB_EXT}",
74+
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_persistence.{RUST_STATIC_LIB_EXT}",
7675
]
76+
RUST_LIBS: list[str] = [str(path) for path in RUST_LIB_PATHS]
7777

7878

7979
def _build_rust_libs() -> None:
8080
try:
8181
# Build the Rust libraries using Cargo
82-
build_options = ""
82+
build_options = " --release" if BUILD_MODE == "release" else ""
8383
extra_flags = ""
84-
if platform.system() == "Windows":
85-
extra_flags = " --target x86_64-pc-windows-msvc"
86-
87-
build_options += " --release" if BUILD_MODE == "release" else ""
8884
print("Compiling Rust libraries...")
8985
build_cmd = f"(cd nautilus_core && cargo build{build_options}{extra_flags} --all-features)"
9086
print(build_cmd)
91-
os.system(build_cmd) # noqa
87+
os.system(build_cmd)
9288
except subprocess.CalledProcessError as e:
9389
raise RuntimeError(
9490
f"Error running cargo: {e.stderr.decode()}",
@@ -159,7 +155,7 @@ def _build_extensions() -> list[Extension]:
159155
Extension(
160156
name=str(pyx.relative_to(".")).replace(os.path.sep, ".")[:-4],
161157
sources=[str(pyx)],
162-
include_dirs=[np.get_include()] + RUST_INCLUDES,
158+
include_dirs=[np.get_include(), *RUST_INCLUDES],
163159
define_macros=define_macros,
164160
language="c",
165161
extra_link_args=extra_link_args,
@@ -194,24 +190,24 @@ def _build_distribution(extensions: list[Extension]) -> Distribution:
194190
def _copy_build_dir_to_project(cmd: build_ext) -> None:
195191
# Copy built extensions back to the project tree
196192
for output in cmd.get_outputs():
197-
relative_extension = os.path.relpath(output, cmd.build_lib)
198-
if not os.path.exists(output):
193+
relative_extension = Path(output).relative_to(cmd.build_lib)
194+
if not Path(output).exists():
199195
continue
200196

201197
# Copy the file and set permissions
202198
shutil.copyfile(output, relative_extension)
203-
mode = os.stat(relative_extension).st_mode
199+
mode = relative_extension.stat().st_mode
204200
mode |= (mode & 0o444) >> 2
205-
os.chmod(relative_extension, mode)
201+
relative_extension.chmod(mode)
206202

207203
print("Copied all compiled dynamic library files into source")
208204

209205

210206
def _copy_rust_dylibs_to_project() -> None:
211207
# https://pyo3.rs/latest/building_and_distribution#manual-builds
212208
ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
213-
src = f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_pyo3.{RUST_DYLIB_EXT}"
214-
dst = f"nautilus_trader/core/nautilus_pyo3{ext_suffix}"
209+
src = Path(TARGET_DIR) / f"{RUST_LIB_PFX}nautilus_pyo3.{RUST_DYLIB_EXT}"
210+
dst = Path("nautilus_trader/core") / f"nautilus_pyo3{ext_suffix}"
215211
shutil.copyfile(src=src, dst=dst)
216212

217213
print(f"Copied {src} to {dst}")
@@ -259,7 +255,7 @@ def _get_rustc_version() -> str:
259255

260256

261257
def build() -> None:
262-
"""Construct the extensions and distribution.""" # noqa
258+
"""Construct the extensions and distribution."""
263259
_build_rust_libs()
264260
_copy_rust_dylibs_to_project()
265261

docs/api_reference/adapters/betfair.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
:member-order: bysource
99
```
1010

11+
## Config
12+
13+
```{eval-rst}
14+
.. automodule:: nautilus_trader.adapters.betfair.config
15+
:show-inheritance:
16+
:inherited-members:
17+
:members:
18+
:member-order: bysource
19+
```
20+
1121
## Data
1222

1323
```{eval-rst}
@@ -48,10 +58,10 @@
4858
:member-order: bysource
4959
```
5060

51-
## Parsing
61+
## Historic
5262

5363
```{eval-rst}
54-
.. automodule:: nautilus_trader.adapters.betfair.parsing
64+
.. automodule:: nautilus_trader.adapters.betfair.historic
5565
:show-inheritance:
5666
:inherited-members:
5767
:members:
@@ -78,12 +88,3 @@
7888
:member-order: bysource
7989
```
8090

81-
## Utility
82-
83-
```{eval-rst}
84-
.. automodule:: nautilus_trader.adapters.betfair.util
85-
:show-inheritance:
86-
:inherited-members:
87-
:members:
88-
:member-order: bysource
89-
```

docs/api_reference/backtest.md

-24
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,6 @@
1212
:member-order: bysource
1313
```
1414

15-
```{eval-rst}
16-
.. automodule:: nautilus_trader.backtest.data.loaders
17-
:show-inheritance:
18-
:inherited-members:
19-
:members:
20-
:member-order: bysource
21-
```
22-
23-
```{eval-rst}
24-
.. automodule:: nautilus_trader.backtest.data.providers
25-
:show-inheritance:
26-
:inherited-members:
27-
:members:
28-
:member-order: bysource
29-
```
30-
31-
```{eval-rst}
32-
.. automodule:: nautilus_trader.backtest.data.wranglers
33-
:show-inheritance:
34-
:inherited-members:
35-
:members:
36-
:member-order: bysource
37-
```
38-
3915
```{eval-rst}
4016
.. automodule:: nautilus_trader.backtest.data_client
4117
:show-inheritance:

docs/api_reference/persistence.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,23 @@
55
```
66

77
```{eval-rst}
8-
.. automodule:: nautilus_trader.persistence.external.core
8+
.. automodule:: nautilus_trader.persistence.catalog.base
9+
:show-inheritance:
10+
:inherited-members:
11+
:members:
12+
:member-order: bysource
13+
```
14+
15+
```{eval-rst}
16+
.. automodule:: nautilus_trader.persistence.catalog.parquet
17+
:show-inheritance:
18+
:inherited-members:
19+
:members:
20+
:member-order: bysource
21+
```
22+
23+
```{eval-rst}
24+
.. automodule:: nautilus_trader.persistence.wranglers
925
:show-inheritance:
1026
:inherited-members:
1127
:members:
@@ -21,23 +37,23 @@
2137
```
2238

2339
```{eval-rst}
24-
.. automodule:: nautilus_trader.persistence.batching
40+
.. automodule:: nautilus_trader.persistence.streaming.batching
2541
:show-inheritance:
2642
:inherited-members:
2743
:members:
2844
:member-order: bysource
2945
```
3046

3147
```{eval-rst}
32-
.. automodule:: nautilus_trader.persistence.catalog
48+
.. automodule:: nautilus_trader.persistence.streaming.engine
3349
:show-inheritance:
3450
:inherited-members:
3551
:members:
3652
:member-order: bysource
3753
```
3854

3955
```{eval-rst}
40-
.. automodule:: nautilus_trader.persistence.streaming
56+
.. automodule:: nautilus_trader.persistence.streaming.writer
4157
:show-inheritance:
4258
:inherited-members:
4359
:members:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/user_guide/core_concepts.md docs/concepts/index.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
# Core Concepts
1+
# Concepts
2+
3+
```{eval-rst}
4+
.. toctree::
5+
:maxdepth: 1
6+
:glob:
7+
:titlesonly:
8+
:hidden:
9+
10+
architecture.md
11+
strategies.md
12+
instruments.md
13+
adapters.md
14+
orders.md
15+
logging.md
16+
advanced/index.md
17+
```
18+
19+
Welcome to NautilusTrader!
20+
21+
It's important to note that the [API Reference](../api_reference/index.md) documentation should be
22+
considered the source of truth for the platform. If there are any discrepancies between concepts described here
23+
and the API Reference, then the API Reference should be considered the correct information. We are
24+
working to ensure that concepts stay up-to-date with the API Reference and will be introducing
25+
doc tests in the near future to help with this.
26+
27+
```{note}
28+
The terms "NautilusTrader", "Nautilus" and "platform" are used interchageably throughout the documentation.
29+
```
230

331
There are three main use cases for this software package:
432

@@ -106,3 +134,4 @@ The following order types are available (when possible on an exchange);
106134
- `LIMIT_IF_TOUCHED`
107135
- `TRAILING_STOP_MARKET`
108136
- `TRAILING_STOP_LIMIT`
137+
File renamed without changes.

0 commit comments

Comments
 (0)