Skip to main content

custom_data

Attribute Macro custom_data 

Source
#[custom_data]
Expand description

Expands a named-field struct into a Serde-backed custom data type.

Generates the required Serde derives, HasTsInit, CustomDataTrait, Data conversions, constructor, display implementation, and optional PyO3 bindings. The struct must contain ts_event and ts_init fields.

Use #[custom_data(pyo3)] to generate Python bindings. Use #[custom_data(pyo3, no_display)] to provide a custom display implementation. Use stub_module = "nautilus_trader.<module>" with pyo3 to emit stub metadata. Use #[custom_data_field(serde)] for fields requiring the generic Serde Python bridge.