Skip to main content

position_value

Function position_value 

Source
pub fn position_value(entry_perp_delta: I256, mark_price: f64) -> f64
Expand description

Calculate the current position value at a given mark price.

value = |size| × mark_price

§Examples

let val = position_value(I256::try_from(1_000_000i64).unwrap(), 1600.0);
assert!((val - 1600.0).abs() < 0.001);