cxmr-exchanges 0.0.1

Exchanges identifiers.
Documentation
//! 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>,
}