From 35a6f8dc003be64912d75d024e26d8b79e3d203c Mon Sep 17 00:00:00 2001 From: Khizar Imran Date: Thu, 4 Jun 2026 00:06:43 +0100 Subject: [PATCH] build: fixed error relates to exit_price & exit_timestamp --- src/broker.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/broker.rs b/src/broker.rs index e629623..df0f7d7 100644 --- a/src/broker.rs +++ b/src/broker.rs @@ -1,3 +1,4 @@ + use crate::types::{Position, Trade}; pub struct Broker{ @@ -7,7 +8,7 @@ pub struct Broker{ } impl Broker { - pub fn new(initial_cash: f64) -> self { // does not need &mut because it initialises something new + pub fn new(initial_cash: f64) -> Self { // does not need &mut because it initialises something new Broker { cash: initial_cash, positions: Vec::new(), @@ -20,7 +21,7 @@ impl Broker { entry_price: price, lot_size, is_long: true, - entry_timestamp: timestamp + entry_timestamp: timestamp, }); } @@ -43,12 +44,12 @@ impl Broker { self.cash += pnl; self.trade_history.push(Trade { entry_price: position.entry_price, - exit_price: position.exit_price, lot_size: position.lot_size, is_long: position.is_long, pnl, entry_timestamp: position.entry_timestamp, - exit_timestamp: timestamp + exit_timestamp: timestamp, + exit_price: price }); } }