tickrs_api/
lib.rs

1pub use self::client::Client;
2
3mod client;
4pub mod model;
5
6#[derive(Debug, Copy, Clone)]
7pub enum Interval {
8    Minute1,
9    Minute2,
10    Minute5,
11    Minute15,
12    Minute30,
13    Minute60,
14    Minute90,
15    Hour1,
16    Day1,
17    Day5,
18    Week1,
19    Month1,
20    Month3,
21}
22
23impl std::fmt::Display for Interval {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        use Interval::*;
26
27        let s = match self {
28            Minute1 => "1m",
29            Minute2 => "2m",
30            Minute5 => "5m",
31            Minute15 => "15m",
32            Minute30 => "30m",
33            Minute60 => "60m",
34            Minute90 => "90m",
35            Hour1 => "1h",
36            Day1 => "1d",
37            Day5 => "5d",
38            Week1 => "1wk",
39            Month1 => "1mo",
40            Month3 => "3mo",
41        };
42
43        write!(f, "{}", s)
44    }
45}
46
47#[derive(Debug, Copy, Clone)]
48pub enum Range {
49    Day1,
50    Day5,
51    Month1,
52    Month3,
53    Month6,
54    Year1,
55    Year2,
56    Year5,
57    Year10,
58    Ytd,
59    Max,
60}
61
62impl std::fmt::Display for Range {
63    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
64        use Range::*;
65
66        let s = match self {
67            Day1 => "1d",
68            Day5 => "5d",
69            Month1 => "1mo",
70            Month3 => "3mo",
71            Month6 => "6mo",
72            Year1 => "1y",
73            Year2 => "2y",
74            Year5 => "5y",
75            Year10 => "10y",
76            Ytd => "ytd",
77            Max => "max",
78        };
79
80        write!(f, "{}", s)
81    }
82}