Expand description
Exchange adapter trait and exchange-facing DTOs.
Adapters implement Exchange to translate canonical bot commands into
concrete exchange API calls. The engine owns retries, state transitions, and
event generation; adapters return structured results and errors.
§Example
use bot_core::{
ClientOrderId, InstrumentId, MarketIndex, OrderInput, OrderSide, Price, Qty, TimeInForce,
};
use rust_decimal::Decimal;
let input = OrderInput {
instrument: InstrumentId::new("BTC-PERP"),
market_index: MarketIndex::new(0),
client_id: ClientOrderId::new("client-1"),
side: OrderSide::Buy,
price: Price::new(Decimal::new(65_000, 0)),
qty: Qty::new(Decimal::new(1, 3)),
tif: TimeInForce::Gtc,
post_only: true,
reduce_only: false,
};
assert!(input.post_only);Structs§
- Account
Balance - Account balance reported by an exchange.
- Exchange
Position - Position reported by an exchange.
- Fill
- A fill from userFills
- Order
Input - Input parameters for placing an order.
Enums§
- Exchange
Error - Errors returned by exchange operations.
- Place
Order Result - Result of placing an order
Traits§
- Exchange
- Exchange adapter trait - what each exchange must implement.