ConceptsData
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.
Bar
Bar represents OHLCV price and volume data for a specific BarType. Bars can be
provided externally by a venue or data provider, aggregated internally from quote or
trade ticks, or aggregated from smaller bars.
Fields
| Field | Rust type | Python type | Required/default | Notes |
|---|---|---|---|---|
bar_type | BarType | BarType | Required | Instrument, aggregation, price type, and source. |
open | Price | Price | Required | First price in the bar interval. |
high | Price | Price | Required | Highest price in the bar interval. |
low | Price | Price | Required | Lowest price in the bar interval. |
close | Price | Price | Required | Last price in the bar interval. |
volume | Quantity | Quantity | Required | Traded volume or tick‑volume proxy. |
ts_event | UnixNanos | int | Required | Bar event timestamp in nanoseconds. |
ts_init | UnixNanos | int | Required | Initialization timestamp in nanoseconds. |
Behavior
highmust be greater than or equal toopen,low, andclose.lowmust be less than or equal toopenandclose.bar_typedetermines whether a bar is internal or external.- Composite bar types use
@syntax to identify the source bar type.
Example
use nautilus_core::UnixNanos;
use nautilus_model::{
data::{Bar, BarType},
types::{Price, Quantity},
};
let bar = Bar::new(
BarType::from("AUD/USD.SIM-1-MINUTE-LAST-EXTERNAL"),
Price::from("0.65000"),
Price::from("0.65010"),
Price::from("0.64990"),
Price::from("0.65005"),
Quantity::from("1000000"),
UnixNanos::from(1_000_000_000),
UnixNanos::from(1_000_000_100),
);Related guides
- Bars and aggregation covers aggregation methods.
- Bar types explains
BarTypestring syntax. - Python API Reference lists Python members.
TradeTick
TradeTick represents one executed trade or match event from a venue. It carries the traded price, traded size, aggressor side, and venue trade identifier.
MarkPriceUpdate
MarkPriceUpdate represents the current mark price for an instrument. Venues use mark prices most often for derivatives margining, liquidation checks, and...