Skip to main content

StrategyVTable

Struct StrategyVTable 

Source
#[repr(C)]
pub struct StrategyVTable {
Show 54 fields pub create: Option<unsafe extern "C" fn(host: *const HostVTable, ctx: *const HostContext, config_json: BorrowedStr<'_>) -> *mut PluginStrategyHandle>, pub drop_handle: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle)>, pub type_name: Option<unsafe extern "C" fn() -> BorrowedStr<'static>>, pub on_start: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_stop: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_resume: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_reset: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_dispose: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_degrade: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_fault: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_time_event: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const TimeEvent) -> PluginResult<()>>, pub on_data: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, data: PluginCustomDataRef) -> PluginResult<()>>, pub on_instrument: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, instrument: *const InstrumentAnyHandle) -> PluginResult<()>>, pub on_book_deltas: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, deltas: *const OrderBookDeltasHandle) -> PluginResult<()>>, pub on_book: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, book: *const OrderBookHandle) -> PluginResult<()>>, pub on_quote: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, quote: *const QuoteTick) -> PluginResult<()>>, pub on_trade: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, trade: *const TradeTick) -> PluginResult<()>>, pub on_bar: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, bar: *const Bar) -> PluginResult<()>>, pub on_mark_price: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, mark_price: *const MarkPriceUpdate) -> PluginResult<()>>, pub on_index_price: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, index_price: *const IndexPriceUpdate) -> PluginResult<()>>, pub on_funding_rate: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, funding_rate: *const FundingRateUpdate) -> PluginResult<()>>, pub on_option_greeks: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, greeks: *const OptionGreeks) -> PluginResult<()>>, pub on_option_chain: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, chain: *const OptionChainSliceHandle) -> PluginResult<()>>, pub on_instrument_status: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, status: *const InstrumentStatus) -> PluginResult<()>>, pub on_instrument_close: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, close: *const InstrumentClose) -> PluginResult<()>>, pub on_signal: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, signal: *const Signal) -> PluginResult<()>>, pub on_order_initialized: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderInitialized) -> PluginResult<()>>, pub on_order_submitted: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderSubmitted) -> PluginResult<()>>, pub on_order_accepted: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderAccepted) -> PluginResult<()>>, pub on_order_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderRejected) -> PluginResult<()>>, pub on_order_filled: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderFilled) -> PluginResult<()>>, pub on_order_canceled: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderCanceled) -> PluginResult<()>>, pub on_order_expired: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderExpired) -> PluginResult<()>>, pub on_order_triggered: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderTriggered) -> PluginResult<()>>, pub on_order_denied: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderDenied) -> PluginResult<()>>, pub on_order_emulated: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderEmulated) -> PluginResult<()>>, pub on_order_released: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderReleased) -> PluginResult<()>>, pub on_order_pending_update: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderPendingUpdate) -> PluginResult<()>>, pub on_order_pending_cancel: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderPendingCancel) -> PluginResult<()>>, pub on_order_modify_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderModifyRejected) -> PluginResult<()>>, pub on_order_cancel_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderCancelRejected) -> PluginResult<()>>, pub on_order_updated: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderUpdated) -> PluginResult<()>>, pub on_position_opened: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionOpened) -> PluginResult<()>>, pub on_position_changed: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionChanged) -> PluginResult<()>>, pub on_position_closed: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionClosed) -> PluginResult<()>>, pub on_market_exit: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>, pub on_historical_book_deltas: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, deltas: Slice<'_, OrderBookDelta>) -> PluginResult<()>>, pub on_historical_book_depth: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, depths: Slice<'_, OrderBookDepth10>) -> PluginResult<()>>, pub on_historical_quotes: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, quotes: Slice<'_, QuoteTick>) -> PluginResult<()>>, pub on_historical_trades: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, trades: Slice<'_, TradeTick>) -> PluginResult<()>>, pub on_historical_bars: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, bars: Slice<'_, Bar>) -> PluginResult<()>>, pub on_historical_mark_prices: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, mark_prices: Slice<'_, MarkPriceUpdate>) -> PluginResult<()>>, pub on_historical_index_prices: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, index_prices: Slice<'_, IndexPriceUpdate>) -> PluginResult<()>>, pub on_historical_funding_rates: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, funding_rates: Slice<'_, FundingRateUpdate>) -> PluginResult<()>>,
}
Expand description

Function table for a single plug-in strategy type.

One static vtable per concrete type, generated by nautilus_plugin! via the same Tag<T> pattern that powers actor_vtable and custom_data_vtable.

The strategy duplicates the actor callback set directly rather than embedding an ActorVTable so dispatch stays a single function-pointer call per event and so the layout is independent of any future actor vtable changes.

Slots are nullable at the ABI type level so the host can reject malformed manifests with null callbacks before constructing a strategy. Macro-generated vtables fill every required slot.

Fields§

§create: Option<unsafe extern "C" fn(host: *const HostVTable, ctx: *const HostContext, config_json: BorrowedStr<'_>) -> *mut PluginStrategyHandle>

Constructs a fresh strategy instance bound to the supplied host vtable and instance context, and returns a non-null handle. The strategy stashes both pointers so it can route order commands (submit_order, cancel_order, modify_order) back through the host. The host uses the context to attribute each command.

config_json carries the per-instance configuration the host constructed from the user’s TOML or builder API. Empty when the host has no instance-specific configuration to pass.

§drop_handle: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle)>

Drops the strategy instance and releases all of its resources.

§type_name: Option<unsafe extern "C" fn() -> BorrowedStr<'static>>

Returns the canonical type name for this strategy.

§on_start: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_stop: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_resume: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_reset: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_dispose: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_degrade: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_fault: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_time_event: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const TimeEvent) -> PluginResult<()>>§on_data: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, data: PluginCustomDataRef) -> PluginResult<()>>§on_instrument: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, instrument: *const InstrumentAnyHandle) -> PluginResult<()>>§on_book_deltas: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, deltas: *const OrderBookDeltasHandle) -> PluginResult<()>>§on_book: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, book: *const OrderBookHandle) -> PluginResult<()>>§on_quote: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, quote: *const QuoteTick) -> PluginResult<()>>§on_trade: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, trade: *const TradeTick) -> PluginResult<()>>§on_bar: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, bar: *const Bar) -> PluginResult<()>>§on_mark_price: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, mark_price: *const MarkPriceUpdate) -> PluginResult<()>>§on_index_price: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, index_price: *const IndexPriceUpdate) -> PluginResult<()>>§on_funding_rate: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, funding_rate: *const FundingRateUpdate) -> PluginResult<()>>§on_option_greeks: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, greeks: *const OptionGreeks) -> PluginResult<()>>§on_option_chain: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, chain: *const OptionChainSliceHandle) -> PluginResult<()>>§on_instrument_status: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, status: *const InstrumentStatus) -> PluginResult<()>>§on_instrument_close: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, close: *const InstrumentClose) -> PluginResult<()>>§on_signal: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, signal: *const Signal) -> PluginResult<()>>§on_order_initialized: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderInitialized) -> PluginResult<()>>§on_order_submitted: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderSubmitted) -> PluginResult<()>>§on_order_accepted: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderAccepted) -> PluginResult<()>>§on_order_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderRejected) -> PluginResult<()>>§on_order_filled: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderFilled) -> PluginResult<()>>§on_order_canceled: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderCanceled) -> PluginResult<()>>§on_order_expired: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderExpired) -> PluginResult<()>>§on_order_triggered: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderTriggered) -> PluginResult<()>>§on_order_denied: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderDenied) -> PluginResult<()>>§on_order_emulated: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderEmulated) -> PluginResult<()>>§on_order_released: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderReleased) -> PluginResult<()>>§on_order_pending_update: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderPendingUpdate) -> PluginResult<()>>§on_order_pending_cancel: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderPendingCancel) -> PluginResult<()>>§on_order_modify_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderModifyRejected) -> PluginResult<()>>§on_order_cancel_rejected: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderCancelRejected) -> PluginResult<()>>§on_order_updated: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const OrderUpdated) -> PluginResult<()>>§on_position_opened: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionOpened) -> PluginResult<()>>§on_position_changed: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionChanged) -> PluginResult<()>>§on_position_closed: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, event: *const PositionClosed) -> PluginResult<()>>§on_market_exit: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle) -> PluginResult<()>>§on_historical_book_deltas: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, deltas: Slice<'_, OrderBookDelta>) -> PluginResult<()>>§on_historical_book_depth: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, depths: Slice<'_, OrderBookDepth10>) -> PluginResult<()>>§on_historical_quotes: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, quotes: Slice<'_, QuoteTick>) -> PluginResult<()>>§on_historical_trades: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, trades: Slice<'_, TradeTick>) -> PluginResult<()>>§on_historical_bars: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, bars: Slice<'_, Bar>) -> PluginResult<()>>§on_historical_mark_prices: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, mark_prices: Slice<'_, MarkPriceUpdate>) -> PluginResult<()>>§on_historical_index_prices: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, index_prices: Slice<'_, IndexPriceUpdate>) -> PluginResult<()>>§on_historical_funding_rates: Option<unsafe extern "C" fn(handle: *mut PluginStrategyHandle, funding_rates: Slice<'_, FundingRateUpdate>) -> PluginResult<()>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.