Skip to main content

Crate nautilus_portfolio

Crate nautilus_portfolio 

Source
Expand description

Portfolio management and risk analysis for NautilusTrader.

The nautilus-portfolio crate provides portfolio management capabilities including real-time position tracking, performance calculations, and risk management. This includes sophisticated portfolio analytics and multi-currency support:

  • Portfolio tracking: Real-time portfolio state management with position and balance monitoring.
  • Account management: Support for cash and margin accounts across multiple venues.
  • Performance calculations: Real-time unrealized PnL, realized PnL, and mark-to-market valuations.
  • Risk management: Initial margin calculations, maintenance margin tracking, and exposure monitoring.
  • Multi-currency support: Currency conversion and cross-currency risk exposure analysis.
  • Configuration options: Flexible settings for price types, currency conversion, and portfolio behavior.

The crate handles complex portfolio scenarios including multi-venue trading, currency conversions, and sophisticated margin calculations for both live trading and backtesting environments.

§NautilusTrader

NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset, multi-venue trading systems.

The system spans research, deterministic simulation, and live execution within a single event-driven architecture, providing research-to-live semantic parity.

§Feature Flags

This crate provides feature flags to control source code inclusion during compilation, depending on the intended use case, i.e. whether to provide Python bindings for the nautilus_trader Python package, or as part of a Rust only build.

  • python: Enables Python bindings from PyO3.
  • extension-module: Builds the crate as a Python extension module.

Re-exports§

pub use portfolio::Portfolio;

Modules§

config
manager
Provides account management functionality.
portfolio
Provides a generic Portfolio for all environments.
python
Python bindings from PyO3.