Skip to main content

nyrobrain

Nyrobrain Python libraries.

  • nyrobrain.execution — translates portfolio signals (a target weight per symbol) into orders at the exchange, on top of nautilus_trader.

What it is for

A portfolio says hold 25% of the book in BTC. Something has to turn that into orders, against whatever is already held and whatever is already working, and keep doing it as the price moves and the target changes — without ever buying past the target. That last clause is the whole library. The failure it exists to prevent is an OMS that re-sends a delta it has already sent and walks a position away from its target.

You write the driver

The library does not ship one. It ships the executor, the guards, the report and the pieces that are dangerous to get wrong; assembling them into a running system is your code, because that is where your choices live.

Start from examples/oms.py — one script, three modes, copy it and change it:

python oms.py --mode backtest --signals signals.jsonl --candles ~/candles
python oms.py --mode paper --minutes 10
python oms.py --mode live  --minutes 10 --environment demo

The executor, the guards and the report are identical in all three. That is the point: a difference in behaviour between two modes is the venue, not the harness.

Two surfaces

Decisions — nyrobrain.execution. Sizing, the delta, the guards, the placement protocol. Imports no nautilus and installs without it, so you can reason about a target without an engine in the process. A placement strategy you write never imports nautilus either.

Assembly — nyrobrain.execution.driver, .backtest, .credentials, .venue, .runner, .report. Nautilus all the way through, because building a node cannot be anything else.

Examples

Runnable, shipped in the package, and executed by the test suite so they cannot rot. Read them in order:

python -m nyrobrain.execution.examples.sizing_a_target       # weight -> target -> delta
python -m nyrobrain.execution.examples.over_delivery_guard   # the invariant, and what it refuses
python -m nyrobrain.execution.examples.your_own_placement    # a placement strategy, no venue needed

Then examples/README.md for the driver itself.

Local development

uv sync --all-extras
uv run pytest

soak is ours rather than yours — a long-run diagnostic for validating the executor over hours, not part of the driver story:

uv run python -m nyrobrain.execution.soak --hours 3 --environment demo

Design maps

Built with the wayfinder method: numbered decision tickets under a map, worked one at a time. Each records not just what was decided but what was measured to decide it.

Metadata

Release files for nyrobrain 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nyrobrain 0.10.0
File Size Uploaded
nyrobrain-0.10.0.tar.gz 523.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nyrobrain 0.10.0
File Interpreter ABI Platform
nyrobrain-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 738.0 kB

Release files / nyrobrain-0.10.0.tar.gz

Download URL nyrobrain-0.10.0.tar.gz
Size 523.9 kB
Tags Source
SHA-256 checksum
How to use checksums
23a918e09667a3b84547fd0ced98e8e04ade799ec1b287a2686949cab6902e4e
BLAKE2b-256 checksum
How to use checksums
b803c295389cff0e3671293780cbab934d6a0af20bc13cc9875782a111dc3e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nyrobrain-0.10.0-py3-none-any.whl

Download URL nyrobrain-0.10.0-py3-none-any.whl
Size 214.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c0c4c0e78fc9f7e775a791347ccd75c8d77bb437737f0fcfe2b981455babdb6
BLAKE2b-256 checksum
How to use checksums
08fc801668a2b985ae96103e14feb16a4fb294aeaba03b9dcc323b0bb3d997f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.3

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page