Expand description
quant-system-core package (qs_core library) - Core trade engine for the quant-system workspace.
This crate provides the synchronous, side-effect-free trading domain used by deterministic replay and trading applications. It contains the trade engine, strict raw signals, management-policy resolution, position sizing, and currency-conversion logic, but performs no configuration IO, networking, storage, state lookup, or broker calls.
§Key types
| Type | Purpose |
|---|---|
TradeEngine | Main entry point - processes actions and price updates |
Position | Atomic unit of market exposure with data and rules |
Rule | Composable management rule such as stoploss, trailing, or take profit |
Action | Concrete engine input vocabulary |
Effect | Observable engine output for the caller |
Signal | Timestamped action for replay or backtesting |
§Design principle
Effects out, logic pure. The engine never performs IO. It takes inputs
(Action, PriceQuote) and returns Vec<Effect>. The caller decides how
to handle effects for replay, accounting, or other application behavior.
Re-exports§
pub use alert_register::PriceAlertRegister;pub use costs::CommissionModel;pub use costs::CostBasis;pub use costs::CostCharge;pub use costs::CostKind;pub use costs::CostValidationError;pub use costs::InstrumentCosts;pub use costs::SwapAmount;pub use costs::SwapSchedule;pub use costs::rollover_instants;pub use currency::ConversionError;pub use currency::ConversionLeg;pub use currency::ConversionLegAudit;pub use currency::ConversionPriceSide;pub use currency::ConversionQuoteBook;pub use currency::ConversionResult;pub use currency::ConversionRoute;pub use currency::FxPair;pub use currency::FxPairDirection;pub use currency::QuoteValidationError;pub use currency::RunCurrencyPlan;pub use currency::RunCurrencyPlanError;pub use currency::resolve_conversion_route;pub use currency::resolve_fx_pair;pub use engine::FutureApplyError;pub use engine::FutureApplyResult;pub use engine::TradeEngine;pub use error::CoreError;pub use error::Result;pub use execution::ExecutionError;pub use execution::ExecutionPricer;pub use execution::ExecutionResult;pub use position::Position;pub use profile::EntryLevelResolution;pub use profile::EntryResolutionContext;pub use profile::GeneratedTargetResolution;pub use profile::ManagementProfile;pub use profile::PositionRef;pub use profile::PositionResolver;pub use profile::PriceGridSource;pub use profile::ProfileApplicationError;pub use profile::ProfileValidationError;pub use profile::RawSignal;pub use profile::ResolvedEntry;pub use profile::RuleConfigDef;pub use profile::StoplossMode;pub use profile::TargetResolution;pub use profile::TargetResolutionSource;pub use profile::TargetSelection;pub use profile::TargetSource;pub use profile::allocate_target_steps;pub use profile::allocate_target_units;pub use profile::resolve_signal;pub use profile::resolve_unprofiled_entry;pub use profile::validate_profile;pub use rules::Rule;pub use sizing::InstrumentSizingError;pub use sizing::LotCapStatus;pub use sizing::SizingError;pub use sizing::SizingPolicy;pub use sizing::SizingResult;pub use sizing::compute_instrument_native_loss_per_lot;pub use sizing::compute_instrument_size;pub use sizing::compute_instrument_size_for_spec;pub use sizing::compute_instrument_size_for_spec_with_prices;pub use sizing::compute_size;pub use types::Action;pub use types::CloseReason;pub use types::Effect;pub use types::EffectiveStop;pub use types::ExecutionConvention;pub use types::ExecutionFill;pub use types::ExecutionModel;pub use types::Fill;pub use types::FillModel;pub use types::FillPurpose;pub use types::FixedPrice;pub use types::FutureEffect;pub use types::FutureFill;pub use types::GroupId;pub use types::Lots;pub use types::OrderType;pub use types::PositionId;pub use types::PositionRecord;pub use types::PositionStatus;pub use types::PreparedPendingFill;pub use types::PriceQuote;pub use types::RuleConfig;pub use types::Side;pub use types::Signal;pub use types::SlippageModel;pub use types::StopOrigin;pub use types::TargetSpec;pub use types::TradeId;pub use validation::RawSignalValidationError;pub use validation::validate_entry_class;pub use validation::validate_raw_signal;pub use validation::validate_raw_signals;
Modules§
- alert_
register - Price alert register — BTreeMap-indexed rule evaluation for O(log N + K) per tick.
- costs
- Pure trading-cost arithmetic for commission and overnight swap.
- currency
- Deterministic account-currency conversion from historical FX ticks.
- engine
- Trade engine — the main entry point for processing actions and price updates.
- error
- execution
- Pure, deterministic execution pricing.
- position
- Position — the atomic unit of market exposure.
- position_
manager - Position manager — collection of positions with lookup helpers.
- profile
- Management profiles — decouple entry signals from trade management.
- rules
- Composable position management rules.
- sizing
- In-place account position sizing for backtests.
- types
- Core type definitions shared across the trade engine.
- validation
- Shared raw-signal validation.