pub struct Position {
pub symbol: String,
pub size: f64,
pub entry_price: f64,
pub current_price: f64,
pub realized_pnl: f64,
pub funding_pnl: f64,
pub timestamp: DateTime<FixedOffset>,
}Expand description
Basic representation of a trading position.
Fields§
§symbol: String§size: f64§entry_price: f64§current_price: f64§realized_pnl: f64§funding_pnl: f64§timestamp: DateTime<FixedOffset>Implementations§
Source§impl Position
impl Position
pub fn new( symbol: &str, size: f64, entry_price: f64, current_price: f64, timestamp: DateTime<FixedOffset>, ) -> Self
pub fn update_price(&mut self, price: f64)
pub fn apply_funding_payment(&mut self, payment: f64)
pub fn total_pnl(&self) -> f64
pub fn unrealized_pnl(&self) -> f64
Trait Implementations§
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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