Skip to content
Merged

Dev #83

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/marketData/Binance/BinanceProvider.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class BinanceProvider implements IProvider {
const needsPagination = this.shouldPaginate(timeframe, limit, sDate, eDate);

if (needsPagination) {
if (sDate !== undefined && eDate !== undefined) {
if (sDate && eDate) {
// Forward pagination: Fetch all data using interval pagination, then apply limit
const allData = await this.getMarketDataInterval(tickerId, timeframe, sDate, eDate);
const result = limit ? allData.slice(0, limit) : allData;
Expand All @@ -289,10 +289,10 @@ export class BinanceProvider implements IProvider {
url += `&limit=${Math.min(limit, 1000)}`; // Cap at 1000 for single request
}

if (sDate !== undefined) {
if (sDate) {
url += `&startTime=${sDate}`;
}
if (eDate !== undefined) {
if (eDate) {
url += `&endTime=${eDate}`;
}

Expand Down Expand Up @@ -341,7 +341,7 @@ export class BinanceProvider implements IProvider {
}

// If we have both start and end dates, calculate required candles
if (sDate !== undefined && eDate !== undefined) {
if (sDate && eDate) {
const interval = timeframe_to_binance[timeframe.toUpperCase()];
const timeframeDurations = {
'1m': 60 * 1000,
Expand Down