Skip to content

Commit

Permalink
Release 1.171.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
cjdsellers authored Mar 30, 2023
2 parents afdf8d9 + c09984e commit 68c2e56
Show file tree
Hide file tree
Showing 175 changed files with 3,553 additions and 1,822 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.git/
**/.pack

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down Expand Up @@ -200,4 +203,4 @@ cython_debug/

# Nautilus
docs/
tests/
tests/
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
arch: [x64]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10"]
name: build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
.idea/
.ipynb_checkpoints
.mypy_cache/
.nox/
.profile/
.pytest_cache/
.python-version
.ruff_cache/
.vscode/

__pycache__
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: check-yaml

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
description: Checks for common misspellings.
Expand Down Expand Up @@ -84,7 +84,7 @@ repos:
args: ["--settings-file", "pyproject.toml", "."]

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
rev: v1.1.1
hooks:
- id: mypy
args: [
Expand All @@ -111,7 +111,7 @@ repos:
]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
rev: v0.0.260
hooks:
- id: ruff

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

| Platform | Rust | Python |
|:------------------|:----------|:-------|
| Linux (x86\_64) | `1.68.0+` | `3.9+` |
| macOS (x86\_64) | `1.68.0+` | `3.9+` |
| Windows (x86\_64) | `1.68.0+` | `3.9+` |
| Linux (x86\_64) | `1.68.2+` | `3.9+` |
| macOS (x86\_64) | `1.68.2+` | `3.9+` |
| Windows (x86\_64) | `1.68.2+` | `3.9+` |

- **Website:** https://nautilustrader.io
- **Docs:** https://docs.nautilustrader.io
Expand Down
23 changes: 23 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# NautilusTrader 1.171.0 Beta

Released on 30th March 2023 (UTC).

### Breaking Changes
- Renamed all position `net_qty` fields and parameters to `signed_qty` (more accurate naming)
- `NautilusKernelConfig` removed all `log_*` config options (replaced by `logging` with `LoggingConfig`)
- Trading `CurrencyPair` instruments with a _single-currency_ `CASH` account type no longer permitted (unrealistic)
- Changed `PositionEvent` parquet schemas (renamed `net_qty` field to `signed_qty`)

### Enhancements
- Added `LoggingConfig` to consolidate logging configs, offering various file options and per component level filters
- Added `BacktestVenueConfig.bar_execution` to control whether bar data moves the matching engine markets (reinstated)
- Added optional `request_id` for actor data requests (aids processing responses), thanks @rsmb7z
- Added `Position.signed_decimal_qty()`
- Now using above signed quantity for `Portfolio` net position calculation, and `LiveExecutionEngine` reconciliation comparisons

### Fixes
- Fixed `BacktestEngine` clock and logger handling (had a redundant extra logger and not swapping live clock in post run)
- Fixed `close_position` order event publishing and cache persistence for `MarketOrder` and `SubmitOrder`, thanks for reporting @rsmb7z

---

# NautilusTrader 1.170.0 Beta

Released on 11th March 2023 (UTC).
Expand Down
40 changes: 18 additions & 22 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@
os.environ["CC"] = "clang"
os.environ["LDSHARED"] = "clang -shared"

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

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

# Directories with headers to include
RUST_INCLUDES = ["nautilus_trader/core/includes"]
RUST_LIBS = [
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_common.{RUST_STATIC_LIB_EXT}",
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_core.{RUST_STATIC_LIB_EXT}",
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_model.{RUST_STATIC_LIB_EXT}",
f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_persistence.{RUST_STATIC_LIB_EXT}",
RUST_LIB_PATHS: list[Path] = [
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_common.{RUST_STATIC_LIB_EXT}",
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_core.{RUST_STATIC_LIB_EXT}",
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_model.{RUST_STATIC_LIB_EXT}",
TARGET_DIR / f"{RUST_LIB_PFX}nautilus_persistence.{RUST_STATIC_LIB_EXT}",
]
RUST_LIBS: list[str] = [str(path) for path in RUST_LIB_PATHS]


def _build_rust_libs() -> None:
try:
# Build the Rust libraries using Cargo
build_options = ""
build_options = " --release" if BUILD_MODE == "release" else ""
extra_flags = ""
if platform.system() == "Windows":
extra_flags = " --target x86_64-pc-windows-msvc"

build_options += " --release" if BUILD_MODE == "release" else ""
print("Compiling Rust libraries...")
build_cmd = f"(cd nautilus_core && cargo build{build_options}{extra_flags} --all-features)"
print(build_cmd)
os.system(build_cmd) # noqa
os.system(build_cmd)
except subprocess.CalledProcessError as e:
raise RuntimeError(
f"Error running cargo: {e.stderr.decode()}",
Expand Down Expand Up @@ -159,7 +155,7 @@ def _build_extensions() -> list[Extension]:
Extension(
name=str(pyx.relative_to(".")).replace(os.path.sep, ".")[:-4],
sources=[str(pyx)],
include_dirs=[np.get_include()] + RUST_INCLUDES,
include_dirs=[np.get_include(), *RUST_INCLUDES],
define_macros=define_macros,
language="c",
extra_link_args=extra_link_args,
Expand Down Expand Up @@ -194,24 +190,24 @@ def _build_distribution(extensions: list[Extension]) -> Distribution:
def _copy_build_dir_to_project(cmd: build_ext) -> None:
# Copy built extensions back to the project tree
for output in cmd.get_outputs():
relative_extension = os.path.relpath(output, cmd.build_lib)
if not os.path.exists(output):
relative_extension = Path(output).relative_to(cmd.build_lib)
if not Path(output).exists():
continue

# Copy the file and set permissions
shutil.copyfile(output, relative_extension)
mode = os.stat(relative_extension).st_mode
mode = relative_extension.stat().st_mode
mode |= (mode & 0o444) >> 2
os.chmod(relative_extension, mode)
relative_extension.chmod(mode)

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


def _copy_rust_dylibs_to_project() -> None:
# https://pyo3.rs/latest/building_and_distribution#manual-builds
ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
src = f"{TARGET_DIR}/{RUST_LIB_PFX}nautilus_pyo3.{RUST_DYLIB_EXT}"
dst = f"nautilus_trader/core/nautilus_pyo3{ext_suffix}"
src = Path(TARGET_DIR) / f"{RUST_LIB_PFX}nautilus_pyo3.{RUST_DYLIB_EXT}"
dst = Path("nautilus_trader/core") / f"nautilus_pyo3{ext_suffix}"
shutil.copyfile(src=src, dst=dst)

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


def build() -> None:
"""Construct the extensions and distribution.""" # noqa
"""Construct the extensions and distribution."""
_build_rust_libs()
_copy_rust_dylibs_to_project()

Expand Down
23 changes: 12 additions & 11 deletions docs/api_reference/adapters/betfair.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
:member-order: bysource
```

## Config

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

## Data

```{eval-rst}
Expand Down Expand Up @@ -48,10 +58,10 @@
:member-order: bysource
```

## Parsing
## Historic

```{eval-rst}
.. automodule:: nautilus_trader.adapters.betfair.parsing
.. automodule:: nautilus_trader.adapters.betfair.historic
:show-inheritance:
:inherited-members:
:members:
Expand All @@ -78,12 +88,3 @@
:member-order: bysource
```

## Utility

```{eval-rst}
.. automodule:: nautilus_trader.adapters.betfair.util
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```
24 changes: 0 additions & 24 deletions docs/api_reference/backtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,6 @@
:member-order: bysource
```

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

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

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

```{eval-rst}
.. automodule:: nautilus_trader.backtest.data_client
:show-inheritance:
Expand Down
24 changes: 20 additions & 4 deletions docs/api_reference/persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.external.core
.. automodule:: nautilus_trader.persistence.catalog.base
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.catalog.parquet
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.wranglers
:show-inheritance:
:inherited-members:
:members:
Expand All @@ -21,23 +37,23 @@
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.batching
.. automodule:: nautilus_trader.persistence.streaming.batching
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.catalog
.. automodule:: nautilus_trader.persistence.streaming.engine
:show-inheritance:
:inherited-members:
:members:
:member-order: bysource
```

```{eval-rst}
.. automodule:: nautilus_trader.persistence.streaming
.. automodule:: nautilus_trader.persistence.streaming.writer
:show-inheritance:
:inherited-members:
:members:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 30 additions & 1 deletion docs/user_guide/core_concepts.md → docs/concepts/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
# Core Concepts
# Concepts

```{eval-rst}
.. toctree::
:maxdepth: 1
:glob:
:titlesonly:
:hidden:
architecture.md
strategies.md
instruments.md
adapters.md
orders.md
logging.md
advanced/index.md
```

Welcome to NautilusTrader!

It's important to note that the [API Reference](../api_reference/index.md) documentation should be
considered the source of truth for the platform. If there are any discrepancies between concepts described here
and the API Reference, then the API Reference should be considered the correct information. We are
working to ensure that concepts stay up-to-date with the API Reference and will be introducing
doc tests in the near future to help with this.

```{note}
The terms "NautilusTrader", "Nautilus" and "platform" are used interchageably throughout the documentation.
```

There are three main use cases for this software package:

Expand Down Expand Up @@ -106,3 +134,4 @@ The following order types are available (when possible on an exchange);
- `LIMIT_IF_TOUCHED`
- `TRAILING_STOP_MARKET`
- `TRAILING_STOP_LIMIT`

File renamed without changes.
Loading

0 comments on commit 68c2e56

Please sign in to comment.