xapi_binance/data/
exchange_information.rs1use crate::data::enums::{
2 contract_status::BnContractStatus, contract_type::BnContractType, order_type::BnOrderType,
3 ratelimit::BnRateLimit, symbol_filter::BnSymbolFilter, symbol_status::BnSymbolStatus,
4};
5use chrono::{DateTime, Utc};
6use rust_decimal::Decimal;
7use serde::Deserialize;
8use serde_with::{TimestampMilliSeconds, formats::Flexible};
9use xapi_shared::data::{crypto_asset::CryptoAsset, crypto_symbol::CryptoSymbol};
10
11#[derive(Deserialize, Debug, Clone)]
12#[serde(rename_all = "camelCase")]
13pub struct BnSpotExchangeInformation {
14 pub rate_limits: Vec<BnRateLimit>,
15 pub symbols: Vec<BnSpotExchangeSymbol>,
16}
17
18#[derive(Deserialize, Debug, Clone)]
19#[serde(rename_all = "camelCase")]
20pub struct BnSpotExchangeSymbol {
21 pub symbol: CryptoSymbol,
22 pub status: BnSymbolStatus,
23 pub base_asset: CryptoAsset,
24 pub base_asset_precision: u8,
25 pub quote_asset: CryptoAsset,
26 pub quote_precision: Option<u8>,
28 pub quote_asset_precision: u8,
29 pub base_commission_precision: u8,
30 pub quote_commission_precision: u8,
31 pub order_types: Vec<BnOrderType>,
32 pub iceberg_allowed: bool,
33 pub oco_allowed: bool,
34 pub oto_allowed: bool,
35 pub quote_order_qty_market_allowed: bool,
36 pub allow_trailing_stop: bool,
37 pub cancel_replace_allowed: bool,
38 pub amend_allowed: bool,
39 pub is_spot_trading_allowed: bool,
40 pub is_margin_trading_allowed: bool,
41 pub filters: Vec<BnSymbolFilter>,
42}
43
44#[derive(Deserialize, Debug, Clone)]
45#[serde(rename_all = "camelCase")]
46pub struct BnUsdmExchangeInformation {
47 pub assets: Vec<BnUsdmExchangeAsset>,
48 pub symbols: Vec<BnUsdmExchangeSymbol>,
49 pub timezone: String,
50}
51
52#[derive(Deserialize, Debug, Clone)]
53#[serde(rename_all = "camelCase")]
54pub struct BnUsdmExchangeAsset {
55 pub asset: CryptoAsset,
56 pub margin_available: bool,
58 pub auto_asset_exchange: Decimal,
60}
61
62#[serde_with::serde_as]
63#[derive(Deserialize, Debug, Clone)]
64#[serde(rename_all = "camelCase")]
65pub struct BnUsdmExchangeSymbol {
66 pub symbol: CryptoSymbol,
67 pub pair: String,
68 pub contract_type: BnContractType,
69 #[serde_as(as = "TimestampMilliSeconds<String, Flexible>")]
70 pub delivery_date: DateTime<Utc>,
71 #[serde_as(as = "TimestampMilliSeconds<String, Flexible>")]
72 pub onboard_date: DateTime<Utc>,
73 pub status: BnContractStatus,
74 pub base_asset: CryptoAsset,
75 pub quote_asset: CryptoAsset,
76 pub margin_asset: CryptoAsset,
77 pub underlying_type: String,
78 pub underlying_sub_type: Vec<String>,
79 pub filters: Vec<BnSymbolFilter>,
80 pub liquidation_fee: Decimal,
81 pub market_take_bound: Decimal,
82}