Data
class Bar
Bases: Data
Bar(BarType bar_type, Price open, Price high, Price low, Price close, Quantity volume, uint64_t ts_event, uint64_t ts_init, bool is_revision=False) -> None
Represents an aggregated bar.
- Parameters:
- bar_type (BarType) – The bar type for this bar.
- open (Price) – The bars open price.
- high (Price) – The bars high price.
- low (Price) – The bars low price.
- close (Price) – The bars close price.
- volume (Quantity) – The bars volume.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- is_revision (bool , default False) – If this bar is a revision of a previous bar with the same ts_event.
- Raises:
- ValueError – If high is not >= low.
- ValueError – If high is not >= close.
- ValueError – If low is not <= close.
bar_type
BarType
Return the bar type of bar.
- Return type: BarType
- Type: Bar.bar_type
close
Price
Return the close price of the bar.
- Return type: Price
- Type: Bar.close
static from_dict(dict values)
Return a bar parsed from the given values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: Bar
static from_pyo3(pyo3_bar)
Return a legacy Cython bar converted from the given pyo3 Rust object.
- Parameters: pyo3_bar (nautilus_pyo3.Bar) – The pyo3 Rust bar to convert from.
- Return type: Bar
static from_pyo3_list(list pyo3_bars)
Return legacy Cython bars converted from the given pyo3 Rust objects.
- Parameters: pyo3_bars (list *[*nautilus_pyo3.Bar ]) – The pyo3 Rust bars to convert from.
- Return type: list[Bar]
static from_raw(BarType bar_type, int64_t open, int64_t high, int64_t low, int64_t close, uint8_t price_prec, uint64_t volume, uint8_t size_prec, uint64_t ts_event, uint64_t ts_init)
static from_raw_arrays_to_list(BarType bar_type, uint8_t price_prec, uint8_t size_prec, int64_t[:] opens, int64_t[:] highs, int64_t[:] lows, int64_t[:] closes, uint64_t[:] volumes, uint64_t[:] ts_events, uint64_t[:] ts_inits)
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
high
Price
Return the high price of the bar.
- Return type: Price
- Type: Bar.high
is_revision
If this bar is a revision for a previous bar with the same ts_event.
- Returns: bool
is_single_price(self)
If the OHLC are all equal to a single price.
- Return type: bool
low
Price
Return the low price of the bar.
- Return type: Price
- Type: Bar.low
open
Price
Return the open price of the bar.
- Return type: Price
- Type: Bar.open
static to_dict(Bar obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
to_pyo3(self)
Return a pyo3 object from this legacy Cython instance.
- Return type: nautilus_pyo3.Bar
static to_pyo3_list(list bars)
Return pyo3 Rust bars converted from the given legacy Cython objects.
- Parameters: bars (list [Bar ]) – The legacy Cython bars to convert from.
- Return type: list[nautilus_pyo3.Bar]
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: Bar.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: Bar.ts_init
volume
Quantity
Return the volume of the bar.
- Return type: Quantity
- Type: Bar.volume
class BarAggregation
Bases: IntFlag
conjugate()
Returns self, the complex conjugate of any int.
bit_length()
Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)
Return an array of bytes representing an integer.
length : Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
byteorder
: The byte order used to represent the integer. If byteorder is ‘big’,
the most significant byte is at the beginning of the byte array. If
byteorder is ‘little’, the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`
sys.byteorder’ as the byte order value. Default is to use ‘big’.
signed : Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
from_bytes(byteorder='big', *, signed=False)
Return the integer represented by the given array of bytes.
bytes : Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
byteorder
: The byte order used to represent the integer. If byteorder is ‘big’,
the most significant byte is at the beginning of the byte array. If
byteorder is ‘little’, the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`
sys.byteorder’ as the byte order value. Default is to use ‘big’.
signed : Indicates whether two’s complement is used to represent the integer.
as_integer_ratio()
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
real
the real part of a complex number
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
denominator
the denominator of a rational number in lowest terms
TICK = 1
TICK_IMBALANCE = 2
TICK_RUNS = 3
VOLUME = 4
VOLUME_IMBALANCE = 5
VOLUME_RUNS = 6
VALUE = 7
VALUE_IMBALANCE = 8
VALUE_RUNS = 9
MILLISECOND = 10
SECOND = 11
MINUTE = 12
HOUR = 13
DAY = 14
WEEK = 15
MONTH = 16
class BarSpecification
Bases: object
BarSpecification(int step, BarAggregation aggregation, PriceType price_type) -> None
Represents a bar aggregation specification including a step, aggregation method/rule and price type.
- Parameters:
- step (int) – The step for binning samples for bar aggregation (> 0).
- aggregation (BarAggregation) – The type of bar aggregation.
- price_type (PriceType) – The price type to use for aggregation.
- Raises: ValueError – If step is not positive (> 0).
aggregation
BarAggregation
Return the aggregation for the specification.
- Return type: BarAggregation
- Type: BarSpecification.aggregation
static check_information_aggregated(BarAggregation aggregation)
Check the given aggregation is a type of information aggregation.
- Parameters: aggregation (BarAggregation) – The aggregation type to check.
- Returns: True if information aggregated, else False.
- Return type: bool
static check_threshold_aggregated(BarAggregation aggregation)
Check the given aggregation is a type of threshold aggregation.
- Parameters: aggregation (BarAggregation) – The aggregation type to check.
- Returns: True if threshold aggregated, else False.
- Return type: bool
static check_time_aggregated(BarAggregation aggregation)
Check the given aggregation is a type of time aggregation.
- Parameters: aggregation (BarAggregation) – The aggregation type to check.
- Returns: True if time aggregated, else False.
- Return type: bool
static from_str(unicode value)
Return a bar specification parsed from the given string.
-
Parameters: value (str) – The bar specification string to parse.
-
Return type: BarSpecification
-
Raises: ValueError – If value is not a valid string.
static from_timedelta(timedelta duration, PriceType price_type)
Return a bar specification parsed from the given timedelta and price_type.
-
Parameters:
- duration (timedelta) – The bar specification timedelta to parse.
- price_type (PriceType) – The bar specification price_type.
-
Return type: BarSpecification
-
Raises: ValueError – If duration is not rounded step of aggregation.
is_information_aggregated(self)
Return a value indicating whether the aggregation method is information-driven.
TICK_RUNS
VOLUME_RUNS
VALUE_RUNS
- Return type: bool
is_threshold_aggregated(self)
Return a value indicating whether the bar aggregation method is threshold-driven.
TICK
TICK_IMBALANCE
VOLUME
VOLUME_IMBALANCE
VALUE
VALUE_IMBALANCE
- Return type: bool
is_time_aggregated(self)
Return a value indicating whether the aggregation method is time-driven.
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
- Return type: bool
price_type
PriceType
Return the price type for the specification.
- Return type: PriceType
- Type: BarSpecification.price_type
step
int
Return the step size for the specification.
- Return type: int
- Type: BarSpecification.step
timedelta
timedelta
Return the timedelta for the specification.
- Return type: timedelta
- Raises: ValueError – If aggregation is not a time aggregation, or is``MONTH`` (which is ambiguous).
- Type: BarSpecification.timedelta
class BarType
Bases: object
BarType(InstrumentId instrument_id, BarSpecification bar_spec, AggregationSource aggregation_source=AggregationSource.EXTERNAL) -> None
Represents a bar type including the instrument ID, bar specification and aggregation source.
- Parameters:
- instrument_id (InstrumentId) – The bar types instrument ID.
- bar_spec (BarSpecification) – The bar types specification.
- aggregation_source (AggregationSource , default EXTERNAL) – The bar type aggregation source. If
INTERNAL
the DataEngine will subscribe to the necessary ticks and aggregate bars accordingly. Else ifEXTERNAL
then bars will be subscribed to directly from the venue / data provider.
aggregation_source
AggregationSource
Return the aggregation source for the bar type.
- Return type: AggregationSource
- Type: BarType.aggregation_source
static from_str(unicode value)
Return a bar type parsed from the given string.
- Parameters: value (str) – The bar type string to parse.
- Return type: BarType
- Raises: ValueError – If value is not a valid string.
instrument_id
InstrumentId
Return the instrument ID for the bar type.
- Return type: InstrumentId
- Type: BarType.instrument_id
is_externally_aggregated(self)
Return a value indicating whether the bar aggregation source is EXTERNAL
.
- Return type: bool
is_internally_aggregated(self)
Return a value indicating whether the bar aggregation source is INTERNAL
.
- Return type: bool
spec
BarSpecification
Return the specification for the bar type.
- Return type: BarSpecification
- Type: BarType.spec
class BookOrder
Bases: object
BookOrder(OrderSide side, Price price, Quantity size, uint64_t order_id) -> None
Represents an order in a book.
- Parameters:
exposure(self)
Return the total exposure for this order (price * size).
- Return type: double
static from_dict(dict values)
Return an order from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: BookOrder
static from_raw(OrderSide side, int64_t price_raw, uint8_t price_prec, uint64_t size_raw, uint8_t size_prec, uint64_t order_id)
Return an book order from the given raw values.
- Parameters:
- side (OrderSide {
BUY
,SELL
}) – The order side. - price_raw (int64_t) – The order raw price (as a scaled fixed precision integer).
- price_prec (uint8_t) – The order price precision.
- size_raw (uint64_t) – The order raw size (as a scaled fixed precision integer).
- size_prec (uint8_t) – The order size precision.
- order_id (uint64_t) – The order ID.
- side (OrderSide {
- Return type: BookOrder
order_id
uint64_t
Return the book orders side.
- Return type: uint64_t
- Type: BookOrder.order_id
price
Price
Return the book orders price.
- Return type: Price
- Type: BookOrder.price
side
OrderSide
Return the book orders side.
- Return type: OrderSide
- Type: BookOrder.side
signed_size(self)
Return the signed size of the order (negative for SELL
).
- Return type: double
size
Price
Return the book orders size.
- Return type: Quantity
- Type: BookOrder.size
static to_dict(BookOrder obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
class CustomData
Bases: Data
CustomData(DataType data_type, Data data) -> None
Provides a wrapper for custom data which includes data type information.
- Parameters:
- data_type (DataType) – The data type.
- data (Data) – The data object to wrap.
data
The data.
- Returns: Data
data_type
The data type.
- Returns: DataType
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: CustomData.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: CustomData.ts_init
class DataType
Bases: object
DataType(type type, dict metadata=None) -> None
Represents a data type including metadata.
- Parameters:
- type (type) – The Data type of the data.
- metadata (dict) – The data types metadata.
- Raises:
- ValueError – If type is not either a subclass of Data or meets the Data contract.
- TypeError – If metadata contains a key or value which is not hashable.
WARNING
This class may be used as a key in hash maps throughout the system, thus the key and value contents of metadata must themselves be hashable.
metadata
The data types metadata.
- Returns: dict[str, object]
topic
The data types topic string.
- Returns: str
type
The Data type of the data.
- Returns: type
class InstrumentClose
Bases: Data
InstrumentClose(InstrumentId instrument_id, Price close_price, InstrumentCloseType close_type, uint64_t ts_event, uint64_t ts_init) -> None
Represents an instrument close at a venue.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID.
- close_price (Price) – The closing price for the instrument.
- close_type (InstrumentCloseType) – The type of closing price.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the close price event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
close_price
The instrument close price.
- Returns: Price
close_type
The instrument close type.
- Returns: InstrumentCloseType
static from_dict(dict values)
Return an instrument close price event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: InstrumentClose
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
The event instrument ID.
- Returns: InstrumentId
static to_dict(InstrumentClose obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
ts_event
UNIX timestamp (nanoseconds) when the data event occurred.
- Returns: uint64_t
ts_init
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns: uint64_t
class InstrumentStatus
Bases: Data
InstrumentStatus(InstrumentId instrument_id, MarketStatus status, uint64_t ts_event, uint64_t ts_init, unicode trading_session=u’Regular’, HaltReason halt_reason=HaltReason.NOT_HALTED) -> None
Represents an event that indicates a change in an instrument market status.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID.
- status (MarketStatus) – The instrument market session status.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the status update event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- trading_session (str , default 'Regular') – The name of the trading session.
- halt_reason (HaltReason, default
NOT_HALTED
) – The halt reason (only applicable forHALT
status).
- Raises:
ValueError – If status is not equal to
HALT
and halt_reason is other thanNOT_HALTED
.
static from_dict(dict values)
Return an instrument status update from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: InstrumentStatus
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
halt_reason
The halt reason.
- Returns: HaltReason
instrument_id
The instrument ID.
- Returns: InstrumentId
status
The instrument market status.
- Returns: MarketStatus
static to_dict(InstrumentStatus obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trading_session
The trading session name.
- Returns: str
ts_event
UNIX timestamp (nanoseconds) when the data event occurred.
- Returns: uint64_t
ts_init
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns: uint64_t
class OrderBookDelta
Bases: Data
OrderBookDelta(InstrumentId instrument_id, BookAction action, BookOrder order: BookOrder | None, uint8_t flags, uint64_t sequence, uint64_t ts_event, uint64_t ts_init) -> None
Represents a single update/difference on an OrderBook.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the book.
- action (BookAction {
ADD
,UPDATE
,DELETE
,CLEAR
}) – The order book delta action. - order (BookOrder, optional with no default so
None
must be passed explicitly) – The book order for the delta. - flags (uint8_t) – The record flags bit field, indicating event end and data information. A value of zero indicates no flags.
- sequence (uint64_t) – The unique sequence number for the update. If no sequence number provided in the source data then use a value of zero.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
action
BookAction
Return the deltas book action {ADD
, UPDATE
, DELETE
, CLEAR
}
- Return type: BookAction
- Type: OrderBookDelta.action
static capsule_from_list(list items)
static clear(InstrumentId instrument_id, uint64_t sequence, uint64_t ts_event, uint64_t ts_init)
Return an order book delta which acts as an initial CLEAR
.
- Return type: OrderBookDelta
flags
uint8_t
Return the flags for the delta.
- Return type: uint8_t
- Type: OrderBookDelta.flags
static from_dict(dict values)
Return an order book delta from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderBookDelta
static from_pyo3(pyo3_delta)
Return a legacy Cython order book delta converted from the given pyo3 Rust object.
- Parameters: pyo3_delta (nautilus_pyo3.OrderBookDelta) – The pyo3 Rust order book delta to convert from.
- Return type: OrderBookDelta
static from_pyo3_list(list pyo3_deltas)
Return legacy Cython order book deltas converted from the given pyo3 Rust objects.
- Parameters: pyo3_deltas (list *[*nautilus_pyo3.OrderBookDelta ]) – The pyo3 Rust order book deltas to convert from.
- Return type: list[OrderBookDelta]
static from_raw(InstrumentId instrument_id, BookAction action, OrderSide side, int64_t price_raw, uint8_t price_prec, uint64_t size_raw, uint8_t size_prec, uint64_t order_id, uint8_t flags, uint64_t sequence, uint64_t ts_event, uint64_t ts_init)
Return an order book delta from the given raw values.
- Parameters:
- instrument_id (InstrumentId) – The trade instrument ID.
- action (BookAction {
ADD
,UPDATE
,DELETE
,CLEAR
}) – The order book delta action. - side (OrderSide {
BUY
,SELL
}) – The order side. - price_raw (int64_t) – The order raw price (as a scaled fixed precision integer).
- price_prec (uint8_t) – The order price precision.
- size_raw (uint64_t) – The order raw size (as a scaled fixed precision integer).
- size_prec (uint8_t) – The order size precision.
- order_id (uint64_t) – The order ID.
- flags (uint8_t) – The record flags bit field, indicating event end and data information. A value of zero indicates no flags.
- sequence (uint64_t) – The unique sequence number for the update. If no sequence number provided in the source data then use a value of zero.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Return type: OrderBookDelta
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
InstrumentId
Return the deltas book instrument ID.
- Return type: InstrumentId
- Type: OrderBookDelta.instrument_id
is_add
BookAction
If the deltas book action is an ADD
.
- Return type: bool
- Type: OrderBookDelta.is_add
is_clear
BookAction
If the deltas book action is a CLEAR
.
- Return type: bool
- Type: OrderBookDelta.is_clear
is_delete
BookAction
If the deltas book action is a DELETE
.
- Return type: bool
- Type: OrderBookDelta.is_delete
is_update
BookAction
If the deltas book action is an UPDATE
.
- Return type: bool
- Type: OrderBookDelta.is_update
static list_from_capsule(capsule)
order
BookOrder | None
Return the deltas book order for the action.
- Return type: BookOrder
- Type: OrderBookDelta.order
sequence
uint64_t
Return the sequence number for the delta.
- Return type: uint64_t
- Type: OrderBookDelta.sequence
static to_dict(OrderBookDelta obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
static to_pyo3_list(list deltas)
Return pyo3 Rust order book deltas converted from the given legacy Cython objects.
- Parameters: pyo3_deltas (list [OrderBookDelta ]) – The pyo3 Rust order book deltas to convert from.
- Return type: list[nautilus_pyo3.OrderBookDelta]
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: OrderBookDelta.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderBookDelta.ts_init
class OrderBookDeltas
Bases: Data
OrderBookDeltas(InstrumentId instrument_id, list deltas) -> None
Represents a grouped batch of OrderBookDelta updates for an OrderBook.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the book.
- deltas (list [OrderBookDelta ]) – The list of order book changes.
- Raises: ValueError – If deltas is an empty list.
deltas
list[OrderBookDelta]
Return the contained deltas.
- Return type: list[OrderBookDeltas]
- Type: OrderBookDeltas.deltas
flags
uint8_t
Return the flags for the last delta.
- Return type: uint8_t
- Type: OrderBookDeltas.flags
static from_dict(dict values)
Return order book deltas from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderBookDeltas
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
InstrumentId
Return the deltas book instrument ID.
- Return type: InstrumentId
- Type: OrderBookDeltas.instrument_id
is_snapshot
bool
If the deltas is a snapshot.
- Return type: bool
- Type: OrderBookDeltas.is_snapshot
sequence
uint64_t
Return the sequence number for the last delta.
- Return type: uint64_t
- Type: OrderBookDeltas.sequence
to_capsule(self)
static to_dict(OrderBookDeltas obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
to_pyo3(self)
Return a pyo3 object from this legacy Cython instance.
- Return type: nautilus_pyo3.OrderBookDeltas
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: OrderBookDeltas.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderBookDeltas.ts_init
class OrderBookDepth10
Bases: Data
OrderBookDepth10(InstrumentId instrument_id, list bids, list asks, list bid_counts, list ask_counts, uint8_t flags, uint64_t sequence, uint64_t ts_event, uint64_t ts_init) -> None
Represents a self-contained order book update with a fixed depth of 10 levels per side.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the book.
- bids (list [BookOrder ]) – The bid side orders for the update.
- asks (list [BookOrder ]) – The ask side orders for the update.
- bid_counts (list *[*uint32_t ]) – The count of bid orders per level for the update. Can be zeros if data not available.
- ask_counts (list *[*uint32_t ]) – The count of ask orders per level for the update. Can be zeros if data not available.
- flags (uint8_t) – The record flags bit field, indicating event end and data information. A value of zero indicates no flags.
- sequence (uint64_t) – The unique sequence number for the update. If no sequence number provided in the source data then use a value of zero.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Raises:
- ValueError – If bids is empty.
- ValueError – If asks is empty.
- ValueError – If bids length is not equal to 10.
- ValueError – If asks length is not equal to 10.
- ValueError – If bid_counts length is not equal to 10.
- ValueError – If ask_counts length is not equal to 10.
ask_counts
list[uint32_t]
Return the count of ask orders level for the update.
- Return type: list[uint32_t]
- Type: OrderBookDepth10.ask_counts
asks
list[BookOrder]
Return the ask orders for the update.
- Return type: list[BookOrder]
- Type: OrderBookDepth10.asks
bid_counts
list[uint32_t]
Return the count of bid orders per level for the update.
- Return type: list[uint32_t]
- Type: OrderBookDepth10.bid_counts
bids
list[BookOrder]
Return the bid orders for the update.
- Return type: list[BookOrder]
- Type: OrderBookDepth10.bids
static capsule_from_list(list items)
flags
uint8_t
Return the flags for the depth update.
- Return type: uint8_t
- Type: OrderBookDepth10.flags
static from_dict(dict values)
Return order book depth from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderBookDepth10
static from_pyo3(pyo3_depth)
Return a legacy Cython order book depth converted from the given pyo3 Rust object.
- Parameters: pyo3_depth (nautilus_pyo3.OrderBookDepth10) – The pyo3 Rust order book depth to convert from.
- Return type: OrderBookDepth10
static from_pyo3_list(pyo3_depths)
Return legacy Cython order book depths converted from the given pyo3 Rust objects.
- Parameters: pyo3_depths (nautilus_pyo3.OrderBookDepth10) – The pyo3 Rust order book depths to convert from.
- Return type: list[OrderBookDepth10]
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
InstrumentId
Return the depth updates book instrument ID.
- Return type: InstrumentId
- Type: OrderBookDepth10.instrument_id
static list_from_capsule(capsule)
sequence
uint64_t
Return the sequence number for the depth update.
- Return type: uint64_t
- Type: OrderBookDepth10.sequence
static to_dict(OrderBookDepth10 obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: OrderBookDepth10.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderBookDepth10.ts_init
class QuoteTick
Bases: Data
QuoteTick(InstrumentId instrument_id, Price bid_price, Price ask_price, Quantity bid_size, Quantity ask_size, uint64_t ts_event, uint64_t ts_init) -> None
Represents a single quote tick in a market.
Contains information about the best top of book bid and ask.
- Parameters:
- instrument_id (InstrumentId) – The quotes instrument ID.
- bid_price (Price) – The top of book bid price.
- ask_price (Price) – The top of book ask price.
- bid_size (Quantity) – The top of book bid size.
- ask_size (Quantity) – The top of book ask size.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Raises:
- ValueError – If bid.precision != ask.precision.
- ValueError – If bid_size.precision != ask_size.precision.
ask_price
Price
Return the top of book ask price.
- Return type: Price
- Type: QuoteTick.ask_price
ask_size
Quantity
Return the top of book ask size.
- Return type: Quantity
- Type: QuoteTick.ask_size
bid_price
Price
Return the top of book bid price.
- Return type: Price
- Type: QuoteTick.bid_price
bid_size
Quantity
Return the top of book bid size.
- Return type: Quantity
- Type: QuoteTick.bid_size
static capsule_from_list(list items)
extract_price(self, PriceType price_type)
Extract the price for the given price type.
- Parameters: price_type (PriceType) – The price type to extract.
- Return type: Price
extract_volume(self, PriceType price_type)
Extract the volume for the given price type.
- Parameters: price_type (PriceType) – The price type to extract.
- Return type: Quantity
static from_dict(dict values)
Return a quote tick parsed from the given values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: QuoteTick
static from_pyo3(pyo3_quote)
Return a legacy Cython quote tick converted from the given pyo3 Rust object.
- Parameters: pyo3_quote (nautilus_pyo3.QuoteTick) – The pyo3 Rust quote tick to convert from.
- Return type: QuoteTick
static from_pyo3_list(list pyo3_quotes)
Return legacy Cython quote ticks converted from the given pyo3 Rust objects.
- Parameters: pyo3_quotes (list *[*nautilus_pyo3.QuoteTick ]) – The pyo3 Rust quote ticks to convert from.
- Return type: list[QuoteTick]
static from_raw(InstrumentId instrument_id, int64_t bid_price_raw, int64_t ask_price_raw, uint8_t bid_price_prec, uint8_t ask_price_prec, uint64_t bid_size_raw, uint64_t ask_size_raw, uint8_t bid_size_prec, uint8_t ask_size_prec, uint64_t ts_event, uint64_t ts_init)
Return a quote tick from the given raw values.
- Parameters:
- instrument_id (InstrumentId) – The quotes instrument ID.
- bid_price_raw (int64_t) – The raw top of book bid price (as a scaled fixed precision integer).
- ask_price_raw (int64_t) – The raw top of book ask price (as a scaled fixed precision integer).
- bid_price_prec (uint8_t) – The bid price precision.
- ask_price_prec (uint8_t) – The ask price precision.
- bid_size_raw (uint64_t) – The raw top of book bid size (as a scaled fixed precision integer).
- ask_size_raw (uint64_t) – The raw top of book ask size (as a scaled fixed precision integer).
- bid_size_prec (uint8_t) – The bid size precision.
- ask_size_prec (uint8_t) – The ask size precision.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Return type: QuoteTick
- Raises:
- ValueError – If bid_price_prec != ask_price_prec.
- ValueError – If bid_size_prec != ask_size_prec.
static from_raw_arrays_to_list(InstrumentId instrument_id: InstrumentId, int price_prec: int, int size_prec: int, bid_prices_raw: np.ndarray, ask_prices_raw: np.ndarray, bid_sizes_raw: np.ndarray, ask_sizes_raw: np.ndarray, ts_events: np.ndarray, ts_inits: np.ndarray)
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
InstrumentId
Return the tick instrument ID.
- Return type: InstrumentId
- Type: QuoteTick.instrument_id
static list_from_capsule(capsule)
static to_dict(QuoteTick obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
to_pyo3(self)
Return a pyo3 object from this legacy Cython instance.
- Return type: nautilus_pyo3.QuoteTick
static to_pyo3_list(list quotes)
Return pyo3 Rust quote ticks converted from the given legacy Cython objects.
- Parameters: quotes (list [QuoteTick ]) – The legacy Cython quote ticks to convert from.
- Return type: list[nautilus_pyo3.QuoteTick]
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: QuoteTick.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: QuoteTick.ts_init
class TradeTick
Bases: Data
TradeTick(InstrumentId instrument_id, Price price, Quantity size, AggressorSide aggressor_side, TradeId trade_id, uint64_t ts_event, uint64_t ts_init) -> None
Represents a single trade tick in a market.
Contains information about a single unique trade which matched buyer and seller counterparties.
- Parameters:
- instrument_id (InstrumentId) – The trade instrument ID.
- price (Price) – The traded price.
- size (Quantity) – The traded size.
- aggressor_side (AggressorSide) – The trade aggressor side.
- trade_id (TradeId) – The trade match ID (assigned by the venue).
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Raises: ValueError – If trade_id is not a valid string.
aggressor_side
AggressorSide
Return the ticks aggressor side.
- Return type: AggressorSide
- Type: TradeTick.aggressor_side
static capsule_from_list(items)
static from_dict(dict values)
Return a trade tick from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: TradeTick
static from_pyo3(pyo3_trade)
Return a legacy Cython trade tick converted from the given pyo3 Rust object.
- Parameters: pyo3_trade (nautilus_pyo3.TradeTick) – The pyo3 Rust trade tick to convert from.
- Return type: TradeTick
static from_pyo3_list(list pyo3_trades)
Return legacy Cython trade ticks converted from the given pyo3 Rust objects.
- Parameters: pyo3_trades (list *[*nautilus_pyo3.TradeTick ]) – The pyo3 Rust trade ticks to convert from.
- Return type: list[TradeTick]
static from_raw(InstrumentId instrument_id, int64_t price_raw, uint8_t price_prec, uint64_t size_raw, uint8_t size_prec, AggressorSide aggressor_side, TradeId trade_id, uint64_t ts_event, uint64_t ts_init)
Return a trade tick from the given raw values.
- Parameters:
- instrument_id (InstrumentId) – The trade instrument ID.
- price_raw (int64_t) – The traded raw price (as a scaled fixed precision integer).
- price_prec (uint8_t) – The traded price precision.
- size_raw (uint64_t) – The traded raw size (as a scaled fixed precision integer).
- size_prec (uint8_t) – The traded size precision.
- aggressor_side (AggressorSide) – The trade aggressor side.
- trade_id (TradeId) – The trade match ID (assigned by the venue).
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the tick event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- Return type: TradeTick
static from_raw_arrays_to_list(InstrumentId instrument_id, uint8_t price_prec, uint8_t size_prec, int64_t[:] prices_raw, uint64_t[:] sizes_raw, uint8_t[:] aggressor_sides, list trade_ids, uint64_t[:] ts_events, uint64_t[:] ts_inits)
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
instrument_id
InstrumentId
Return the ticks instrument ID.
- Return type: InstrumentId
- Type: TradeTick.instrument_id
static list_from_capsule(capsule)
price
Price
Return the ticks price.
- Return type: Price
- Type: TradeTick.price
size
Price
Return the ticks size.
- Return type: Quantity
- Type: TradeTick.size
static to_dict(TradeTick obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
to_pyo3(self)
Return a pyo3 object from this legacy Cython instance.
- Return type: nautilus_pyo3.TradeTick
static to_pyo3_list(list trades)
Return pyo3 Rust trade ticks converted from the given legacy Cython objects.
- Parameters: ticks (list [TradeTick ]) – The legacy Cython Rust trade ticks to convert from.
- Return type: list[nautilus_pyo3.TradeTick]
trade_id
InstrumentId
Return the ticks trade match ID.
- Return type: Price
- Type: TradeTick.trade_id
ts_event
int
UNIX timestamp (nanoseconds) when the data event occurred.
- Return type: int
- Type: TradeTick.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: TradeTick.ts_init
class VenueStatus
Bases: Data
VenueStatus(Venue venue, MarketStatus status, uint64_t ts_event, uint64_t ts_init) -> None
Represents an update that indicates a change in a Venue status.
- Parameters:
- venue (Venue) – The venue ID.
- status (MarketStatus) – The venue market status.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the status update event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
static from_dict(dict values)
Return a venue status update from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: VenueStatus
classmethod fully_qualified_name(cls)
Return the fully qualified name for the Data class.
- Return type: str
status
The venue market status.
- Returns: MarketStatus
static to_dict(VenueStatus obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
ts_event
UNIX timestamp (nanoseconds) when the data event occurred.
- Returns: uint64_t
ts_init
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns: uint64_t
venue
The venue.
- Returns: Venue