sandbox_quant/error/
execution_error.rs1use thiserror::Error;
2
3use crate::error::exchange_error::ExchangeError;
4
5#[derive(Debug, Error, Clone, PartialEq)]
6pub enum ExecutionError {
7 #[error("close quantity too small")]
8 CloseQtyTooSmall,
9 #[error("no open position for close command")]
10 NoOpenPosition,
11 #[error("symbol could not be resolved on exchange: {0}")]
12 UnknownInstrument(String),
13 #[error("missing price context")]
14 MissingPriceContext,
15 #[error(
16 "order quantity too small for {instrument}: market={market} target_exposure={target_exposure:.4} equity_usdt={equity_usdt:.8} current_price={current_price:.8} target_notional_usdt={target_notional_usdt:.8} raw={raw_qty:.8} normalized={normalized_qty:.8} min_qty={min_qty:.8} step_size={step_size:.8}"
17 )]
18 OrderQtyTooSmall {
19 instrument: String,
20 market: String,
21 target_exposure: f64,
22 equity_usdt: f64,
23 current_price: f64,
24 target_notional_usdt: f64,
25 raw_qty: f64,
26 normalized_qty: f64,
27 min_qty: f64,
28 step_size: f64,
29 },
30 #[error("exchange submit failed: {0}")]
31 SubmitFailed(#[from] ExchangeError),
32}