Skip to content

Commit 5ecc93e

Browse files
committed
fixup! refactor: _
1 parent 68a6ccf commit 5ecc93e

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

examples/binance/market.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ async fn main() {
88
color_eyre::install().unwrap();
99
v_utils::utils::init_subscriber(v_utils::utils::LogDestination::xdg("v_exchanges"));
1010

11-
let mut b = Binance::new();
11+
let mut b = Binance::default();
1212

1313
b.update_default_option(BinanceOption::HttpUrl(BinanceHttpUrl::FuturesUsdM));
1414

1515
//before implementing the trait for bybit too, was able to just do eg: `let klines = client.futures_klines(("BTC", "USDT").into(), "1m".into(), 2, None, None).await.unwrap();`
1616

17-
let klines = b.futures_klines(("BTC", "USDT").into(), "1m".into(), 2, None, None)
18-
.await
19-
.unwrap();
17+
let klines = b.futures_klines(("BTC", "USDT").into(), "1m".into(), 2, None, None).await.unwrap();
2018
let price = b.futures_price(("BTC", "USDT").into()).await.unwrap();
2119
dbg!(&klines, price);
2220

examples/bybit/market.rs

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

11-
let mut bb = Bybit::new();
11+
let mut bb = Bybit::default();
1212

13-
let ticker: serde_json::Value = bb.0
14-
.get("/v5/market/tickers", &[("category", "spot"), ("symbol", "BTCUSDT")], [BybitOption::Default])
15-
.await
16-
.expect("failed to get ticker");
13+
let ticker: serde_json::Value =
14+
bb.0.get("/v5/market/tickers", &[("category", "spot"), ("symbol", "BTCUSDT")], [BybitOption::Default])
15+
.await
16+
.expect("failed to get ticker");
1717
println!("Ticker:\n{ticker}");
1818

1919
if let (Ok(key), Ok(secret)) = (env::var("BYBIT_TIGER_READ_KEY"), env::var("BYBIT_TIGER_READ_SECRET")) {

v_exchanges/src/binance/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use v_utils::{
99

1010
use crate::core::{AssetBalance, Exchange, Klines};
1111

12-
#[derive(Clone, Debug, Default, Deref, DerefMut, WrapNew)]
12+
#[derive(Clone, Debug, Default, Deref, DerefMut)]
1313
pub struct Binance(pub Client);
1414

1515
//? 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?

v_exchanges/src/bybit/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
pub mod account;
22

33
use color_eyre::eyre::Result;
4-
use derive_more::derive::Deref;
5-
use derive_more::derive::DerefMut;
6-
use v_exchanges_adapters::Client;
7-
use v_exchanges_adapters::bybit;
8-
use v_utils::macros::WrapNew;
9-
use v_utils::trades::{Asset, Pair, Timeframe};
4+
use derive_more::derive::{Deref, DerefMut};
5+
use v_exchanges_adapters::{Client, bybit};
6+
use v_utils::{
7+
macros::WrapNew,
8+
trades::{Asset, Pair, Timeframe},
9+
};
1010

1111
use crate::core::{AssetBalance, Exchange, Klines};
1212

13-
#[derive(Clone, Debug, Default, Deref, DerefMut, WrapNew)]
13+
#[derive(Clone, Debug, Default, Deref)]
1414
pub struct Bybit(pub Client);
1515

16-
1716
//? 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?
1817
impl Exchange for Bybit {
1918
async fn futures_klines(&self, symbol: Pair, tf: Timeframe, limit: u32, start_time: Option<u64>, end_time: Option<u64>) -> Result<Klines> {

v_exchanges_adapters/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ pub struct Client {
3939
}
4040

4141
impl Client {
42-
/// Creates a new [Client].
43-
pub fn new() -> Self {
44-
Self::default()
45-
}
46-
4742
/// Update the default options for this [Client]
4843
#[inline(always)]
4944
pub fn update_default_option<O>(&mut self, option: O)

v_exchanges_api_generics/src/websocket.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use core::slice::SlicePattern;
12
use std::{
23
collections::hash_map::{Entry, HashMap},
34
mem,
@@ -7,11 +8,11 @@ use std::{
78
},
89
time::Duration,
910
};
11+
1012
use futures_util::{
1113
sink::SinkExt,
1214
stream::{SplitSink, StreamExt},
1315
};
14-
use core::slice::SlicePattern;
1516
use parking_lot::Mutex as SyncMutex;
1617
use tokio::{
1718
net::TcpStream,

0 commit comments

Comments
 (0)