You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let kline_responses:Vec<KlineResponse> = client.get("/fapi/v1/klines",Some(¶ms),[BinanceOption::Default]).await.unwrap();
34
+
let kline_responses:Vec<KlineResponse> = client.get("/fapi/v1/klines",Some(¶ms),[BinanceOption::HttpUrl(BinanceHttpUrl::FuturesUsdM)]).await.unwrap();
34
35
let klines:Vec<Kline> = kline_responses.into_iter().map(Kline::from).collect();
35
36
36
37
Ok(Klines{v: klines, tf,oi:Vec::new()})
@@ -84,11 +85,45 @@ impl From<KlineResponse> for Kline {
84
85
}
85
86
}
86
87
}
88
+
//,}}}
89
+
90
+
// price {{{
91
+
//HACK: not sure this is _the_ thing to use for that (throwing away A LOT of data)
let r:MarkPriceResponse = client.get("/fapi/v1/premiumIndex",Some(¶ms),[BinanceOption::Default]).await.unwrap();
100
+
let price = r.index_price;// when using this framework, we care for per-exchange price, obviously
101
+
Ok(price)
102
+
}
103
+
104
+
#[serde_as]
105
+
#[derive(Debug,Serialize,Deserialize,Clone)]
106
+
#[serde(rename_all = "camelCase")]
107
+
pubstructMarkPriceResponse{
108
+
pubsymbol:String,
109
+
#[serde_as(as = "DisplayFromStr")]
110
+
pubmark_price:f64,
111
+
#[serde_as(as = "DisplayFromStr")]
112
+
pubindex_price:f64,
113
+
#[serde_as(as = "DisplayFromStr")]
114
+
pubestimated_settle_price:f64,
115
+
#[serde_as(as = "DisplayFromStr")]
116
+
publast_funding_rate:f64,
117
+
pubnext_funding_time:u64,
118
+
pubtime:u64,
119
+
}
120
+
121
+
//,}}}
87
122
88
123
#[cfg(test)]
89
124
mod tests {
90
125
#[test]
91
-
fnkline_core(){
126
+
fnklines(){
92
127
let raw_str = "[1731448080000,\"88591.90\",\"88630.90\",\"88560.00\",\"88574.10\",\"173.581\",1731448139999,\"15378315.48720\",2800,\"113.654\",\"10069629.84420\",\"0\"]";
93
128
let _:super::Kline = serde_json::from_str(raw_str).unwrap();
//? currently client ends up importing this from crate::binance, but could it be possible to lift the [Client] reexport up, and still have the ability to call all exchange methods right on it?
// balances are defined for each margin type: [futures_balance, spot_balance, margin_balance], but note that on some exchanges, (like bybit), some of these may point to the same exact call
32
+
// to negate confusion could add a `total_balance` endpoint
33
+
34
+
//? could implement many things that are _explicitly_ combinatorial. I can imagine several cases, where knowing that say the specified limit for the klines is wayyy over the max and that you may be opting into a long wait by calling it, could be useful.
0 commit comments