pub enum FinError {
Show 14 variants
InvalidSymbol(String),
InvalidPrice(Decimal),
InvalidQuantity(Decimal),
SequenceMismatch {
expected: u64,
got: u64,
},
InsufficientLiquidity(Decimal),
BarInvariant(String),
SignalNotReady {
name: String,
required: usize,
have: usize,
},
PositionNotFound(String),
InsufficientFunds {
need: Decimal,
have: Decimal,
},
InvalidTimeframe,
ArithmeticOverflow,
InvertedSpread {
best_bid: Decimal,
best_ask: Decimal,
},
InvalidPeriod(usize),
InvalidInput(String),
}Expand description
All errors that can occur in fin-primitives operations.
Variants§
InvalidSymbol(String)
Symbol string was empty or contained whitespace.
InvalidPrice(Decimal)
Price value was zero or negative.
InvalidQuantity(Decimal)
Quantity value was negative.
SequenceMismatch
Order book delta arrived out of sequence.
Fields
InsufficientLiquidity(Decimal)
Not enough resting liquidity to fill the requested quantity.
BarInvariant(String)
OHLCV bar failed internal invariant check (high >= low, etc.).
SignalNotReady
A signal has not accumulated enough bars to produce a value.
Fields
PositionNotFound(String)
Position lookup failed for the given symbol.
InsufficientFunds
Ledger cash balance insufficient to cover the fill cost.
Fields
InvalidTimeframe
Timeframe duration was zero or negative.
ArithmeticOverflow
A Decimal arithmetic operation overflowed.
InvertedSpread
Order book ended up with an inverted spread after a delta was applied.
Fields
InvalidPeriod(usize)
Indicator or aggregator period was zero; must be at least 1.
InvalidInput(String)
General-purpose validation error for invalid inputs.
Implementations§
Trait Implementations§
Source§impl Error for FinError
impl Error for FinError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()