ccdata_api/schemas/data_api/indices_and_reference_rates.rs
1use std::fmt::Display;
2use serde::{Serialize, Deserialize};
3
4
5#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
6/// The index family to obtain data from.
7pub enum IndicesMarket {
8 #[default]
9 CADLI,
10 CCIX,
11 CCXRP,
12 CCXRPPERP,
13}
14
15impl Display for IndicesMarket {
16 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17 match self {
18 Self::CADLI => write!(f, "cadli"),
19 Self::CCIX => write!(f, "ccix"),
20 Self::CCXRP => write!(f, "CCXRP"),
21 Self::CCXRPPERP => write!(f, "CCXRPPERP"),
22 }
23 }
24}
25
26
27// Indices & Reference Rates: Historical OHLCV+
28
29
30/// Indices & Reference Rates: Historical OHLCV+
31#[derive(Clone, Debug, Serialize, Deserialize)]
32pub struct IndicesOHLCV {
33 #[serde(rename = "UNIT")]
34 /// The unit of the historical period update: MINUTE for minute, HOUR for hour and DAY for day.
35 pub unit: String,
36 #[serde(rename = "TIMESTAMP")]
37 /// The timestamp in seconds of the histo period, for minute it would be every minute at the beginning of the minute,
38 /// for hour it would be start of the hour and for daily it is 00:00 GMT/UTC
39 pub timestamp: i64,
40 #[serde(rename = "TYPE")]
41 /// Type of the message.
42 pub type_: String,
43 #[serde(rename = "MARKET")]
44 /// The index family - a group of indices sharing common characteristics like methodology, type of securities, geographical region, sector,
45 /// or company size. It's a crucial categorization in data analysis, aiding in performance comparison of different indices and understanding
46 /// broader market trends.
47 pub market: String,
48 #[serde(rename = "INSTRUMENT")]
49 /// The specific financial asset pair that an index is tracking in unmapped format. In most cases this is a combiation of the base and quote assets of the pair.
50 pub instrument: String,
51 #[serde(rename = "OPEN")]
52 /// The initial value (price) of an index at market opening on a trading period. It's a significant data point used to understand the initial market sentiment,
53 /// calculate various technical indicators, and for visual representation in charts to identify trends or patterns over time.
54 pub open: f64,
55 #[serde(rename = "HIGH")]
56 /// The maximum value an index (price) reaches during a specific trading period. It's a significant data point used to understand the index's potential
57 /// and volatility, calculate the range of daily movement, and for visual representation in charts to identify trends or patterns over time.
58 pub high: f64,
59 #[serde(rename = "LOW")]
60 /// The minimum value (price) an index reaches during a specific trading period. It's a vital data point used to understand the index's volatility and risk,
61 /// calculate the range of daily movement, and for visual representation in charts to identify trends or patterns over time.
62 pub low: f64,
63 #[serde(rename = "CLOSE")]
64 /// The last value (price) of an index at the end of a trading period. It's a critical data point used for performance comparison,
65 /// calculations like daily return or volatility, and for visual representation in charts to identify trends or patterns over time.
66 pub close: f64,
67 #[serde(rename = "FIRST_MESSAGE_TIMESTAMP")]
68 /// The timestamp in seconds of the initial index update in the time period (only available when we have at least one index update in the time period).
69 pub first_message_timestamp: i64,
70 #[serde(rename = "LAST_MESSAGE_TIMESTAMP")]
71 /// The timestamp in seconds of the last index update in the time period (only available when we have at least one index update in the time period).
72 pub last_message_timestamp: i64,
73 #[serde(rename = "FIRST_MESSAGE_VALUE")]
74 /// The open value (price) based on the inital index update in the time period (only available when we have at least one index update in the time period).
75 pub first_message_value: f64,
76 #[serde(rename = "HIGH_MESSAGE_VALUE")]
77 /// The maximum value an index (price) based on all the index updates in the time period (only available when we have at least one index update
78 /// in the time period).
79 pub high_message_value: f64,
80 #[serde(rename = "HIGH_MESSAGE_TIMESTAMP")]
81 /// The timestamp in seconds of the maximum value an index (price) based on all the index updates in the time period (only available when we have at
82 /// least one index update in the time period).
83 pub high_message_timestamp: i64,
84 #[serde(rename = "LOW_MESSAGE_VALUE")]
85 /// The minimum value an index (price) based on all the index updates in the time period (only available when we have at least one index update
86 /// in the time period).
87 pub low_message_value: f64,
88 #[serde(rename = "LOW_MESSAGE_TIMESTAMP")]
89 /// The timestamp in seconds of the the minimum value an index (price) based on all the index updates in the time period (only available when we have at
90 /// least one index update in the time period).
91 pub low_message_timestamp: i64,
92 #[serde(rename = "LAST_MESSAGE_VALUE")]
93 /// The last value (price) of an index based on the last index update in the time period (only available when we have at least one index update
94 /// in the time period).
95 pub last_message_value: f64,
96 #[serde(rename = "TOTAL_INDEX_UPDATES")]
97 /// The total number of message updates seen in this time period (0 when there no messages in the time period).
98 pub total_index_updates: i32,
99 #[serde(rename = "VOLUME")]
100 /// The total number of base asset parts traded for the index instrument in the time period.
101 /// It's a critical metric that provides insights into market liquidity and activity level. High volumes indicate high investor interest and liquidity,
102 /// while low volumes suggest the opposite.
103 pub volume: f64,
104 #[serde(rename = "VOLUME_TOP_TIER")]
105 /// The total number of top tier base asset parts traded for the index instrument in the time period.
106 /// It's a critical metric that provides insights into market liquidity and activity level. High volumes indicate high investor interest and liquidity,
107 /// while low volumes suggest the opposite.
108 pub volume_top_tier: f64,
109 #[serde(rename = "VOLUME_DIRECT")]
110 /// The total number of direct base asset parts traded for the index instrument in the time period.
111 /// It's a critical metric that provides insights into market liquidity and activity level. High volumes indicate high investor interest and liquidity,
112 /// while low volumes suggest the opposite.
113 pub volume_direct: f64,
114 #[serde(rename = "VOLUME_TOP_TIER_DIRECT")]
115 /// The total number of top tier direct base asset parts traded for the index instrument in the time period.
116 /// It's a critical metric that provides insights into market liquidity and activity level. High volumes indicate high investor interest and liquidity,
117 /// while low volumes suggest the opposite.
118 pub volume_top_tier_direct: f64,
119 #[serde(rename = "QUOTE_VOLUME")]
120 /// The total number of quote (counter) asset parts traded for the index instrument in the time period.
121 /// This offers insight into market activity and liquidity and is used widely in numerical analysis and data visualization.
122 pub quote: f64,
123 #[serde(rename = "QUOTE_VOLUME_TOP_TIER")]
124 /// The total number of top tier quote (counter) asset parts traded for the index instrument in the time period.
125 /// This offers insight into market activity and liquidity and is used widely in numerical analysis and data visualization.
126 pub quote_top_tier: f64,
127 #[serde(rename = "QUOTE_VOLUME_DIRECT")]
128 /// The total number of direct quote (counter) asset parts traded for the index instrument in the time period.
129 /// This offers insight into market activity and liquidity and is used widely in numerical analysis and data visualization.
130 pub quote_direct: f64,
131 #[serde(rename = "QUOTE_VOLUME_TOP_TIER_DIRECT")]
132 /// The total number of top tier direct quote (counter) asset parts traded for the index instrument in the time period.
133 /// This offers insight into market activity and liquidity and is used widely in numerical analysis and data visualization.
134 pub quote_top_tier_direct: f64,
135}