rustrade_data/subscription/
candle.rs1use super::SubscriptionKind;
2use chrono::{DateTime, Utc};
3use rust_decimal::Decimal;
4use serde::{Deserialize, Serialize};
5
6#[derive(
9 Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Deserialize, Serialize,
10)]
11pub struct Candles;
12
13impl SubscriptionKind for Candles {
14 type Event = Candle;
15
16 fn as_str(&self) -> &'static str {
17 "candles"
18 }
19}
20
21impl std::fmt::Display for Candles {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 write!(f, "{}", self.as_str())
24 }
25}
26
27#[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Deserialize, Serialize)]
29pub struct Candle {
30 pub close_time: DateTime<Utc>,
31 pub open: Decimal,
32 pub high: Decimal,
33 pub low: Decimal,
34 pub close: Decimal,
35 pub volume: Decimal,
36 pub trade_count: u64,
37}