Skip to content

Commit 3cf8fd1

Browse files
committed
fix: _
1 parent 83bf113 commit 3cf8fd1

File tree

8 files changed

+30
-24
lines changed

8 files changed

+30
-24
lines changed

v_exchanges/src/binance/market.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
};
1717

1818
// klines {{{
19-
pub async fn klines(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BinanceTimeframe, range: RequestRange) -> Result<Klines, ExchangeError> {
19+
pub(super) async fn klines(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BinanceTimeframe, range: RequestRange) -> Result<Klines, ExchangeError> {
2020
//TODO: test if embedding params into the url works more consistently (comp number of pairs axum-site is ablle ot get)
2121
range.ensure_allowed(1..=1000, tf.as_ref())?;
2222
let range_params = range.serialize(ExchangeName::Binance);
@@ -99,7 +99,7 @@ pub struct KlineResponse {
9999
//,}}}
100100

101101
// open_interest {{{
102-
pub async fn open_interest(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BinanceTimeframe, range: RequestRange) -> Result<Vec<OpenInterest>, ExchangeError> {
102+
pub(super) async fn open_interest(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BinanceTimeframe, range: RequestRange) -> Result<Vec<OpenInterest>, ExchangeError> {
103103
range.ensure_allowed(1..=500, tf.as_ref())?;
104104
let range_params = range.serialize(ExchangeName::Binance);
105105
let base_params = json!({

v_exchanges/src/binance/perp/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616

1717
// balance {{{
1818
//DUP: difficult to escape duplicating half the [balances] method due to a) not requiring usd value b) binance not having individual asset balance endpoint
19-
pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
19+
pub(in crate::binance) async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
2020
assert!(client.is_authenticated::<BinanceOption>());
2121
let mut options = vec![BinanceOption::HttpUrl(BinanceHttpUrl::FuturesUsdM), BinanceOption::HttpAuth(BinanceAuth::Sign)];
2222
if let Some(rw) = recv_window {
@@ -35,7 +35,7 @@ pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset,
3535
Ok(balance)
3636
}
3737

38-
pub async fn balances(client: &v_exchanges_adapters::Client, recv_window: Option<std::time::Duration>, prices: &BTreeMap<Pair, f64>) -> ExchangeResult<Balances> {
38+
pub(in crate::binance) async fn balances(client: &v_exchanges_adapters::Client, recv_window: Option<std::time::Duration>, prices: &BTreeMap<Pair, f64>) -> ExchangeResult<Balances> {
3939
assert!(client.is_authenticated::<BinanceOption>());
4040
let mut options = vec![BinanceOption::HttpUrl(BinanceHttpUrl::FuturesUsdM), BinanceOption::HttpAuth(BinanceAuth::Sign)];
4141
if let Some(rw) = recv_window {

v_exchanges/src/bybit/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
core::{AssetBalance, Balances},
1313
};
1414

15-
pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
15+
pub(super) async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
1616
assert!(client.is_authenticated::<BybitOption>());
1717
let balances: Balances = balances(client, recv_window).await?;
1818
let balance: AssetBalance = balances.iter().find(|b| b.asset == asset).copied().unwrap_or_else(|| {
@@ -23,7 +23,7 @@ pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset,
2323
}
2424

2525
/// Should be calling https://bybit-exchange.github.io/docs/v5/asset/balance/all-balance, but with how I'm registered on bybit, my key doesn't have permissions for that (they require it to be able to `transfer` for some reason)
26-
pub async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
26+
pub(super) async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
2727
assert!(client.is_authenticated::<BybitOption>());
2828

2929
let mut options = vec![BybitOption::HttpAuth(BybitHttpAuth::V3AndAbove)];

v_exchanges/src/bybit/market.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
};
1818

1919
// klines {{{
20-
pub async fn klines(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BybitInterval, range: RequestRange) -> ExchangeResult<Klines> {
20+
pub(super) async fn klines(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BybitInterval, range: RequestRange) -> ExchangeResult<Klines> {
2121
range.ensure_allowed(1..=1000, &tf)?;
2222
let range_json = range.serialize(ExchangeName::Bybit);
2323
let base_params = filter_nulls(json!({
@@ -88,7 +88,7 @@ pub struct KlineData(
8888
//,}}}
8989

9090
// price {{{
91-
pub async fn price(client: &v_exchanges_adapters::Client, pair: Pair) -> ExchangeResult<f64> {
91+
pub(super) async fn price(client: &v_exchanges_adapters::Client, pair: Pair) -> ExchangeResult<f64> {
9292
let params = filter_nulls(json!({
9393
"category": "linear",
9494
"symbol": pair.fmt_bybit(),
@@ -159,7 +159,7 @@ pub struct MarketTickerData {
159159
//,}}}
160160

161161
// open_interest {{{
162-
pub async fn open_interest(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BybitIntervalTime, range: RequestRange) -> ExchangeResult<Vec<OpenInterest>> {
162+
pub(super) async fn open_interest(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: BybitIntervalTime, range: RequestRange) -> ExchangeResult<Vec<OpenInterest>> {
163163
range.ensure_allowed(1..=200, &tf)?;
164164
let range_json = range.serialize(ExchangeName::Bybit);
165165

v_exchanges/src/kucoin/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
kucoin::market,
1313
};
1414

15-
pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, _recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
15+
pub(super) async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset, _recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
1616
assert!(client.is_authenticated::<KucoinOption>());
1717
let balances: Balances = balances(client, None).await?;
1818
let balance: AssetBalance = balances.iter().find(|b| b.asset == asset).copied().unwrap_or_else(|| {
@@ -22,7 +22,7 @@ pub async fn asset_balance(client: &v_exchanges_adapters::Client, asset: Asset,
2222
Ok(balance)
2323
}
2424

25-
pub async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
25+
pub(super) async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
2626
assert!(client.is_authenticated::<KucoinOption>());
2727

2828
let options = vec![KucoinOption::HttpAuth(KucoinAuth::Sign), KucoinOption::HttpUrl(KucoinHttpUrl::Spot)];

v_exchanges/src/kucoin/market.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
};
1515

1616
// price {{{
17-
pub async fn price(client: &v_exchanges_adapters::Client, pair: Pair, _recv_window: Option<std::time::Duration>) -> ExchangeResult<f64> {
17+
pub(super) async fn price(client: &v_exchanges_adapters::Client, pair: Pair, _recv_window: Option<std::time::Duration>) -> ExchangeResult<f64> {
1818
let symbol = format!("{}-{}", pair.base(), pair.quote());
1919
let params = json!({
2020
"symbol": symbol,
@@ -53,7 +53,7 @@ pub struct TickerData {
5353
//,}}}
5454

5555
// prices {{{
56-
pub async fn prices(client: &v_exchanges_adapters::Client, pairs: Option<Vec<Pair>>, _recv_window: Option<std::time::Duration>) -> ExchangeResult<BTreeMap<Pair, f64>> {
56+
pub(super) async fn prices(client: &v_exchanges_adapters::Client, pairs: Option<Vec<Pair>>, _recv_window: Option<std::time::Duration>) -> ExchangeResult<BTreeMap<Pair, f64>> {
5757
let options = vec![KucoinOption::HttpUrl(KucoinHttpUrl::Spot)];
5858
let response: AllTickersResponse = client.get("/api/v1/market/allTickers", &json!({}), options).await?;
5959

@@ -128,7 +128,13 @@ pub struct TickerInfo {
128128
//,}}}
129129

130130
// klines {{{
131-
pub async fn klines(client: &v_exchanges_adapters::Client, symbol: Symbol, tf: KucoinTimeframe, range: RequestRange, _recv_window: Option<std::time::Duration>) -> ExchangeResult<Klines> {
131+
pub(super) async fn klines(
132+
client: &v_exchanges_adapters::Client,
133+
symbol: Symbol,
134+
tf: KucoinTimeframe,
135+
range: RequestRange,
136+
_recv_window: Option<std::time::Duration>,
137+
) -> ExchangeResult<Klines> {
132138
let kucoin_symbol = format!("{}-{}", symbol.pair.base(), symbol.pair.quote());
133139

134140
// Convert from v_utils format (1h, 1d, 1w) to Kucoin API format (1hour, 1day, 1week)
@@ -194,7 +200,7 @@ pub struct KlineResponse {
194200
//,}}}
195201

196202
// exchange_info {{{
197-
pub async fn exchange_info(client: &v_exchanges_adapters::Client, _recv_window: Option<std::time::Duration>) -> ExchangeResult<ExchangeInfo> {
203+
pub(super) async fn exchange_info(client: &v_exchanges_adapters::Client, _recv_window: Option<std::time::Duration>) -> ExchangeResult<ExchangeInfo> {
198204
let options = vec![KucoinOption::HttpUrl(KucoinHttpUrl::Spot)];
199205
let response: SymbolsResponse = client.get("/api/v2/symbols", &json!({}), options).await?;
200206

@@ -299,7 +305,7 @@ pub mod futures {
299305
}
300306

301307
// price {{{
302-
pub async fn price(client: &v_exchanges_adapters::Client, pair: Pair, _recv_window: Option<std::time::Duration>) -> ExchangeResult<f64> {
308+
pub(in crate::kucoin) async fn price(client: &v_exchanges_adapters::Client, pair: Pair, _recv_window: Option<std::time::Duration>) -> ExchangeResult<f64> {
303309
// Kucoin futures symbol format: XBTUSDTM (base + quote + "M" for perpetual)
304310
let base = to_kucoin_futures_base(pair.base().as_ref());
305311
let symbol = format!("{}{}M", base, pair.quote());
@@ -340,7 +346,7 @@ pub mod futures {
340346
//,}}}
341347

342348
// prices {{{
343-
pub async fn prices(client: &v_exchanges_adapters::Client, pairs: Option<Vec<Pair>>, _recv_window: Option<std::time::Duration>) -> ExchangeResult<BTreeMap<Pair, f64>> {
349+
pub(in crate::kucoin) async fn prices(client: &v_exchanges_adapters::Client, pairs: Option<Vec<Pair>>, _recv_window: Option<std::time::Duration>) -> ExchangeResult<BTreeMap<Pair, f64>> {
344350
let options = vec![KucoinOption::HttpUrl(KucoinHttpUrl::Futures)];
345351
let response: ContractsActiveResponse = client.get("/api/v1/contracts/active", &json!({}), options).await?;
346352

@@ -395,7 +401,7 @@ pub mod futures {
395401
//,}}}
396402

397403
// klines {{{
398-
pub async fn klines(
404+
pub(in crate::kucoin) async fn klines(
399405
client: &v_exchanges_adapters::Client,
400406
symbol: Symbol,
401407
tf: KucoinTimeframe,
@@ -467,7 +473,7 @@ pub mod futures {
467473
//,}}}
468474

469475
// exchange_info {{{
470-
pub async fn exchange_info(client: &v_exchanges_adapters::Client, _recv_window: Option<std::time::Duration>) -> ExchangeResult<ExchangeInfo> {
476+
pub(in crate::kucoin) async fn exchange_info(client: &v_exchanges_adapters::Client, _recv_window: Option<std::time::Duration>) -> ExchangeResult<ExchangeInfo> {
471477
let options = vec![KucoinOption::HttpUrl(KucoinHttpUrl::Futures)];
472478
let response: ContractsActiveResponse = client.get("/api/v1/contracts/active", &json!({}), options).await?;
473479

v_exchanges/src/mexc/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use v_utils::prelude::*;
66

77
use crate::{AssetBalance, Balances, ExchangeResult};
88

9-
pub async fn asset_balance(client: &Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
9+
pub(super) async fn asset_balance(client: &Client, asset: Asset, recv_window: Option<std::time::Duration>) -> ExchangeResult<AssetBalance> {
1010
assert!(client.is_authenticated::<MexcOption>());
1111
let mut options = vec![MexcOption::HttpUrl(MexcHttpUrl::Futures), MexcOption::HttpAuth(MexcAuth::Sign)];
1212
if let Some(rw) = recv_window {
@@ -18,7 +18,7 @@ pub async fn asset_balance(client: &Client, asset: Asset, recv_window: Option<st
1818
Ok(r.data.into())
1919
}
2020

21-
pub async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
21+
pub(super) async fn balances(client: &Client, recv_window: Option<std::time::Duration>) -> ExchangeResult<Balances> {
2222
assert!(client.is_authenticated::<MexcOption>());
2323
let mut options = vec![MexcOption::HttpUrl(MexcHttpUrl::Futures), MexcOption::HttpAuth(MexcAuth::Sign)];
2424
if let Some(rw) = recv_window {

v_exchanges/src/mexc/market.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
};
1919

2020
//TODO: impl spot
21-
pub async fn price(client: &Client, pair: Pair) -> ExchangeResult<f64> {
21+
pub(super) async fn price(client: &Client, pair: Pair) -> ExchangeResult<f64> {
2222
let endpoint = format!("/api/v1/contract/index_price/{}", pair.fmt_mexc());
2323
let options = vec![MexcOption::HttpUrl(MexcHttpUrl::Futures)];
2424
let r: PriceResponse = client.get_no_query(&endpoint, options).await?;
@@ -42,7 +42,7 @@ impl From<PriceData> for f64 {
4242
}
4343

4444
// klines {{{
45-
pub async fn klines(client: &Client, symbol: Symbol, tf: MexcTimeframe, range: RequestRange) -> ExchangeResult<Klines> {
45+
pub(super) async fn klines(client: &Client, symbol: Symbol, tf: MexcTimeframe, range: RequestRange) -> ExchangeResult<Klines> {
4646
let mexc_symbol = symbol.pair.fmt_mexc();
4747

4848
// Convert timeframe to Mexc format: 1m -> Min1, 5m -> Min5, 1h -> Min60, 4h -> Hour4, 1d -> Day1
@@ -124,7 +124,7 @@ struct KlineData {
124124
//,}}}
125125

126126
// exchange_info {{{
127-
pub async fn exchange_info(client: &Client) -> ExchangeResult<ExchangeInfo> {
127+
pub(super) async fn exchange_info(client: &Client) -> ExchangeResult<ExchangeInfo> {
128128
let options = vec![MexcOption::HttpUrl(MexcHttpUrl::Futures)];
129129
let response: ContractDetailResponse = client.get_no_query("/api/v1/contract/detail", options).await?;
130130

0 commit comments

Comments
 (0)