pub struct ContractSpec {
pub price_currency: Currency,
pub settlement_currency: Currency,
pub multiplier: f64,
pub quantity_step: f64,
pub min_quantity: f64,
pub instrument_type: InstrumentType,
}Expand description
Detailed operative contract specifications complementing crate::model::InstrumentMeta.
Fields§
§price_currency: CurrencyCurrency in which the instrument’s market price is quoted (e.g. USD for AAPL, EUR for DAX).
settlement_currency: CurrencyCurrency in which margin and cash settlements occur.
multiplier: f64Contract point multiplier (e.g. 1.0 for equities, 25.0 for DAX future, 100.0 for SPX).
quantity_step: f64Minimum increment of order quantity (lot step size, e.g. 1.0 for futures, 0.0001 for crypto).
min_quantity: f64Minimum allowed order quantity. Must be >= quantity_step.
instrument_type: InstrumentTypeThe structural category of the instrument.
Implementations§
Source§impl ContractSpec
impl ContractSpec
Sourcepub fn validate(&self) -> Result<(), ContractSpecError>
pub fn validate(&self) -> Result<(), ContractSpecError>
Validates the contractual consistency of the specification.
Sourcepub fn round_quantity_down(&self, quantity: f64) -> f64
pub fn round_quantity_down(&self, quantity: f64) -> f64
Rounds quantity strictly downward to the nearest integer multiple of quantity_step.
If the resulting quantity is strictly less than min_quantity, returns 0.0
(no trade generated below minimum threshold).
Trait Implementations§
Source§impl Clone for ContractSpec
impl Clone for ContractSpec
Source§fn clone(&self) -> ContractSpec
fn clone(&self) -> ContractSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more