Skip to main content

ccdata_api/schemas/data_api/
spot.rs

1use std::{fmt::Display, collections::HashMap};
2use serde::{Serialize, Deserialize};
3use crate::schemas::data_api::InstrumentStatus;
4
5
6#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
7/// The exchange to obtain data from.
8pub enum SpotMarket {
9    AAX,
10    ABCC,
11    ACX,
12    AIDOSMARKET,
13    ALPHAEX,
14    ARCHAX,
15    ASCENDEX,
16    ATAIX,
17    BACKPACK,
18    BEQUANT,
19    BGOGO,
20    BIBOX365,
21    BIGONE,
22    BILAXY,
23    BINANCE,
24    BINANCEAGGREGATE,
25    BINANCETR,
26    BINANCEUSA,
27    BINGX,
28    BISQ,
29    BIT,
30    BIT2C,
31    BITBANK,
32    BITBAY,
33    BITBNS,
34    BITBUY,
35    BITCI,
36    BITEXBOOK,
37    BITFEX,
38    BITFINEX,
39    BITFLYER,
40    BITFLYEREU,
41    BITFLYERFX,
42    BITFLYERUS,
43    BITFOREX,
44    BITGET,
45    BITHUMBGLOBAL,
46    BITHUMBKOREA,
47    BITINKA,
48    BITKUB,
49    BITMART,
50    BITMEX,
51    BITPANDA,
52    BITRUE,
53    BITSO,
54    BITSTAMP,
55    BITTREX,
56    BITVAVO,
57    BKEX,
58    BLACKTURTLE,
59    BLEUTRADE,
60    BLOCKCHAINCOM,
61    BTCALPHA,
62    BTCBOX,
63    BTCEX,
64    BTCMARKETS,
65    BTCTURK,
66    BTSE,
67    BUDA,
68    BULLISH,
69    BUYUCOIN,
70    BWEXCHANGE,
71    BYBIT,
72    BYDFI,
73    CATEX,
74    CEXIO,
75    COINBASE,
76    COINBASEINTERNATIONAL,
77    COINCHECK,
78    COINCORNER,
79    COINDCX,
80    COINDEAL,
81    COINEX,
82    COINFALCON,
83    COINFIELD,
84    COINJAR,
85    COINMATE,
86    COINONE,
87    COINSBIT,
88    COINSPRO,
89    COINTIGER,
90    COINW,
91    COSS,
92    CREX24,
93    CROSSTOWER,
94    CRYPTOCARBON,
95    CRYPTODOTCOM,
96    CRYPTOPIA,
97    CRYPTSY,
98    CUBE,
99    CURRENCY,
100    DCOIN,
101    DDEX,
102    DECOIN,
103    DERIBIT,
104    DIGIFINEX,
105    ERISX,
106    ETORO,
107    EXMO,
108    FCOIN,
109    FOXBIT,
110    FTX,
111    FTXUS,
112    GARANTEX,
113    GATEIO,
114    GEMINI,
115    GLOBITEX,
116    GOPAX,
117    GRAVIEX,
118    HASHKEY,
119    HITBTC,
120    HUOBIJAPAN,
121    HUOBIPRO,
122    INDEPENDENTRESERVE,
123    INDODAX,
124    INDOEX,
125    INX,
126    ITBIT,
127    KORBIT,
128    #[default]
129    KRAKEN,
130    KUCOIN,
131    KUNA,
132    LATOKEN,
133    LBANK,
134    LIQNET,
135    LIQUID,
136    LITEBIT,
137    LMAX,
138    LUNO,
139    LYKKE,
140    MERCADOBTC,
141    MERCATOX,
142    MEXC,
143    MOCK,
144    MTGOX,
145    NDAX,
146    NOMINEX,
147    OKCOIN,
148    OKEX,
149    ONETRADING,
150    OSL,
151    OSLHONGKONG,
152    P2PB2B,
153    PANCAKESWAP,
154    PARAMOUNTDAX,
155    PARIBU,
156    PHEMEX,
157    POLONIEX,
158    PROBIT,
159    SAFETRADE,
160    SIGENPRO,
161    SIMEX,
162    SWITCHEO,
163    THEROCKTRADING,
164    TIDEFI,
165    TIMEX,
166    TOKENOMY,
167    TRADEOGRE,
168    UNISWAP,
169    UNOCOIN,
170    UPBIT,
171    VALR,
172    VITEX,
173    WAZIRX,
174    WHITEBIT,
175    WOO,
176    XCOEX,
177    XTPUB,
178    YELLOW,
179    YOBIT,
180    ZAIF,
181    ZBDOTCOM,
182    ZBG,
183    ZEBITEX,
184    ZONDA,
185}
186
187impl Display for SpotMarket {
188    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
189        match self {
190            Self::AAX => write!(f, "aax"),
191            Self::ABCC => write!(f, "abcc"),
192            Self::ACX => write!(f, "acx"),
193            Self::AIDOSMARKET => write!(f, "aidosmarket"),
194            Self::ALPHAEX => write!(f, "alphaex"),
195            Self::ARCHAX => write!(f, "archax"),
196            Self::ASCENDEX => write!(f, "ascendex"),
197            Self::ATAIX => write!(f, "ataix"),
198            Self::BACKPACK => write!(f, "backpack"),
199            Self::BEQUANT => write!(f, "bequant"),
200            Self::BGOGO => write!(f, "bgogo"),
201            Self::BIBOX365 => write!(f, "bibox365"),
202            Self::BIGONE => write!(f, "bigone"),
203            Self::BILAXY => write!(f, "bilaxy"),
204            Self::BINANCE => write!(f, "binance"),
205            Self::BINANCEAGGREGATE => write!(f, "binanceaggreagate"),
206            Self::BINANCETR => write!(f, "binancetr"),
207            Self::BINANCEUSA => write!(f, "binanceusa"),
208            Self::BINGX => write!(f, "bingx"),
209            Self::BISQ => write!(f, "bisq"),
210            Self::BIT => write!(f, "bit"),
211            Self::BIT2C => write!(f, "bit2c"),
212            Self::BITBANK => write!(f, "bitbank"),
213            Self::BITBAY => write!(f, "bitbay"),
214            Self::BITBNS => write!(f, "bitbns"),
215            Self::BITBUY => write!(f, "bitbuy"),
216            Self::BITCI => write!(f, "bitci"),
217            Self::BITEXBOOK => write!(f, "bitexbook"),
218            Self::BITFEX => write!(f, "bitfex"),
219            Self::BITFINEX => write!(f, "bitfinex"),
220            Self::BITFLYER => write!(f, "bitflyer"),
221            Self::BITFLYEREU => write!(f, "bitflyereu"),
222            Self::BITFLYERFX => write!(f, "bitflyerfx"),
223            Self::BITFLYERUS => write!(f, "bitflyerus"),
224            Self::BITFOREX => write!(f, "bitforex"),
225            Self::BITGET => write!(f, "bitget"),
226            Self::BITHUMBGLOBAL => write!(f, "bithumbglobal"),
227            Self::BITHUMBKOREA => write!(f, "bithumbkorea"),
228            Self::BITINKA => write!(f, "bitinka"),
229            Self::BITKUB => write!(f, "bitkub"),
230            Self::BITMART => write!(f, "bitmart"),
231            Self::BITMEX => write!(f, "bitmex"),
232            Self::BITPANDA => write!(f, "bitpanda"),
233            Self::BITRUE => write!(f, "bitrue"),
234            Self::BITSO => write!(f, "bitso"),
235            Self::BITSTAMP => write!(f, "bitstamp"),
236            Self::BITTREX => write!(f, "bittrex"),
237            Self::BITVAVO => write!(f, "bitvavo"),
238            Self::BKEX => write!(f, "bkex"),
239            Self::BLACKTURTLE => write!(f, "blackturtle"),
240            Self::BLEUTRADE => write!(f, "bleutrade"),
241            Self::BLOCKCHAINCOM => write!(f, "blockchaindotcom"),
242            Self::BTCALPHA => write!(f, "btcalpha"),
243            Self::BTCBOX => write!(f, "btcbox"),
244            Self::BTCEX => write!(f, "btcex"),
245            Self::BTCMARKETS => write!(f, "btcmarkets"),
246            Self::BTCTURK => write!(f, "btcturk"),
247            Self::BTSE => write!(f, "btse"),
248            Self::BUDA => write!(f, "buda"),
249            Self::BULLISH => write!(f, "bullish"),
250            Self::BUYUCOIN => write!(f, "buyucoin"),
251            Self::BWEXCHANGE => write!(f, "bwexchange"),
252            Self::BYBIT => write!(f, "bybit"),
253            Self::BYDFI => write!(f, "bydfi"),
254            Self::CATEX => write!(f, "catex"),
255            Self::CEXIO => write!(f, "cexio"),
256            Self::COINBASE => write!(f, "coinbase"),
257            Self::COINBASEINTERNATIONAL => write!(f, "coinbaseinternational"),
258            Self::COINCHECK => write!(f, "coincheck"),
259            Self::COINCORNER => write!(f, "coincorner"),
260            Self::COINDCX => write!(f, "coindcx"),
261            Self::COINDEAL => write!(f, "coindeal"),
262            Self::COINEX => write!(f, "coinex"),
263            Self::COINFALCON => write!(f, "coinfalcon"),
264            Self::COINFIELD => write!(f, "coinfield"),
265            Self::COINJAR => write!(f, "coinjar"),
266            Self::COINMATE => write!(f, "coinmate"),
267            Self::COINONE => write!(f, "coinone"),
268            Self::COINSBIT => write!(f, "coinsbit"),
269            Self::COINSPRO => write!(f, "coinspro"),
270            Self::COINTIGER => write!(f, "cointiger"),
271            Self::COINW => write!(f, "coinw"),
272            Self::COSS => write!(f, "coss"),
273            Self::CREX24 => write!(f, "crex24"),
274            Self::CROSSTOWER => write!(f, "crosstower"),
275            Self::CRYPTOCARBON => write!(f, "cryptocarbon"),
276            Self::CRYPTODOTCOM => write!(f, "cryptodotcom"),
277            Self::CRYPTOPIA => write!(f, "cryptopia"),
278            Self::CRYPTSY => write!(f, "cryptsy"),
279            Self::CUBE => write!(f, "cube"),
280            Self::CURRENCY => write!(f, "currency"),
281            Self::DCOIN => write!(f, "dcoin"),
282            Self::DDEX => write!(f, "ddex"),
283            Self::DECOIN => write!(f, "decoin"),
284            Self::DERIBIT => write!(f, "deribit"),
285            Self::DIGIFINEX => write!(f, "digifinex"),
286            Self::ERISX => write!(f, "erisx"),
287            Self::ETORO => write!(f, "etoro"),
288            Self::EXMO => write!(f, "exmo"),
289            Self::FCOIN => write!(f, "fcoin"),
290            Self::FOXBIT => write!(f, "foxbit"),
291            Self::FTX => write!(f, "ftx"),
292            Self::FTXUS => write!(f, "ftxus"),
293            Self::GARANTEX => write!(f, "garantex"),
294            Self::GATEIO => write!(f, "gateio"),
295            Self::GEMINI => write!(f, "gemini"),
296            Self::GLOBITEX => write!(f, "globitex"),
297            Self::GOPAX => write!(f, "gopax"),
298            Self::GRAVIEX => write!(f, "graviex"),
299            Self::HASHKEY => write!(f, "hashkey"),
300            Self::HITBTC => write!(f, "hitbtc"),
301            Self::HUOBIJAPAN => write!(f, "huobijapan"),
302            Self::HUOBIPRO => write!(f, "huobipro"),
303            Self::INDEPENDENTRESERVE => write!(f, "independentreserve"),
304            Self::INDODAX => write!(f, "indodax"),
305            Self::INDOEX => write!(f, "indoex"),
306            Self::INX => write!(f, "inx"),
307            Self::ITBIT => write!(f, "itbit"),
308            Self::KORBIT => write!(f, "korbit"),
309            Self::KRAKEN => write!(f, "kraken"),
310            Self::KUCOIN => write!(f, "kucoin"),
311            Self::KUNA => write!(f, "kuna"),
312            Self::LATOKEN => write!(f, "latoken"),
313            Self::LBANK => write!(f, "lbank"),
314            Self::LIQNET => write!(f, "liqnet"),
315            Self::LIQUID => write!(f, "liquid"),
316            Self::LITEBIT => write!(f, "litebit"),
317            Self::LMAX => write!(f, "lmax"),
318            Self::LUNO => write!(f, "luno"),
319            Self::LYKKE => write!(f, "lykke"),
320            Self::MERCADOBTC => write!(f, "mercadobtc"),
321            Self::MERCATOX => write!(f, "mercatox"),
322            Self::MEXC => write!(f, "mexc"),
323            Self::MOCK => write!(f, "mock"),
324            Self::MTGOX => write!(f, "mtgox"),
325            Self::NDAX => write!(f, "ndax"),
326            Self::NOMINEX => write!(f, "nominex"),
327            Self::OKCOIN => write!(f, "okcoin"),
328            Self::OKEX => write!(f, "okex"),
329            Self::ONETRADING => write!(f, "onetrading"),
330            Self::OSL => write!(f, "osl"),
331            Self::OSLHONGKONG => write!(f, "oslhongkong"),
332            Self::P2PB2B => write!(f, "p2pb2b"),
333            Self::PANCAKESWAP => write!(f, "pancakeswap"),
334            Self::PARAMOUNTDAX => write!(f, "paramountdax"),
335            Self::PARIBU => write!(f, "paribu"),
336            Self::PHEMEX => write!(f, "phemex"),
337            Self::POLONIEX => write!(f, "poloniex"),
338            Self::PROBIT => write!(f, "probit"),
339            Self::SAFETRADE => write!(f, "safetrade"),
340            Self::SIGENPRO => write!(f, "sigenpro"),
341            Self::SIMEX => write!(f, "simex"),
342            Self::SWITCHEO => write!(f, "switcheo"),
343            Self::THEROCKTRADING => write!(f, "therocktrading"),
344            Self::TIDEFI => write!(f, "tidefi"),
345            Self::TIMEX => write!(f, "timex"),
346            Self::TOKENOMY => write!(f, "tokenomy"),
347            Self::TRADEOGRE => write!(f, "tradeogre"),
348            Self::UNISWAP => write!(f, "uniswap"),
349            Self::UNOCOIN => write!(f, "unocoin"),
350            Self::UPBIT => write!(f, "upbit"),
351            Self::VALR => write!(f, "valr"),
352            Self::VITEX => write!(f, "vitex"),
353            Self::WAZIRX => write!(f, "waxirx"),
354            Self::WHITEBIT => write!(f, "whitebit"),
355            Self::WOO => write!(f, "woo"),
356            Self::XCOEX => write!(f, "xcoex"),
357            Self::XTPUB => write!(f, "xtpub"),
358            Self::YELLOW => write!(f, "yellow"),
359            Self::YOBIT => write!(f, "yobit"),
360            Self::ZAIF => write!(f, "zaif"),
361            Self::ZBDOTCOM => write!(f, "zbdotcom"),
362            Self::ZBG => write!(f, "zbg"),
363            Self::ZEBITEX => write!(f, "zebitex"),
364            Self::ZONDA => write!(f, "zonda"),
365        }        
366    }
367}
368
369
370#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
371/// The status of the instrument, can be one of the following: ACTIVE, IGNORED, RETIRED, EXPIRED.
372pub enum SpotInstrumentStatus {
373    #[default]
374    ACTIVE,
375    IGNORED,
376    RETIRED,
377    EXPIRED,
378    READYFORDECOMMISSIONING,
379}
380
381impl Display for SpotInstrumentStatus {
382    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
383        match self {
384            Self::ACTIVE => write!(f, "ACTIVE"),
385            Self::IGNORED => write!(f, "IGNORED"),
386            Self::RETIRED => write!(f, "RETIRED"),
387            Self::EXPIRED => write!(f, "EXPIRED"),
388            Self::READYFORDECOMMISSIONING => write!(f, "READY_FOR_DECOMMISSIONING"),
389        }
390    }
391}
392
393
394#[derive(Clone, Debug, Serialize, Deserialize)]
395pub struct SpotInstrumentMapping {
396    #[serde(rename = "MAPPED_INSTRUMENT")]
397    /// The current mapping dsv for this instrument.
398    pub mapped_instrument: String,
399    #[serde(rename = "BASE")]
400    /// The current mapping information for this instrument.
401    pub base: String,
402    #[serde(rename = "BASE_ID")]
403    /// Represents the internal CoinDesk ID for the base asset or coin (e.g., 1 for BTC). This ID is unique and immutable,
404    /// ensuring consistent identification. Applicable only to instruments with a mapping.
405    pub base_id: i32,
406    #[serde(rename = "QUOTE")]
407    /// The current mapping vs for this instrument.
408    pub quote: String,
409    #[serde(rename = "QUOTE_ID")]
410    /// Represents the internal CoinDesk ID for the quote asset or counter coin (e.g., 5 for USD). This ID is unique and immutable,
411    /// ensuring consistent identification. Applicable only to instruments with a mapping.
412    pub quote_id: i32,
413    #[serde(rename = "TRANSFORM_FUNCTION")]
414    /// The current mapping vsscds for this instrument.
415    pub transform_function: String,
416    #[serde(rename = "CREATED_ON")]
417    /// Timestamp for when this mapping was created.
418    pub created_on: i64,
419}
420
421
422// Spot: Historical OHLCV+
423
424
425/// Spot: Historical OHLCV+
426#[derive(Clone, Debug, Serialize, Deserialize)]
427pub struct SpotOHLCV {
428    #[serde(rename = "UNIT")]
429    /// The unit of the historical period update: MINUTE for minute, HOUR for hour and DAY for day.
430    pub unit: String,
431    #[serde(rename = "TIMESTAMP")]
432    /// The timestamp in seconds of the beginning of the histo period. For minute it would be every minute at the beginning of the minute,
433    /// for hour it would be the start of the hour and for daily it is 00:00 GMT.
434    pub timestamp: i64,
435    #[serde(rename = "TYPE")]
436    /// The type of message this is. It helps identify the nature of the data being returned.
437    pub type_: String,
438    #[serde(rename = "MARKET")]
439    /// The market / exchange under consideration (e.g. gemini, kraken, coinbase, etc).
440    pub market: String,
441    #[serde(rename = "INSTRUMENT")]
442    /// The unmapped instrument ID.
443    pub instrument: String,
444    #[serde(rename = "MAPPED_INSTRUMENT")]
445    /// The instrument ID, as derived from our mapping rules. This takes the form "BASE-QUOTE" (e.g. BTC-USD). Only available on instruments that have been mapped.
446    pub mapped_instrument: String,
447    #[serde(rename = "BASE")]
448    /// Represents the base asset or coin symbol, commonly known as the ticker (e.g., BTC). This symbol may change in cases of asset rebranding.
449    /// Applicable only to instruments with a mapping.
450    pub base: String,
451    #[serde(rename = "QUOTE")]
452    /// Represents the quote asset or counter coin symbol, commonly known as the ticker (e.g., USD). This symbol may change in cases of asset rebranding.
453    /// Applicable only to instruments with a mapping.
454    pub quote: String,
455    #[serde(rename = "BASE_ID")]
456    /// Represents the internal CoinDesk ID for the base asset or coin (e.g., 1 for BTC). This ID is unique and immutable, ensuring consistent identification.
457    /// Applicable only to instruments with a mapping.
458    pub base_id: i32,
459    #[serde(rename = "QUOTE_ID")]
460    /// Represents the internal CoinDesk ID for the quote asset or counter coin (e.g., 5 for USD). This ID is unique and immutable, ensuring consistent identification.
461    /// Applicable only to instruments with a mapping.
462    pub quote_id: i32,
463    #[serde(rename = "TRANSFORM_FUNCTION")]
464    /// The transform function. This is the function we apply when we do mapping to change values into easier human readable ones and to make sure the
465    /// mapped direction BASE - QUOTE is constant accross all instruments.
466    pub transform_function: String,
467    #[serde(rename = "OPEN")]
468    /// The open price for the historical period, this is based on the closest trade before the period start.
469    pub open: f64,
470    #[serde(rename = "HIGH")]
471    /// The highest trade price in the time period. If there were no trades in the time period, the open price will be given.
472    pub high: f64,
473    #[serde(rename = "LOW")]
474    /// The lowest trade price in the time period. If there were no trades in the time period, the open price will be given.
475    pub low: f64,
476    #[serde(rename = "CLOSE")]
477    /// The price of the last trade in this time period. If there were no trades in the time period, the open price will be given.
478    pub close: f64,
479    #[serde(rename = "FIRST_TRADE_TIMESTAMP")]
480    /// The timestamp, in seconds, of the first trade in this time perio. This is only available when there is at least one trade in the time period.
481    pub first_trade_timestamp: Option<i64>,
482    #[serde(rename = "LAST_TRADE_TIMESTAMP")]
483    /// The timestamp, in seconds, of the last trade in this time period. This is only available when there is at least one trade in the time period.
484    pub last_trade_timestamp: Option<i64>,
485    #[serde(rename = "FIRST_TRADE_PRICE")]
486    /// The price of the first trade in the time period. This is only available when there is at least one trade in the time period.
487    pub first_trade_price: Option<f64>,
488    #[serde(rename = "HIGH_TRADE_PRICE")]
489    /// The highest value of the trades in the time period. This is only available when there is at least one trade in the time period.
490    pub high_trade_price: Option<f64>,
491    #[serde(rename = "HIGH_TRADE_TIMESTAMP")]
492    /// The timestamp, in seconds, of the highest trade in the time period. This is only available when there is at least one trade in the time period.
493    pub high_trade_timestamp: Option<i64>,
494    #[serde(rename = "LOW_TRADE_PRICE")]
495    /// The lowest value of the trades in the time period. This is only available when there is at least one trade in the time period.
496    pub low_trade_price: Option<f64>,
497    #[serde(rename = "LOW_TRADE_TIMESTAMP")]
498    /// The timestamp, in seconds, of the lowest trade in the time period. This is only available when there is at least one trade in the time period.
499    pub low_trade_timestamp: Option<i64>,
500    #[serde(rename = "LAST_TRADE_PRICE")]
501    /// The last trade price in the time period. This is only available when there is at least one trade in the time period.
502    pub last_trade_price: Option<f64>,
503    #[serde(rename = "TOTAL_TRADES")]
504    /// The total number of trades seen in this time period. If there were no trades in the time period, 0 will be returned.
505    pub total_trades: i64,
506    #[serde(rename = "TOTAL_TRADES_BUY")]
507    /// The total number of BUY trades seen in this time period. If there were no trades in the time period, 0 will be returned.
508    pub total_trades_buy: i64,
509    #[serde(rename = "TOTAL_TRADES_SELL")]
510    // The total number of SELL trades seen in this time period. If there were no trades in the time period, 0 will be returned.
511    pub total_trades_sell: i64,
512    #[serde(rename = "TOTAL_TRADES_UNKNOWN")]
513    /// The total number of UNKNOWN trades seen in this time period. If there were no trades in the time period, 0 will be returned.
514    pub total_trades_unknown: i64,
515    #[serde(rename = "VOLUME")]
516    /// The sum of all the trade volumes in the from asset (base symbol / coin) for the time period. If there were no trades in the time period,
517    /// 0 will be returned.
518    pub volume: f64,
519    #[serde(rename = "QUOTE_VOLUME")]
520    /// The sum of all the trade volumes in the To asset (quote/counter symbol/coin) for the time period. If there were no trades in the time period,
521    /// 0 will be returned.
522    pub quote_volume: f64,
523    #[serde(rename = "VOLUME_BUY")]
524    /// The sum of all the BUY trade volumes in the from asset (base symbol / coin) for the time period.
525    pub volume_buy: f64,
526    #[serde(rename = "QUOTE_VOLUME_BUY")]
527    /// The sum of all the BUY trade volumes in the to asset (quote/counter symbol/coin) for the time period.
528    pub quote_volume_buy: f64,
529    #[serde(rename = "VOLUME_SELL")]
530    /// The sum of all the SELL trade volumes in the from asset (base symbol / coin) for the time period.
531    pub volume_sell: f64,
532    #[serde(rename = "QUOTE_VOLUME_SELL")]
533    /// The sum of all the SELL trade volumes in the To asset (quote/counter symbol/coin) for the time period.
534    pub quote_volume_sell: f64,
535    #[serde(rename = "VOLUME_UNKNOWN")]
536    /// The sum of all the UNKNOWN trade volumes in the from asset (base symbol / coin) for the time period.
537    pub volume_unknown: f64,
538    #[serde(rename = "QUOTE_VOLUME_UNKNOWN")]
539    /// The sum of all the UNKNOWN trade volumes in the To asset (quote/counter symbol/coin) for the time period.
540    pub quote_volume_unknown: f64,
541}
542
543
544// Spot: Instrument Metadata
545
546
547/// Spot: Instrument Metadata
548#[derive(Clone, Debug, Serialize, Deserialize)]
549pub struct SpotInstrumentMetdata {
550    #[serde(rename = "METADATA_VERSION")]
551    /// The version of metadata, used for version conversions/migrates.
552    pub metadata_version: usize,
553    #[serde(rename = "INSTRUMENT_STATUS")]
554    /// The status of the instrument, we only poll / stream / connect to the ACTIVE ones, for the RETIRED / IGNORED / EXPIRED /
555    /// READY_FOR_DECOMMISSIONING means we no longer query/stream data.
556    pub instrument_status: String,
557    #[serde(rename = "FIRST_SEEN_ON_POLLING_TS")]
558    /// This is the first time instrument was seen on instrumentListSourceType POLLING.
559    pub first_seen_on_pollings_ts: i64,
560    #[serde(rename = "LAST_SEEN_ON_POLLING_TS")]
561    /// This is the last time instrument was seen on instrumentListSourceType POLLING.
562    pub last_seen_pollings_ts: i64,
563    #[serde(rename = "INSTRUMENT")]
564    /// The instrument ID as it is on the exchange with small modifications - we do not allow the following characters inside isntrument ids: ,/&?
565    pub instrument: String,
566    #[serde(rename = "INSTRUMENT_MAPPING")]
567    /// The current mapping information for this instrument.
568    pub instrument_mapping: SpotInstrumentMapping,
569    #[serde(rename = "INSTRUMENT_EXTERNAL_DATA")]
570    /// The full data we get from the polling endpoint for this specific instrument. This is a JSON stringified object with different properties per exchange.
571    pub instrument_external_data: String,
572    #[serde(rename = "FIRST_OB_L2_MINUTE_SNAPSHOT_TS")]
573    /// Timestamp of the initial Level 2 minute snapshot.
574    pub first_ob_l2_minute_snapshot_ts: Option<i64>,
575}
576
577
578// Spot: Markets
579
580
581/// Spot: Markets
582#[derive(Clone, Debug, Serialize, Deserialize)]
583pub struct SpotMarkets {
584    #[serde(rename = "TYPE")]
585    /// Type of the message.
586    pub type_: String,
587    #[serde(rename = "EXCHANGE_STATUS")]
588    /// The status of the echange. We only poll / stream / connect to the ACTIVE ones, for the RETIRED ones we no longer query for data".
589    pub exchange_status: String,
590    #[serde(rename = "MAPPED_INSTRUMENTS_TOTAL")]
591    /// The total number of instruments that have been verified by our mapping team and have been properly assigned with a base, quote,
592    /// mapping function, and other necessary fields. This is done to ensure that pairs like XXBTZUSD are accurately mapped to BTC-USD and that
593    /// the pair refers to the correct assets rather than using the same asset id to represent different assets.
594    pub mapped_instrument_total: i64,
595    #[serde(rename = "UNMAPPED_INSTRUMENTS_TOTAL")]
596    /// The number of instruments that have not yet been verified by our mapping team.
597    pub unmapped_instruments_total: i64,
598    #[serde(rename = "INSTRUMENT_STATUS")]
599    /// An object with the total number of instrument for each of the available instrument statuses.
600    pub instrument_status: InstrumentStatus,
601    #[serde(rename = "TOTAL_TRADES_SPOT")]
602    /// The total number of spot trades that this exchange has processed.
603    pub total_trades_spot: i64,
604    #[serde(rename = "HAS_ORDERBOOK_L2_MINUTE_SNAPSHOTS_ENABLED")]
605    /// Boolean field denoting if we have historical minute orderbook snapshots endabled for this exchange.
606    pub has_orderbook_l2_minute_snapshots_enabled: bool,
607}
608
609
610// Spot: Markets + Instruments
611
612
613#[derive(Clone, Debug, Serialize, Deserialize)]
614pub struct Instrument {
615    #[serde(rename = "TYPE")]
616    /// Type of the message.
617    pub type_: String,
618    #[serde(rename = "INSTRUMENT_STATUS")]
619    /// Status of the current instrument.
620    pub instrument_status: String,
621    #[serde(rename = "INSTRUMENT")]
622    /// The internal exchange defined instrument id.
623    pub instrument: String,
624    #[serde(rename = "HISTO_SHARD")]
625    /// Our internal shard for historical OHLCV+ (minute/hour/day) market data. Minute data is only held in the historical database for
626    /// up to 3 weeks and we ship it to blob storage afterwards. The API utilizes multiple replicas of a single shard in a round-robin manner.
627    pub histo_shard: String,
628    #[serde(rename = "MAPPED_INSTRUMENT")]
629    /// The CoinDesk mapped instrument ID.
630    pub mapped_instrument: String,
631    #[serde(rename = "INSTRUMENT_MAPPING")]
632    /// The current mapping information for this instrument.
633    pub instrument_mapping: SpotInstrumentMapping,
634    #[serde(rename = "HAS_TRADES_SPOT")]
635    /// A boolean field indicating whether the instrument has spot trades or not.
636    pub has_trades_spot: bool,
637    #[serde(rename = "FIRST_TRADE_SPOT_TIMESTAMP")]
638    /// The first spot defi trade timestamp.
639    pub first_trade_spot_timestamp: i64,
640    #[serde(rename = "LAST_TRADE_SPOT_TIMESTAMP")]
641    /// The last spot defi trade timestamp.
642    pub last_trade_spot_timestamp: i64,
643    #[serde(rename = "TOTAL_TRADES_SPOT")]
644    /// The total number of spot trades that this exchange has processed.
645    pub total_trades_spot: i64,
646}
647
648
649/// Spot: Markets + Instruments
650#[derive(Clone, Debug, Serialize, Deserialize)]
651pub struct SpotMarketsInstruments {
652    #[serde(rename = "TYPE")]
653    /// Type of the message.
654    pub type_: String,
655    #[serde(rename = "EXCHANGE_STATUS")]
656    /// The status of the echange. We only poll / stream / connect to the ACTIVE ones, for the RETIRED ones we no longer query for data".
657    pub exchange_status: String,
658    #[serde(rename = "MAPPED_INSTRUMENTS_TOTAL")]
659    /// The total number of instruments that have been verified by our mapping team and have been properly assigned with a base, quote,
660    /// mapping function, and other necessary fields. This is done to ensure that pairs like XXBTZUSD are accurately mapped to BTC-USD and that
661    /// the pair refers to the correct assets rather than using the same asset id to represent different assets.
662    pub mapped_instrument_total: i64,
663    #[serde(rename = "UNMAPPED_INSTRUMENTS_TOTAL")]
664    /// The number of instruments that have not yet been verified by our mapping team.
665    pub unmapped_instruments_total: i64,
666    #[serde(rename = "INSTRUMENT_STATUS")]
667    /// An object with the total number of instrument for each of the available instrument statuses.
668    pub instrument_status: InstrumentStatus,
669    #[serde(rename = "TOTAL_TRADES_SPOT")]
670    /// The total number of spot trades that this exchange has processed.
671    pub total_trades_spot: i64,
672    #[serde(rename = "HAS_ORDERBOOK_L2_MINUTE_SNAPSHOTS_ENABLED")]
673    /// Boolean field denoting if we have historical minute orderbook snapshots endabled for this exchange.
674    pub has_orderbook_l2_minute_snapshots_enabled: bool,
675    #[serde(rename = "instruments")]
676    /// The list of instruments requested. It could be a selected few or all for each market.
677    pub instruments: HashMap<String, Instrument>,
678}