use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct DhanResponse {
success: bool,
data: DhanData,
#[serde(rename = "nextTime")]
next_time: u32,
}
impl DhanResponse {
pub fn data(&self) -> &DhanData {
&self.data
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct DhanData {
o: Vec<f64>,
h: Vec<f64>,
l: Vec<f64>,
c: Vec<f64>,
v: Vec<u32>,
t: Vec<u32>,
oi: Vec<f64>,
#[serde(rename = "Time")]
time: Vec<String>,
}
impl DhanData {
pub fn open(&self) -> &Vec<f64> {
&self.o
}
pub fn high(&self) -> &Vec<f64> {
&self.h
}
pub fn low(&self) -> &Vec<f64> {
&self.l
}
pub fn close(&self) -> &Vec<f64> {
&self.c
}
pub fn volume(&self) -> &Vec<u32> {
&self.v
}
pub fn timestamp(&self) -> &Vec<u32> {
&self.t
}
pub fn open_interest(&self) -> &Vec<f64> {
&self.oi
}
pub fn time(&self) -> &Vec<String> {
&self.time
}
}