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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SymbolList {
    pub symbol: String,
    pub name: String,
    pub base_currency: String,
    pub quote_currency: String,
    pub base_min_size: String,
    pub base_max_size: String,
    pub quote_max_size: String,
    pub base_increment: String,
    pub quote_increment: String,
    pub price_increment: String,
    pub fee_currency: String,
    pub enable_trading: bool,
    pub is_margin_enabled: bool,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Ticker {
    pub sequence: String,
    pub best_ask: String,
    pub size: String,
    pub price: String,
    pub best_bid_size: String,
    pub best_bid: String,
    pub best_ask_size: String,
    pub time: i64,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AllTickers {
    pub time: i64,
    pub ticker: Vec<Tick>,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Tick {
    pub symbol: String,
    pub symbol_name: String,
    pub buy: String,
    pub sell: String,
    pub change_rate: Option<String>,
    pub change_price: Option<String>,
    pub high: Option<String>,
    pub low: Option<String>,
    pub vol: String,
    pub vol_value: String,
    pub last: String,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DailyStats {
    pub symbol: String,
    pub buy: String,
    pub sell: String,
    pub change_rate: Option<String>,
    pub change_price: Option<String>,
    pub high: Option<String>,
    pub low: Option<String>,
    pub vol: String,
    pub vol_value: String,
    pub last: String,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OrderBook {
    pub sequence: String,
    pub time: i64,
    pub bids: Vec<Vec<String>>,
    pub asks: Vec<Vec<String>>,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AtomicOrderBook {
    pub sequence: i64,
    pub time: i64,
    pub bids: Vec<(String, String, String, i64)>,
    pub asks: Vec<(String, String, String, i64)>,
}

pub enum OrderBookType {
    L20,
    L100,
    Full,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TradeHistories {
    pub sequence: String,
    pub price: String,
    pub size: String,
    pub side: String,
    pub time: i64,
}

pub enum Klines {
    K1min,
    K3min,
    K5min,
    K15min,
    K30min,
    K1hour,
    K2hour,
    K4hour,
    K6hour,
    K8hour,
    K12hour,
    K1day,
    K1week,
}

#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Currency {
    currency: String,
    name: String,
    full_name: String,
    precision: i32,
    withdrawal_min_size: String,
    withdrawal_min_fee: String,
    is_withdrawal_enabled: Option<bool>,
    is_deposit_enabled: bool,
    is_margin_enabled: bool,
    is_debit_enabled: bool,
}

pub enum Chain {
    OMNI,
    ERC20,
    TRC20,
}

pub enum Fiat {
    USD,
    EUR,
    CAD,
    CNY,
    AUD,
    KRW,
    JPY,
    GBP,
    INR,
    IDR,
    RUB,
    BRL,
    TRY,
    PLN,
    PHP,
    ZAR,
    THB,
    CHF,
    MYR,
    MXR,
    HRK,
    ARS,
    KZT,
    IRR,
    VND,
    ILS,
    BDT,
    HKD,
    TWD,
    COP,
    DKK,
    BGN,
    NOK,
    DZD,
    RON,
    SGD,
    NGN,
    CZK,
    PKR,
    SEK,
    NZD,
    UAH,
}