Expand description
§rustrade-core
Core types and traits for the rustrade trading bot framework.
This crate is the type-layer foundation used by every other crate in the
rustrade ecosystem. It is deliberately dependency-light and contains
no I/O, no async runtime state, and no exchange-specific logic.
§What lives here
- Domain types:
Price,Volume,Candle,Tick,Order,Fill,Position - Trading intents:
Signal,Decision,SizeHint - Trait contracts:
Brain,ExchangeClient,MarketSource - Broadcast buses:
MarketDataBus,SignalBus - State persistence:
StateStore,InMemoryStore - Error types:
Error,Result
§What does NOT live here
- Service lifecycle / supervision →
rustrade-supervisor - Risk calculations →
rustrade-risk - Backtest replay →
rustrade-backtest - Exchange clients → separate crates (e.g.
exchange-apiws) - Indicator implementations → separate crates (e.g.
indicators-ta)
§Design principles
- Zero runtime deps beyond tokio primitives. No HTTP, no Redis, no tracing-subscriber, no prometheus. Downstream crates add those.
- Newtype wrappers for numeric quantities to prevent unit confusion.
- Traits are narrow. Implementors should not need to stub dozens of methods they don’t care about.
- Traits are object-safe where possible so
Box<dyn Brain>works.
Re-exports§
pub use brain::Brain;pub use brain::BrainHealth;pub use brain::Decision;pub use brain::SizeHint;pub use bus::MarketDataBus;pub use bus::SignalBus;pub use error::Error;pub use error::Result;pub use exchange::CandleSource;pub use exchange::Capability;pub use exchange::EventSource;pub use exchange::ExchangeClient;pub use exchange::FillSource;pub use exchange::MarketSource;pub use exchange::OpenOrder;pub use exchange::OrderStatus;pub use instrument::AssetClass;pub use instrument::InstrumentSpec;pub use market::Exchange;pub use market::MarketDataEvent;pub use market::Side;pub use market::Symbol;pub use metrics::MetricsSink;pub use metrics::NoopSink;pub use signal::Signal;pub use signal::SignalType;pub use store::InMemoryStore;pub use store::StateStore;pub use types::Candle;pub use types::Fill;pub use types::Order;pub use types::OrderKind;pub use types::Position;pub use types::Price;pub use types::StopAttachment;pub use types::StopKind;pub use types::Tick;pub use types::Volume;
Modules§
- brain
- The
Braintrait — rustrade’s central abstraction. - bus
- In-process broadcast buses for market events and signals.
- error
- Unified error type for the rustrade framework.
- exchange
- Trait contracts for exchange integrations.
- instrument
- Instrument metadata — the exchange/asset-specific knobs the framework needs to size and round orders correctly, and to apply asset-class-aware rules.
- market
- Exchange-agnostic market data primitives.
- metrics
- Pluggable metrics sink.
- signal
- Trading signals — the output of a
crate::Brain. - store
- Persistence contract for framework state that must survive restarts.
- types
- Domain types using the newtype pattern to prevent unit-confusion bugs.