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 backtesting and future live integrations. It contains the trade engine, strict raw signals, canonical trade intent and execution facts, 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 |
TradeIntent | Source-neutral and strategy-neutral desired economic action |
ExecutionCommandEnvelope | Immutable identity envelope for a typed gateway command |
ExecutionReport | Venue-neutral economic execution fact |
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 (simulate fills for backtest, send broker orders for live).
Re-exports§
pub use alert_register::PriceAlertRegister;pub use canonical::CanonicalDomainError;pub use canonical::DateTimeUtc;pub use canonical::DurationMillis;pub use canonical::ExecutionCapability;pub use canonical::ExecutionCommandId;pub use canonical::FillId;pub use canonical::IntentCampaignRef;pub use canonical::IntentCorrelationId;pub use canonical::IntentIdentityNamespace;pub use canonical::IntentPositionRef;pub use canonical::IntentProducerId;pub use canonical::IntentStateRef;pub use canonical::OpaquePayloadRef;pub use canonical::OpaqueProvenanceRef;pub use canonical::OperatingMode;pub use canonical::PositiveFraction;pub use canonical::PriceDistance;pub use canonical::TradeIntentId;pub use canonical::VenueOrderRef;pub use canonical::VenuePositionRef;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::ManagementProfile;pub use profile::PositionRef;pub use profile::PositionResolver;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::TargetSelection;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_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_raw_signal;pub use validation::validate_raw_signals;pub use execution_events::*;pub use intent::*;
Modules§
- alert_
register - Price alert register — BTreeMap-indexed rule evaluation for O(log N + K) per tick.
- canonical
- 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.
- execution_
events - intent
- 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.