Expose open order state to strategy runtime
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user