pub struct StrategySpec {Show 14 fields
pub spec_version: u32,
pub symbol: String,
pub ref_symbol: Option<String>,
pub timeframe: String,
pub indicators: BTreeMap<String, IndicatorSpec>,
pub entry: Condition,
pub exit: Condition,
pub short_entry: Option<Condition>,
pub short_exit: Option<Condition>,
pub sizing: Sizing,
pub costs: Costs,
pub risk: Risk,
pub execution: Execution,
pub warmup: Option<u32>,
}Expand description
A complete strategy specification.
Fields§
§spec_version: u32Spec format version (defaults to SPEC_VERSION).
A spec from an older format still parses – the DSL only grows within a version – but one declaring a newer format is rejected rather than read with fields this build does not know about.
symbol: StringPrimary trading symbol.
Metadata, not an input: the engine never resolves it and cannot fetch data. The caller supplies the candles, and this records which instrument they are expected to be, so a stored spec still says what it was written for.
ref_symbol: Option<String>The reference instrument a pairwise indicator is meant to be run against.
Also metadata. Naming it here does not load anything: the reference series
is passed alongside the candles, through RunRequest.reference or
run_with_ref. This field records which instrument the caller is expected
to pass, so a spec using a pairwise indicator is not ambiguous about what
it is pairing against.
timeframe: StringBar timeframe (e.g. "1h").
Metadata, like symbol: a free-form label recording the bar size the spec
was written for. The engine reads whatever candles it is given and does not
check them against this.
indicators: BTreeMap<String, IndicatorSpec>Named indicators available to the rules.
entry: ConditionLong-entry condition.
exit: ConditionLong-exit condition.
short_entry: Option<Condition>Optional short-entry condition.
short_exit: Option<Condition>Optional short-exit condition.
sizing: SizingPosition sizing.
costs: CostsTrading costs.
risk: RiskRisk controls.
execution: ExecutionExecution model.
warmup: Option<u32>Explicit warmup bars (defaults to the max indicator warmup).
Implementations§
Trait Implementations§
Source§impl Clone for StrategySpec
impl Clone for StrategySpec
Source§fn clone(&self) -> StrategySpec
fn clone(&self) -> StrategySpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StrategySpec
impl Debug for StrategySpec
Source§impl<'de> Deserialize<'de> for StrategySpec
impl<'de> Deserialize<'de> for StrategySpec
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>,
Source§impl JsonSchema for StrategySpec
impl JsonSchema for StrategySpec
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl PartialEq for StrategySpec
impl PartialEq for StrategySpec
Source§impl Serialize for StrategySpec
impl Serialize for StrategySpec
impl StructuralPartialEq for StrategySpec
Auto Trait Implementations§
impl Freeze for StrategySpec
impl RefUnwindSafe for StrategySpec
impl Send for StrategySpec
impl Sync for StrategySpec
impl Unpin for StrategySpec
impl UnsafeUnpin for StrategySpec
impl UnwindSafe for StrategySpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more