Trait lfest::account_tracker::AccountTracker
source · pub trait AccountTracker<M>: Sendwhere
M: Currency + MarginCurrency,{
// Required methods
fn update<UserOrderId>(
&mut self,
timestamp_ns: TimestampNs,
market_state: &MarketState,
account: &Account<M, UserOrderId>
)
where UserOrderId: Clone + Debug + Eq + PartialEq + Hash;
fn log_rpnl(&mut self, net_rpnl: M, ts_ns: TimestampNs);
fn log_fee(&mut self, fee_in_margin: M);
fn log_limit_order_submission(&mut self);
fn log_limit_order_cancellation(&mut self);
fn log_limit_order_fill(&mut self);
fn log_market_order_fill(&mut self);
fn log_trade(
&mut self,
side: Side,
price: QuoteCurrency,
quantity: M::PairedCurrency
);
}
Expand description
Something that tracks the performance of the Account. This allows for greated flexibility over using the FullAccountTracker which can easily use more than 10GB of RAM due to storage of tick-by-tick returns
Required Methods§
sourcefn update<UserOrderId>(
&mut self,
timestamp_ns: TimestampNs,
market_state: &MarketState,
account: &Account<M, UserOrderId>
)
fn update<UserOrderId>( &mut self, timestamp_ns: TimestampNs, market_state: &MarketState, account: &Account<M, UserOrderId> )
Update with each tick, using data provided in update_state method of Exchange.
§Arguments:
timestamp_ns
: timestamp of latest tick in nanoseconds
price
: price of latest tick
upnl
: unrealized profit and loss of account in current tick
sourcefn log_rpnl(&mut self, net_rpnl: M, ts_ns: TimestampNs)
fn log_rpnl(&mut self, net_rpnl: M, ts_ns: TimestampNs)
Log a realized profit and loss event
§Arguments:
net_rpnl
: The realized profit and loss, denoted in margin currency.
ts_ns
: The timestamp in nanoseconds of this event.
sourcefn log_limit_order_submission(&mut self)
fn log_limit_order_submission(&mut self)
Log a limit order submission event
sourcefn log_limit_order_cancellation(&mut self)
fn log_limit_order_cancellation(&mut self)
Log a limit order cancellation event
sourcefn log_limit_order_fill(&mut self)
fn log_limit_order_fill(&mut self)
Log a limit order fill event.
sourcefn log_market_order_fill(&mut self)
fn log_market_order_fill(&mut self)
Log a market order fill event.
sourcefn log_trade(
&mut self,
side: Side,
price: QuoteCurrency,
quantity: M::PairedCurrency
)
fn log_trade( &mut self, side: Side, price: QuoteCurrency, quantity: M::PairedCurrency )
Log a trade event where some order got filled and the position changed