pub struct TotalExecutionCost;Expand description
Computes the full execution cost breakdown for an order.
§Example
use fin_primitives::execution_cost::{TotalExecutionCost, ExecutionCostModel};
let breakdown = TotalExecutionCost::compute(
1000.0, // size
150.0, // price
&ExecutionCostModel::Proportional(5.0), // 5 bps commission
149.90, // bid
150.10, // ask
1_000_000.0, // daily volume
0.02, // sigma (daily vol)
);
assert!(breakdown.total_usd > 0.0);Implementations§
Source§impl TotalExecutionCost
impl TotalExecutionCost
Sourcepub fn compute(
size: f64,
price: f64,
commission_model: &ExecutionCostModel,
bid: f64,
ask: f64,
volume: f64,
sigma: f64,
) -> ExecutionCostBreakdown
pub fn compute( size: f64, price: f64, commission_model: &ExecutionCostModel, bid: f64, ask: f64, volume: f64, sigma: f64, ) -> ExecutionCostBreakdown
Compute the total execution cost breakdown.
Uses the square-root (Kyle-style) model for market impact with eta = 0.1.
Auto Trait Implementations§
impl Freeze for TotalExecutionCost
impl RefUnwindSafe for TotalExecutionCost
impl Send for TotalExecutionCost
impl Sync for TotalExecutionCost
impl Unpin for TotalExecutionCost
impl UnsafeUnpin for TotalExecutionCost
impl UnwindSafe for TotalExecutionCost
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