Skip to content

Commit 7a5e638

Browse files
committed
_
1 parent 4479624 commit 7a5e638

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/binance/market_spot.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ async fn main() {
88
color_eyre::install().unwrap();
99
v_utils::utils::init_subscriber(v_utils::utils::LogDestination::xdg("v_exchanges"));
1010

11+
//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
1112
let m = binance::Market::Spot;
1213
let bn = m.client();
1314

v_exchanges/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ reqwest = { version = "^0.12.12", optional = true}
4343

4444
insta.workspace = true #dbg (for some reason is not loading in dev-dependencies rn
4545
eyre = "0.6.12"
46+
enum_dispatch = "0.3.13"
4647

4748
[dev-dependencies]
4849
insta.workspace = true

v_exchanges/src/core.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,19 @@ pub trait MarketTrait {
153153
fn client(&self) -> Self::Client;
154154
}
155155

156+
157+
158+
//TODO!: figure out how can I expose one central `Market` enum, so client doesn't have to bring into the scope `MarketTrait` and deal with the exchange-specific `Market`'s type
156159
//#[derive(Debug, Clone, Copy)]
157160
//pub enum Market {
158-
// Binance(binance::Market),
159-
// Bybit(bybit::Market),
161+
// Binance(crate::binance::Market),
162+
// Bybit(crate::bybit::Market),
160163
// //TODO
161164
//}
165+
//
162166
//impl Default for Market {
163167
// fn default() -> Self {
164-
// Self::Binance(binance::Market::default())
168+
// Self::Binance(crate::binance::Market::default())
165169
// }
166170
//}
167171
//
@@ -190,8 +194,8 @@ pub trait MarketTrait {
190194
// match sub_market.parse() {
191195
// Ok(m) => m,
192196
// Err(e) => match sub_market.to_lowercase() == "futures" {
193-
// true => bybit::Market::Linear,
194-
// false => bail!(e),
197+
// true => crate::bybit::Market::Linear,
198+
// false => eyre::bail!(e),
195199
// }
196200
// }
197201
// })),

0 commit comments

Comments
 (0)