pub enum Error {
Show 23 variants
CandleDataEmpty,
CandleNotFound,
InvalidFactor,
MissingField(&'static str),
InvalidPriceOrder(f64, f64, f64, f64),
NegativeVolume(f64),
InvalideTimes(DateTime<Utc>, DateTime<Utc>),
NegZeroBalance(f64),
InsufficientFunds(f64, f64),
NegFreeBalance(f64, f64),
NegZeroFees,
UnlockBalance(f64, f64),
OrderNotFound,
RemoveOrder,
PositionNotFound,
RemovePosition,
ExitPrice(f64),
Msg(String),
NegTakeProfitAndStopLoss,
NegZeroTrailingStop,
MismatchedOrderType,
Io(Error),
MutexPoisoned(String),
}Expand description
Custom error types for the bts library.
Variants§
CandleDataEmpty
The candle data provided is empty.
Backtesting requires at least one candle to execute.
CandleNotFound
The requested candle was not found in the dataset.
InvalidFactor
The Aggregator factor is invalid.
MissingField(&'static str)
A required field is missing.
InvalidPriceOrder(f64, f64, f64, f64)
Prices are not in valid order (open ≤ low ≤ high ≤ close).
NegativeVolume(f64)
Volume cannot be negative.
InvalideTimes(DateTime<Utc>, DateTime<Utc>)
Open time and close time are not in valid order (open time < close time).
NegZeroBalance(f64)
InsufficientFunds(f64, f64)
The wallet does not have enough funds to place the order.
§Arguments
0- The required amount.1- The available amount.
NegFreeBalance(f64, f64)
NegZeroFees
The fees are negative.
UnlockBalance(f64, f64)
The locked funds are insufficient for the requested amount.
§Arguments
0- The currently locked funds.1- The requested amount to unlock.
OrderNotFound
The requested order was not found.
RemoveOrder
Failed to remove an order.
PositionNotFound
The requested position was not found.
RemovePosition
Failed to remove a position.
ExitPrice(f64)
The exit price is invalid.
Msg(String)
NegTakeProfitAndStopLoss
Take profit or stop loss values must be positive.
NegZeroTrailingStop
Trailing stop values must be positive.
MismatchedOrderType
The order type is not compatible with the operation.
Use market or limit orders to open a position, and take profit, stop loss, or trailing stop to close a position.
Io(Error)
MutexPoisoned(String)
A mutex was poisoned.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Error
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Error for Error
impl Error for Error
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
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more