use chrono::{DateTime, FixedOffset};
use rust_decimal::Decimal;
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize)]
pub struct OpenHighLowCloseChart {
pub chart: Vec<Ohlc>,
pub period: Period,
}
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Deserialize)]
pub struct Ohlc {
pub close: Decimal,
pub high: Decimal,
pub low: Decimal,
pub open: Decimal,
pub time: DateTime<FixedOffset>,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Deserialize)]
pub enum Period {
Day,
Week,
Month,
Year,
FiveYears,
}
impl ToString for Period {
fn to_string(&self) -> String {
match self {
Self::Day => "day",
Self::Month => "month",
Self::Week => "week",
Self::Year => "year",
Self::FiveYears => "five-years",
}
.to_string()
}
}