pub struct ArcExchange(pub Arc<dyn Exchange>);Expand description
Newtype wrapper around Arc<dyn Exchange> to implement Exchange trait.
This allows PaperExchange to wrap any Arc<dyn Exchange> while satisfying orphan rules.
Tuple Fields§
§0: Arc<dyn Exchange>Implementations§
Trait Implementations§
Source§impl Exchange for ArcExchange
impl Exchange for ArcExchange
Source§fn exchange_id(&self) -> &ExchangeId
fn exchange_id(&self) -> &ExchangeId
Get the exchange ID
Source§fn environment(&self) -> Environment
fn environment(&self) -> Environment
Get the environment (mainnet/testnet)
Source§fn place_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
orders: &'life1 [OrderInput],
) -> Pin<Box<dyn Future<Output = Result<Vec<PlaceOrderResult>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn place_orders<'life0, 'life1, 'async_trait>(
&'life0 self,
orders: &'life1 [OrderInput],
) -> Pin<Box<dyn Future<Output = Result<Vec<PlaceOrderResult>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Place multiple limit orders in a single batch API call.
Returns a Vec of results, one for each order in the same order as the input.
Source§fn cancel_order<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
market_index: &'life2 MarketIndex,
client_id: &'life3 ClientOrderId,
exchange_order_id: Option<&'life4 ExchangeOrderId>,
) -> Pin<Box<dyn Future<Output = Result<(), ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn cancel_order<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
market_index: &'life2 MarketIndex,
client_id: &'life3 ClientOrderId,
exchange_order_id: Option<&'life4 ExchangeOrderId>,
) -> Pin<Box<dyn Future<Output = Result<(), ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Cancel an order by client_id or exchange_order_id.
Source§fn cancel_all_orders<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
market_index: &'life2 MarketIndex,
) -> Pin<Box<dyn Future<Output = Result<u32, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel_all_orders<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
instrument: &'life1 InstrumentId,
market_index: &'life2 MarketIndex,
) -> Pin<Box<dyn Future<Output = Result<u32, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Cancel all orders for an instrument.
Returns number of orders canceled.
Source§fn poll_user_fills<'life0, 'life1, 'async_trait>(
&'life0 self,
cursor: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fill>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn poll_user_fills<'life0, 'life1, 'async_trait>(
&'life0 self,
cursor: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fill>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Poll user fills since cursor.
This is the primary execution event source.
cursor is opaque string (implementation-specific).
Source§fn poll_quotes<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn poll_quotes<'life0, 'life1, 'async_trait>(
&'life0 self,
instruments: &'life1 [InstrumentId],
) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Poll current quotes/prices.
Source§fn poll_account_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AccountState, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn poll_account_state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AccountState, ExchangeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Poll account state (absolute).
Used for snapshot-based synchronization.
Source§fn instance(&self) -> ExchangeInstance
fn instance(&self) -> ExchangeInstance
Get the exchange instance key
Source§fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ExchangeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ExchangeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Initialize the exchange connection and perform startup validations.
Called by the runner before entering the main loop.
Implementations can validate: connectivity, vault ownership, account balance, etc.
Auto Trait Implementations§
impl !RefUnwindSafe for ArcExchange
impl !UnwindSafe for ArcExchange
impl Freeze for ArcExchange
impl Send for ArcExchange
impl Sync for ArcExchange
impl Unpin for ArcExchange
impl UnsafeUnpin for ArcExchange
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
Mutably borrows from an owned value. Read more