cxmr_exchanges/
info.rs

1//! Crypto-bank exchanges information structures.
2
3use hashbrown::HashMap;
4
5use cxmr_balances::Balance;
6use cxmr_currency::{Currency, CurrencyPair};
7
8use super::{Exchange, MarketFilter, MarketStatus, OrderType, RateLimit};
9
10/// Account information.
11#[derive(Serialize, Deserialize, Clone, Debug)]
12pub struct AccountInfo {
13    /// Internal account ID.
14    pub account: String,
15
16    /// True if user can trade.
17    pub can_trade: bool,
18
19    /// Balances in points.
20    pub balances: HashMap<Currency, Balance>,
21
22    /// Maker fee rate in bips (1/10_000).
23    pub maker_fee_rate: u64,
24
25    /// Taker fee rate in bips (1/10_000).
26    pub taker_fee_rate: u64,
27
28    /// Timestamp of info.
29    pub updated_at: u64,
30}
31
32/// Exchange information.
33#[derive(Debug, Serialize)]
34pub struct ExchangeInfo {
35    /// Exchange identifier.
36    pub exchange: Exchange,
37
38    /// Exchange rate limits.
39    pub limits: Vec<RateLimit>,
40
41    /// Exchange markets.
42    pub markets: Vec<MarketInfo>,
43}
44
45/// Market information.
46#[derive(Debug, Serialize)]
47pub struct MarketInfo {
48    /// Market currency pair.
49    pub pair: CurrencyPair,
50
51    /// Market trading status.
52    pub status: MarketStatus,
53
54    /// Market order filters.
55    pub filters: Vec<MarketFilter>,
56
57    /// Market order types.
58    pub order_types: Vec<OrderType>,
59}