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
//! Crypto-bank exchanges information structures.

use hashbrown::HashMap;

use cxmr_balances::Balance;
use cxmr_currency::{Currency, CurrencyPair};

use super::{Exchange, MarketFilter, MarketStatus, OrderType, RateLimit};

/// Account information.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AccountInfo {
    /// Internal account ID.
    pub account: String,

    /// True if user can trade.
    pub can_trade: bool,

    /// Balances in points.
    pub balances: HashMap<Currency, Balance>,

    /// Maker fee rate in bips (1/10_000).
    pub maker_fee_rate: u64,

    /// Taker fee rate in bips (1/10_000).
    pub taker_fee_rate: u64,

    /// Timestamp of info.
    pub updated_at: u64,
}

/// Exchange information.
#[derive(Debug, Serialize)]
pub struct ExchangeInfo {
    /// Exchange identifier.
    pub exchange: Exchange,

    /// Exchange rate limits.
    pub limits: Vec<RateLimit>,

    /// Exchange markets.
    pub markets: Vec<MarketInfo>,
}

/// Market information.
#[derive(Debug, Serialize)]
pub struct MarketInfo {
    /// Market currency pair.
    pub pair: CurrencyPair,

    /// Market trading status.
    pub status: MarketStatus,

    /// Market order filters.
    pub filters: Vec<MarketFilter>,

    /// Market order types.
    pub order_types: Vec<OrderType>,
}