Expose open order state to strategy runtime

This commit is contained in:
boris
2026-04-23 04:52:43 -07:00
parent 9fca6e0011
commit 4fdcfdae7d
8 changed files with 311 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ use crate::events::{
};
use crate::portfolio::PortfolioState;
use crate::rules::EquityRuleHooks;
use crate::strategy::{OrderIntent, StrategyDecision};
use crate::strategy::{OpenOrderView, OrderIntent, StrategyDecision};
#[derive(Debug, Default)]
pub struct BrokerExecutionReport {
@@ -174,6 +174,23 @@ impl<C, R> BrokerSimulator<C, R> {
self.slippage_model = slippage_model;
self
}
pub fn open_order_views(&self) -> Vec<OpenOrderView> {
self.open_orders
.borrow()
.iter()
.map(|order| OpenOrderView {
order_id: order.order_id,
symbol: order.symbol.clone(),
side: order.side,
requested_quantity: order.requested_quantity,
filled_quantity: order.filled_quantity,
remaining_quantity: order.remaining_quantity,
limit_price: order.limit_price,
reason: order.reason.clone(),
})
.collect()
}
}
impl<C, R> BrokerSimulator<C, R>