feat(stock-pool): unify target execution, durable intent state and ETF rules
This commit is contained in:
@@ -1070,6 +1070,9 @@ pub enum TargetPortfolioOrderPricing {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum OrderIntent {
|
||||
StockPool {
|
||||
contract: Box<crate::stock_pool_execution::FrozenStockPoolIntent>,
|
||||
},
|
||||
WithTimeInForce {
|
||||
intent: Box<OrderIntent>,
|
||||
time_in_force: OrderTimeInForce,
|
||||
@@ -1231,6 +1234,7 @@ pub enum OrderIntent {
|
||||
impl OrderIntent {
|
||||
fn collect_potential_buy_symbols(&self, open_orders: &[OpenOrderView], symbols: &mut BTreeSet<String>) {
|
||||
match self.unwrapped() {
|
||||
Self::StockPool { contract } => { symbols.extend(contract.selection.requested_symbols.iter().cloned()); }
|
||||
Self::Shares { symbol, quantity, .. } | Self::LimitShares { symbol, quantity, .. } if *quantity > 0 => { symbols.insert(symbol.clone()); }
|
||||
Self::Lots { symbol, lots, .. } | Self::LimitLots { symbol, lots, .. } if *lots > 0 => { symbols.insert(symbol.clone()); }
|
||||
Self::TargetShares { symbol, target_quantity, .. } | Self::LimitTargetShares { symbol, target_quantity, .. } if *target_quantity > 0 => { symbols.insert(symbol.clone()); }
|
||||
@@ -1311,6 +1315,7 @@ impl OrderIntent {
|
||||
|
||||
pub fn supports_time_in_force(&self, time_in_force: OrderTimeInForce) -> bool {
|
||||
let intent = self.unwrapped();
|
||||
if matches!(intent, Self::StockPool { .. }) { return time_in_force == OrderTimeInForce::Day; }
|
||||
if matches!(
|
||||
intent,
|
||||
Self::CancelOrder { .. }
|
||||
|
||||
Reference in New Issue
Block a user