Skip to main content

Crate nanobook_rebalancer

Crate nanobook_rebalancer 

Source
Expand description

nanobook-rebalancer: Portfolio rebalancer bridging nanobook to Interactive Brokers.

Reads target weights from a JSON file, connects to IBKR for live positions and prices, computes the diff, and executes limit orders with risk checks and an audit trail.

Modules§

audit
JSONL audit trail logging.
broker
Broker abstraction used by rebalancer execution.
clock_skew
Clock skew detection for audit log integrity.
config
TOML configuration loading and validation.
diff
CURRENT→TARGET diff engine.
error
Error types for the rebalancer.
execution
Execution orchestrator: diff → confirm → execute → reconcile.
kill
Kill switch: send SIGTERM to running runner and verify no dangling orders.
observability
Structured tracing setup for the rebalancer CLI.
pid_file
PID file management for the kill switch.
reconcile
Post-execution reconciliation: compare actual positions vs target.
recovery
Crash recovery and state reconstruction from audit logs.
risk
Pre-trade risk checks.
target
Target portfolio specification (target.json) loading and validation.
validator
Startup validation helpers for production-safe rebalancer runs.