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