pub struct PositionConstraints {
pub min_range_width: Decimal,
pub max_range_width: Decimal,
pub min_capital: Decimal,
pub max_capital: Decimal,
pub max_il_threshold: Decimal,
pub min_time_in_range: Decimal,
pub max_tx_cost_ratio: Decimal,
}Expand description
Constraints for position optimization.
Fields§
§min_range_width: DecimalMinimum range width as a percentage (e.g., 0.01 = 1%).
max_range_width: DecimalMaximum range width as a percentage (e.g., 0.50 = 50%).
min_capital: DecimalMinimum capital to deploy.
max_capital: DecimalMaximum capital to deploy.
max_il_threshold: DecimalMaximum acceptable IL as a percentage.
min_time_in_range: DecimalMinimum time in range percentage.
max_tx_cost_ratio: DecimalMaximum transaction cost as percentage of capital.
Implementations§
Source§impl PositionConstraints
impl PositionConstraints
Sourcepub fn with_min_range_width(self, width: Decimal) -> Self
pub fn with_min_range_width(self, width: Decimal) -> Self
Sets the minimum range width.
Sourcepub fn with_max_range_width(self, width: Decimal) -> Self
pub fn with_max_range_width(self, width: Decimal) -> Self
Sets the maximum range width.
Sourcepub fn with_capital_bounds(self, min: Decimal, max: Decimal) -> Self
pub fn with_capital_bounds(self, min: Decimal, max: Decimal) -> Self
Sets the capital bounds.
Sourcepub fn with_max_il(self, max_il: Decimal) -> Self
pub fn with_max_il(self, max_il: Decimal) -> Self
Sets the maximum IL threshold.
Sourcepub fn with_min_time_in_range(self, min_time: Decimal) -> Self
pub fn with_min_time_in_range(self, min_time: Decimal) -> Self
Sets the minimum time in range.
Sourcepub fn is_valid_range_width(&self, width: Decimal) -> bool
pub fn is_valid_range_width(&self, width: Decimal) -> bool
Checks if a range width is valid.
Sourcepub fn is_valid_capital(&self, capital: Decimal) -> bool
pub fn is_valid_capital(&self, capital: Decimal) -> bool
Checks if capital is within bounds.
Sourcepub fn is_acceptable_il(&self, il: Decimal) -> bool
pub fn is_acceptable_il(&self, il: Decimal) -> bool
Checks if IL is acceptable.
Sourcepub fn meets_time_in_range(&self, time_in_range: Decimal) -> bool
pub fn meets_time_in_range(&self, time_in_range: Decimal) -> bool
Checks if time in range meets minimum.
Trait Implementations§
Source§impl Clone for PositionConstraints
impl Clone for PositionConstraints
Source§fn clone(&self) -> PositionConstraints
fn clone(&self) -> PositionConstraints
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PositionConstraints
impl Debug for PositionConstraints
Auto Trait Implementations§
impl Freeze for PositionConstraints
impl RefUnwindSafe for PositionConstraints
impl Send for PositionConstraints
impl Sync for PositionConstraints
impl Unpin for PositionConstraints
impl UnsafeUnpin for PositionConstraints
impl UnwindSafe for PositionConstraints
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