Skip to content

Commit

Permalink
fix: increase debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
wnz99 committed Nov 1, 2021
1 parent fcba5f4 commit 5860f64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/exchanges/binance/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const REST_ROOT_FUTURES_USD_URL = `https://fapi.binance.com/fapi/v1`;
export const REST_ROOT_SPOT_URL = `https://api.binance.com/api/v1`;
export const WS_ROOT_FUTURES_COIN_URL = 'wss://dstream.binance.com/stream';
export const WS_ROOT_FUTURES_USD_URL = 'wss://fstream.binance.com/stream';
export const WS_ROOT_SPOT_URL = ' wss://stream.binance.com:9443/stream';
export const WS_ROOT_SPOT_URL = 'wss://stream.binance.com:9443/stream';
// Maps TVCD standard resolutions to exchange API resolutions

export const API_RESOLUTIONS_MAP: Intervals = {
Expand Down
20 changes: 14 additions & 6 deletions src/utils/makeChunkCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ const makeChunkCalls = <T>(
const { makeCandlesUrlFn, requestOptions, makeChunks, debug } = opts;

if (!makeChunks) {
return [
fetchCandles$<T>(
makeCandlesUrlFn(pair, interval, start, end),
requestOptions
),
];
const url = makeCandlesUrlFn(pair, interval, start, end);

if (debug?.isDebug) {
console.log(`tvcd => fetching ${url})`);
}

return [fetchCandles$<T>(url, requestOptions)];
}

const timePeriod = timePeriods[interval.slice(-1)];
Expand All @@ -60,6 +61,13 @@ const makeChunkCalls = <T>(
return debugError(e.message, debug?.isDebug);
}
})
.map((url) => {
if (debug?.isDebug) {
console.log(`tvcd => fetching ${url})`);
}

return url;
})
.map((url) => fetchCandles$(url, requestOptions));
};

Expand Down

0 comments on commit 5860f64

Please sign in to comment.