pub trait AccountSync: Send + Sync {
// Required methods
fn should_sync(&self) -> bool;
fn last_pnl(&self) -> Option<f64>;
fn sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_bot: bool,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn shutdown_sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn set_metrics_snapshot(
&mut self,
_snapshot: Option<PerformanceMetricsSnapshot>,
) { ... }
}Expand description
Trait for account snapshot syncing (Arbitrage strategies)
Syncers implementing this trait accept full account state snapshots.
Required Methods§
Sourcefn should_sync(&self) -> bool
fn should_sync(&self) -> bool
Check if it’s time to sync based on interval
Sourcefn sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_bot: bool,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_bot: bool,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sync account state to upstream
Sourcefn shutdown_sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn shutdown_sync<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
account_state: &'life1 AccountState,
stop_reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AccountSyncResult, SyncError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Perform final sync on shutdown
Provided Methods§
Sourcefn set_metrics_snapshot(
&mut self,
_snapshot: Option<PerformanceMetricsSnapshot>,
)
fn set_metrics_snapshot( &mut self, _snapshot: Option<PerformanceMetricsSnapshot>, )
Set the latest performance metrics snapshot to include in sync metadata.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".