pub struct HoldingConfig {
pub symbol: String,
pub target_percent: Option<Decimal>,
pub absolute_value: Option<Decimal>,
pub tolerance_percent: Decimal,
pub allow_sell: bool,
pub min_trade_lots: u32,
pub enabled: bool,
}Expand description
Configuration for a holding strategy.
Fields§
§symbol: StringThe symbol to hold.
target_percent: Option<Decimal>Target allocation as percentage of portfolio (0-100). If set, this takes precedence over absolute_value.
absolute_value: Option<Decimal>Target allocation as absolute value in base currency.
tolerance_percent: DecimalMaximum allowed deviation from target before rebalancing (percentage points).
allow_sell: boolWhether to sell when over-allocated.
min_trade_lots: u32Minimum trade size in lots.
enabled: boolWhether the strategy is enabled.
Implementations§
Source§impl HoldingConfig
impl HoldingConfig
Sourcepub fn with_percent(symbol: impl Into<String>, target_percent: Decimal) -> Self
pub fn with_percent(symbol: impl Into<String>, target_percent: Decimal) -> Self
Creates a new holding config for a symbol with a target percentage.
Sourcepub fn with_absolute(symbol: impl Into<String>, absolute_value: Decimal) -> Self
pub fn with_absolute(symbol: impl Into<String>, absolute_value: Decimal) -> Self
Creates a new holding config for a symbol with an absolute value target.
Sourcepub fn with_tolerance(self, tolerance: Decimal) -> Self
pub fn with_tolerance(self, tolerance: Decimal) -> Self
Sets the tolerance percentage.
Sourcepub fn with_allow_sell(self, allow: bool) -> Self
pub fn with_allow_sell(self, allow: bool) -> Self
Enables or disables selling when over-allocated.
Sourcepub fn with_min_trade_lots(self, lots: u32) -> Self
pub fn with_min_trade_lots(self, lots: u32) -> Self
Sets the minimum trade size in lots.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Enables or disables the strategy.
Trait Implementations§
Source§impl Clone for HoldingConfig
impl Clone for HoldingConfig
Source§impl Debug for HoldingConfig
impl Debug for HoldingConfig
Source§impl Default for HoldingConfig
impl Default for HoldingConfig
Source§impl<'de> Deserialize<'de> for HoldingConfig
impl<'de> Deserialize<'de> for HoldingConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for HoldingConfig
impl Freeze for HoldingConfig
impl Move for HoldingConfig
impl RefUnwindSafe for HoldingConfig
impl Send for HoldingConfig
impl Sync for HoldingConfig
impl Unpin for HoldingConfig
impl UnsafeUnpin for HoldingConfig
impl UnwindSafe for HoldingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more