1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#[derive(thiserror::Error, Debug, Clone, Copy, Serialize, Deserialize)]
pub enum OrderError {
#[error("Maximum number of active orders reached")]
MaxActiveOrders,
#[error("Invalid limit price of order")]
InvalidLimitPrice,
#[error("Invalid trigger price for order. e.g.: sell stop market order trigger price > ask")]
InvalidTriggerPrice,
#[error("invalid order size")]
InvalidOrderSize,
#[error("The account does not have enough available balance to submit the order")]
NotEnoughAvailableBalance,
}
#[derive(thiserror::Error, Debug, Clone)]
pub enum Error {
#[error("Wrong leverage provided")]
ConfigWrongLeverage,
#[error("Wrong starting balance provided")]
ConfigWrongStartingBalance,
#[error("could not parse")]
ParseError,
#[error("user order id not found")]
UserOrderIdNotFound,
#[error("internal order id not found")]
OrderIdNotFound,
}
pub type Result<T> = std::result::Result<T, Error>;