pub enum RuleConfigDef {
FixedStoploss {
price: f64,
},
TrailingStop {
distance: f64,
},
TakeProfit {
price: f64,
close_ratio: f64,
},
BreakevenWhen {
trigger_price: f64,
},
BreakevenWhenOffset {
trigger_price_offset: f64,
},
BreakevenAfterTargets {
after_n: u32,
},
TimeExit {
max_seconds: u64,
},
}Expand description
Profile-specific rule definition with #[serde(tag = "type")] for TOML.
Converts to the core RuleConfig enum. Includes an offset-based
BreakevenWhenOffset variant that computes the absolute trigger price
from the signal’s entry price at apply time.
Variants§
FixedStoploss
Fixed stoploss at an absolute price.
TrailingStop
Trailing stop with a fixed distance.
TakeProfit
Take profit at an absolute price with a close ratio.
BreakevenWhen
Breakeven trigger at an absolute price.
BreakevenWhenOffset
Breakeven trigger as an offset from the entry price (profile-specific).
BreakevenAfterTargets
Breakeven after N targets have been hit.
TimeExit
Time-based exit after N seconds.
Implementations§
Source§impl RuleConfigDef
impl RuleConfigDef
Sourcepub fn resolve(
&self,
entry_price: Option<f64>,
side: Side,
) -> Option<RuleConfig>
pub fn resolve( &self, entry_price: Option<f64>, side: Side, ) -> Option<RuleConfig>
Resolve this definition into a core RuleConfig.
For offset-based variants, entry_price and side are needed
to compute the absolute trigger price. Returns None when the
offset variant is used but no entry price is available.
Trait Implementations§
Source§impl Clone for RuleConfigDef
impl Clone for RuleConfigDef
Source§fn clone(&self) -> RuleConfigDef
fn clone(&self) -> RuleConfigDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more