1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 'models.rs' defines the data structures used for the Coinbase API requests and responses.
use HashMap;
use ;
/// The `ApiParams` struct holds the parameters for the Coinbase API request.
///
/// # Examples
/// ```
/// use crate::oscillatorsetups::exchange::coinbase::models::ApiParams;
/// use std::collections::HashMap;
///
/// let params = HashMap::from([("start", "2021-09-14T20:00:00Z"),("end", "2021-09-15T20:00:00Z"),]);
///
/// let api_params = ApiParams {
/// base_url : "https://api.exchange.coinbase.com",
/// product_id : Some("ETH-USD"),
/// resource : Some("candles"),
/// params : Some(params),
/// limit : 300,
/// granularity : 3600,
/// };
/// ```
/// The `Klines` data structure for a single kline (candlestick) data point from the Coinbase API.
/// Includes the timestamp, open, high, low, close price, and the volume.
/// Each field is annotated with serde to rename the fields when deserializing from the JSON response.
///
/// # Examples
///
/// ```
/// use crate::oscillatorsetups::exchange::coinbase::models::Klines;
/// use serde_json::json;
///
/// let kline_data = json!({
/// "0": 1633728000,
/// "1": 0.01891,
/// "2": 0.01897,
/// "3": 0.01892,
/// "4": 0.01895,
/// "5": 92.051
/// });
///
/// let kline: Klines = serde_json::from_value(kline_data).unwrap();
/// ```