pub struct TradeHistory {
pub trades: Vec<Trade>,
}
Expand description
Trade history container
Fields§
§trades: Vec<Trade>
List of trades
Implementations§
Source§impl TradeHistory
impl TradeHistory
Sourcepub fn total_value(&self) -> f64
pub fn total_value(&self) -> f64
Calculate total traded value
Sourcepub fn total_quantity(&self) -> u32
pub fn total_quantity(&self) -> u32
Calculate total quantity traded
Sourcepub fn average_price(&self) -> f64
pub fn average_price(&self) -> f64
Calculate average price across all trades
Sourcepub fn trades_by_type(&self, transaction_type: TransactionType) -> Vec<&Trade>
pub fn trades_by_type(&self, transaction_type: TransactionType) -> Vec<&Trade>
Get trades by transaction type
Sourcepub fn buy_trades(&self) -> Vec<&Trade>
pub fn buy_trades(&self) -> Vec<&Trade>
Get buy trades
Sourcepub fn sell_trades(&self) -> Vec<&Trade>
pub fn sell_trades(&self) -> Vec<&Trade>
Get sell trades
Trait Implementations§
Source§impl Clone for TradeHistory
impl Clone for TradeHistory
Source§fn clone(&self) -> TradeHistory
fn clone(&self) -> TradeHistory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TradeHistory
impl Debug for TradeHistory
Source§impl<'de> Deserialize<'de> for TradeHistory
impl<'de> Deserialize<'de> for TradeHistory
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TradeHistory
impl RefUnwindSafe for TradeHistory
impl Send for TradeHistory
impl Sync for TradeHistory
impl Unpin for TradeHistory
impl UnwindSafe for TradeHistory
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