Repository navigation
Asset classes
The framework core never assumes a particular asset class. Anything that differs between asset classes is supplied by an asset-class plug-in, the same way Data sources supply raw data.
A plug-in is an asset profile (AssetProfile), keyed by nautilus's own classification: an AssetClass + InstrumentClass pair. Every nautilus instrument carries both (instrument.asset_class, instrument.instrument_class); a CryptoPerpetual is CRYPTOCURRENCY / SWAP. asset_profile(asset_class, instrument_class) looks a profile up, and profile.covers(instrument) checks an instrument against it. There are no sbt2-made names for asset classes.
| An asset class defines | Used by | Example (crypto perps) |
|---|---|---|
Key: nautilus AssetClass + InstrumentClass
|
venue profiles (Spec), Run (pre-flight check) |
CRYPTOCURRENCY / SWAP
|
| Nautilus instrument type | Data (ingest) | CryptoPerpetual |
| Trading calendar | Run (coverage checks, equity sampling), Results (annualization) | 24/7 |
| Annualization basis |
Results metrics, as nautilus's period (default 252) |
365 days |
| Carry | Run: nautilus-native settlement, or a custom carry module where nautilus has none | funding, native in nautilus |
| Margin and liquidation defaults | venue profiles (Spec) | leveraged margin, liquidation off (nautilus liquidates only on quotes) |
| Reference prices needed | Data (download), carry, valuation, benchmarks | mark price |
| Valuation price |
Run: nautilus portfolio valuation (PortfolioConfig.use_mark_prices), recorded in its equity snapshots; Results benchmarks |
mark price |
Buy-and-hold convention (BuyAndHoldConvention: the price series held, its carry, the entry fee) |
Results benchmarks | mark price, no funding, the taker rate of the run's venue fee model on entry |
One run uses one asset class and one settlement currency. The run's asset profile is named by its venue profile with nautilus enum names (see Spec); pre-flight checks every instrument's own asset_class and instrument_class against it. Different asset classes run as separate backtests, never mixed in one account.
Some costs aren't trades: funding on perps, rollover on FX, swaps on CFDs, borrow fees and dividends on equities. They must appear in equity, PnL and every metric.
Nautilus first. v2 settles perp funding in its simulated venue, and ships FXRolloverInterestModule and CfdSwapModule for FX and CFDs. An asset class uses those as they are, each added as a modules kind.
A custom carry module only for a real gap (e.g. equity borrow fees): a nautilus SimulationModule written in Python, the hook nautilus's own FX and CFD modules use. It reads its inputs from the data streamed with the run and returns the balance adjustments; it also keeps its own payment records for the carry ledger. A venue profile reaches it, like nautilus's own modules, as a modules kind (see Spec).
The carry ledger lists every carry payment so reports can break costs down. For native funding it is read from nautilus's PositionAdjusted (Funding) events. The asset class's page describes its carry, e.g. Crypto perpetuals.
| Asset class | Status | Page |
|---|---|---|
| Crypto perpetuals | first | Crypto perpetuals |
Design
- Architecture
- Library
- C4 model
- Glossary
- Decisions
- Deferred
- Quality
- Lessons from v1
- Paper extraction
- References
Plug-ins
First use case
Modules