Expand description
Contract specifications, currencies, and linear contract valuation models. Provider-neutral instrument contract specifications, currency definitions, and valuation models.
Provides explicit contract units (multiplier, lot size, currencies) and FX conversion so position sizing, notionals, and P&L can be computed consistently in an account currency.
Structs§
- Contract
Spec - Detailed operative contract specifications complementing
crate::model::InstrumentMeta. - Currency
- An ISO currency code or currency symbol identifier (e.g. “EUR”, “USD”, “GBP”, “JPY”).
- FxRate
- An FX quote between two currencies:
base_currency / quote_currency = rate.
Enums§
- Contract
Spec Error - Errors when validating a
ContractSpec. - FxConversion
Error - Errors during foreign exchange currency conversion.
- Instrument
Type - Category of traded financial contract.
- Valuation
Error - Errors during contract valuation and sizing calculations.
Functions§
- contract_
pnl - Computes the realized or unrealized P&L in account currency:
(exit - entry) * direction * quantity * multiplier * fx_rate. - contract_
tick_ value - Computes the single-tick value in account currency:
tick_size * multiplier * fx_rate. - notional_
value - Computes the total notional value of a position in account currency:
quantity * price * multiplier * fx_rate. - stop_
risk_ amount - Computes the stop risk amount in account currency:
quantity * |entry - stop| * multiplier * fx_rate.