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

5
+

6
6
<br>
7
7
[<imgalt="ci errors"src="https://img.shields.io/github/actions/workflow/status/valeratrades/v_exchanges/errors.yml?branch=master&style=for-the-badge&style=flat-square&label=errors&labelColor=420d09"height="20">](https://github.com/valeratrades/v_exchanges/actions?query=branch%3Amaster)<!--NB: Won't find it if repo is private-->
8
8
[<imgalt="ci warnings"src="https://img.shields.io/github/actions/workflow/status/valeratrades/v_exchanges/warnings.yml?branch=master&style=for-the-badge&style=flat-square&label=warnings&labelColor=d16002"height="20">](https://github.com/valeratrades/v_exchanges/actions?query=branch%3Amaster)<!--NB: Won't find it if repo is private-->
//let m: Market = "Binance/Spot".into(); // would be nice to be able to do it like this, without having to carry around exchange-specific type
12
9
// Currently if I want to pass around the market struct in my code after initializing it, I have to pass around eg `binance::Market`, which is a ridiculous thing to hardcode into function signatures
13
-
let m = binance::Market::Spot;
14
-
let bn = m.client();
10
+
//let m = binance::Market::Spot;
11
+
let m:AbsMarket = "Binance/Spot".into();
12
+
let c = m.client();
15
13
16
-
let spot_klines = bn.klines(("BTC","USDT").into(),"1m".into(),2.into(), m).await.unwrap();
14
+
let spot_klines = c.klines(("BTC","USDT").into(),"1m".into(),2.into(), m).await.unwrap();
17
15
dbg!(&spot_klines);
18
16
19
-
let spot_prices = bn.prices(None, m).await.unwrap();
17
+
let spot_prices = c.prices(None, m).await.unwrap();
Copy file name to clipboardExpand all lines: examples/data.rs
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
use v_exchanges::{binance::Binance, bitmex::Bitmex};
2
2
3
+
/// things in here are not on [Exchange](v_exchanges::core::Exchange) trait, so can't use generics, must specify exact exchange client methods are referenced from.
//? 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?
0 commit comments