use smallvec::SmallVec;
use crate::core::account_outcome::AccountOutcomeEntry;
use crate::param::{AccountGroupId, AccountId, Asset, Price};
use crate::pretrade::AccountBlock;
use crate::PnlState;
#[derive(Clone, Debug, Default)]
pub struct PolicyPreTradeResult {
pub account_adjustments: SmallVec<[AccountOutcomeEntry; 1]>,
pub lock_prices: SmallVec<[Price; 1]>,
}
impl PolicyPreTradeResult {
pub fn empty() -> Self {
Self::default()
}
pub fn with_capacity(adjustments: usize, prices: usize) -> Self {
Self {
account_adjustments: SmallVec::with_capacity(adjustments),
lock_prices: SmallVec::with_capacity(prices),
}
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct PolicyAccountAdjustmentResult {
pub account_adjustments: Vec<AccountOutcomeEntry>,
pub account_blocks: Vec<AccountBlock>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AccountBlockOutcome {
pub block: AccountBlock,
pub account_id: AccountId,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct AccountBlockOutcomes {
pub account_blocks: Vec<AccountBlockOutcome>,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct PolicyConfigurationResult {
pub account_blocks: Vec<AccountBlock>,
}
#[doc(hidden)]
#[derive(Clone, Debug, PartialEq, Eq)]
#[allow(
clippy::large_enum_variant,
reason = "Retunes carry four selected barriers without an allocation."
)]
pub enum PolicyRuntimeConfiguration {
SetSpotFundsAccountPnl {
account_id: AccountId,
account_group_id: Option<AccountGroupId>,
account_currency: Option<Asset>,
state: PnlState,
},
CheckSpotFundsPnlAxes {
account_id: AccountId,
account_group_id: Option<AccountGroupId>,
account_currency: Option<Asset>,
barriers: [Option<crate::pretrade::policies::SpotFundsPnlBoundsBarrier>; 4],
},
}