Skip to content

Commit 4479624

Browse files
committed
fixup! Merge pull request #17 from valeratrades/market_param
1 parent daf4c9a commit 4479624

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

examples/binance/market_futures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22

33
use v_exchanges::{
4-
binance::{self},
4+
binance,
55
core::{Exchange, MarketTrait as _},
66
};
77

examples/binance/market_spot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use v_exchanges::{
2-
binance::{self},
2+
binance,
33
core::{Exchange, MarketTrait as _},
44
};
55

examples/bybit/market.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
use std::env;
22

3-
use v_exchanges::{bybit::{self, Bybit}, core::{Exchange, MarketTrait as _}};
3+
use v_exchanges::{
4+
bybit::{self, Bybit},
5+
core::{Exchange, MarketTrait as _},
6+
};
47

58
#[tokio::main]
69
async fn main() {
710
color_eyre::install().unwrap();
811
v_utils::utils::init_subscriber(v_utils::utils::LogDestination::xdg("v_exchanges"));
912

1013
//let m: Market = "Bybit/Linear".into(); // would be nice to be able to do it like this
11-
let m = bybit::Market::Linear;
12-
let mut bb = m.client();
14+
let m = bybit::Market::Linear;
15+
let mut bb = m.client();
1316

1417
//let ticker: serde_json::Value =
1518
//bb.get("/v5/market/tickers", &[("category", "spot"), ("symbol", "BTCUSDT")], [BybitOption::Default])

v_exchanges/src/binance/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub enum Market {
6565
}
6666
impl crate::core::MarketTrait for Market {
6767
type Client = Binance;
68+
6869
fn client(&self) -> Binance {
6970
Binance::default()
7071
}

v_exchanges/src/bybit/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
mod account;
22
mod market;
33

4-
use derive_more::{Display, FromStr};
54
use adapters::bybit::BybitOption;
6-
use derive_more::derive::{Deref, DerefMut};
5+
use derive_more::{
6+
Display, FromStr,
7+
derive::{Deref, DerefMut},
8+
};
79
use eyre::Result;
810
use v_exchanges_adapters::Client;
911
use v_utils::trades::{Asset, Pair, Timeframe};
@@ -42,20 +44,19 @@ impl Exchange for Bybit {
4244

4345
async fn asset_balance(&self, asset: Asset, m: Self::M) -> Result<AssetBalance> {
4446
match m {
45-
Market::Linear => account::asset_balance(&self.0, asset).await,
47+
Market::Linear => account::asset_balance(&self.0, asset).await,
4648
_ => unimplemented!(),
4749
}
4850
}
4951

5052
async fn balances(&self, m: Self::M) -> Result<Vec<AssetBalance>> {
51-
match m{
53+
match m {
5254
Market::Linear => account::balances(&self.0).await,
5355
_ => unimplemented!(),
5456
}
5557
}
5658
}
5759

58-
5960
#[derive(Debug, Clone, Default, Copy, Display, FromStr)]
6061
pub enum Market {
6162
#[default]
@@ -65,6 +66,7 @@ pub enum Market {
6566
}
6667
impl crate::core::MarketTrait for Market {
6768
type Client = Bybit;
69+
6870
fn client(&self) -> Bybit {
6971
Bybit::default()
7072
}

0 commit comments

Comments
 (0)