pub struct DeriveExecutionClient { /* private fields */ }Expand description
Live execution client for Derive.
Owns the HTTP and WebSocket clients used to talk to the venue plus an
ExecutionEventEmitter that publishes order/account events back to the
live engine. Order operations are signed against the per-environment
EIP-712 signing context resolved at construction.
Implementations§
Source§impl DeriveExecutionClient
impl DeriveExecutionClient
Sourcepub fn new(
core: ExecutionClientCore,
config: DeriveExecClientConfig,
) -> Result<Self>
pub fn new( core: ExecutionClientCore, config: DeriveExecClientConfig, ) -> Result<Self>
Creates a new DeriveExecutionClient.
Resolves wallet/session-key/subaccount from the supplied config, falling back to the documented environment variables when fields are unset, and parses the EIP-712 signing constants (domain separator, action typehash, trade-module address) from config overrides or the shipped per-environment defaults.
§Errors
Returns an error when:
- Required credentials are not provided via config or environment.
- Signing constants are still placeholders or cannot be parsed as hex.
- The HTTP or WebSocket client cannot be constructed.
Sourcepub const fn subaccount_id(&self) -> u64
pub const fn subaccount_id(&self) -> u64
Returns the resolved subaccount id.
Sourcepub fn config(&self) -> &DeriveExecClientConfig
pub fn config(&self) -> &DeriveExecClientConfig
Returns a reference to the resolved configuration.
Sourcepub fn http_client(&self) -> &DeriveHttpClient
pub fn http_client(&self) -> &DeriveHttpClient
Returns a reference to the underlying HTTP client.
Sourcepub fn cache_instrument(&self, instrument: DeriveInstrument)
pub fn cache_instrument(&self, instrument: DeriveInstrument)
Caches a Derive instrument by instrument ID so order submission can
resolve base_asset_address and base_asset_sub_id without
re-querying the venue.
Trait Implementations§
Source§impl Debug for DeriveExecutionClient
impl Debug for DeriveExecutionClient
Source§impl ExecutionClient for DeriveExecutionClient
impl ExecutionClient for DeriveExecutionClient
fn is_connected(&self) -> bool
fn client_id(&self) -> ClientId
fn account_id(&self) -> AccountId
fn venue(&self) -> Venue
fn oms_type(&self) -> OmsType
fn get_account(&self) -> Option<AccountAny>
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn generate_account_state(
&self,
balances: Vec<AccountBalance>,
margins: Vec<MarginBalance>,
reported: bool,
ts_event: UnixNanos,
) -> Result<()>
fn generate_account_state( &self, balances: Vec<AccountBalance>, margins: Vec<MarginBalance>, reported: bool, ts_event: UnixNanos, ) -> Result<()>
Source§fn on_instrument(&mut self, _instrument: InstrumentAny)
fn on_instrument(&mut self, _instrument: InstrumentAny)
Source§fn generate_order_status_report<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GenerateOrderStatusReport,
) -> Pin<Box<dyn Future<Output = Result<Option<OrderStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_order_status_report<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GenerateOrderStatusReport,
) -> Pin<Box<dyn Future<Output = Result<Option<OrderStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn generate_order_status_reports<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GenerateOrderStatusReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<OrderStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_order_status_reports<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GenerateOrderStatusReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<OrderStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn generate_fill_reports<'life0, 'async_trait>(
&'life0 self,
cmd: GenerateFillReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<FillReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_fill_reports<'life0, 'async_trait>(
&'life0 self,
cmd: GenerateFillReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<FillReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn generate_position_status_reports<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GeneratePositionStatusReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<PositionStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_position_status_reports<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 GeneratePositionStatusReports,
) -> Pin<Box<dyn Future<Output = Result<Vec<PositionStatusReport>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn generate_mass_status<'life0, 'async_trait>(
&'life0 self,
lookback_mins: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Option<ExecutionMassStatus>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_mass_status<'life0, 'async_trait>(
&'life0 self,
lookback_mins: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Option<ExecutionMassStatus>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn submit_order(&self, cmd: SubmitOrder) -> Result<()>
fn submit_order(&self, cmd: SubmitOrder) -> Result<()>
Source§fn submit_order_list(&self, cmd: SubmitOrderList) -> Result<()>
fn submit_order_list(&self, cmd: SubmitOrderList) -> Result<()>
Source§fn cancel_order(&self, cmd: CancelOrder) -> Result<()>
fn cancel_order(&self, cmd: CancelOrder) -> Result<()>
Source§fn cancel_all_orders(&self, cmd: CancelAllOrders) -> Result<()>
fn cancel_all_orders(&self, cmd: CancelAllOrders) -> Result<()>
Source§fn batch_cancel_orders(&self, cmd: BatchCancelOrders) -> Result<()>
fn batch_cancel_orders(&self, cmd: BatchCancelOrders) -> Result<()>
Source§fn modify_order(&self, cmd: ModifyOrder) -> Result<()>
fn modify_order(&self, cmd: ModifyOrder) -> Result<()>
Source§fn query_account(&self, _cmd: QueryAccount) -> Result<()>
fn query_account(&self, _cmd: QueryAccount) -> Result<()>
Source§fn query_order(&self, cmd: QueryOrder) -> Result<()>
fn query_order(&self, cmd: QueryOrder) -> Result<()>
Source§fn handles_order_venue(&self, venue: Venue) -> bool
fn handles_order_venue(&self, venue: Venue) -> bool
Source§fn reset(&mut self) -> Result<(), Error>
fn reset(&mut self) -> Result<(), Error>
Source§fn dispose(&mut self) -> Result<(), Error>
fn dispose(&mut self) -> Result<(), Error>
Source§fn register_external_order(
&self,
_client_order_id: ClientOrderId,
_venue_order_id: VenueOrderId,
_instrument_id: InstrumentId,
_strategy_id: StrategyId,
_ts_init: UnixNanos,
)
fn register_external_order( &self, _client_order_id: ClientOrderId, _venue_order_id: VenueOrderId, _instrument_id: InstrumentId, _strategy_id: StrategyId, _ts_init: UnixNanos, )
Source§fn calculate_commission(
&self,
instrument: &InstrumentAny,
last_qty: Quantity,
last_px: Price,
liquidity_side: LiquiditySide,
) -> Option<Money>
fn calculate_commission( &self, instrument: &InstrumentAny, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, ) -> Option<Money>
Auto Trait Implementations§
impl !Freeze for DeriveExecutionClient
impl !RefUnwindSafe for DeriveExecutionClient
impl !Send for DeriveExecutionClient
impl !Sync for DeriveExecutionClient
impl !UnwindSafe for DeriveExecutionClient
impl Unpin for DeriveExecutionClient
impl UnsafeUnpin for DeriveExecutionClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more