@@ -4,7 +4,11 @@ import type { DatafeedConfiguration, IBasicDataFeed } from 'public/tradingview/c
44
55import { type RootStore } from '@/state/_store' ;
66
7- import { getSpotBars , SpotApiGetBarsQuery } from '@/clients/spotApi' ;
7+ import {
8+ getSpotBars ,
9+ SpotApiGetBarsQuery ,
10+ SpotApiTokenPairStatisticsType ,
11+ } from '@/clients/spotApi' ;
812import { waitForSelector } from '@/lib/asyncUtils' ;
913import {
1014 subscribeToSpotCandles ,
@@ -56,11 +60,7 @@ export const getSpotDatafeed = (store: RootStore, spotApiUrl: string): IBasicDat
5660 } ,
5761
5862 getBars : async ( symbolInfo , resolution , periodParams , onHistoryCallback , onErrorCallback ) => {
59- const { from, to } = periodParams ;
60-
61- // Clamp to parameter to current time to prevent API from returning future placeholder candles
62- const currentTimeSeconds = Math . floor ( Date . now ( ) / 1000 ) + 1 ;
63- const clampedTo = Math . min ( to , currentTimeSeconds ) ;
63+ const { from, to, countBack } = periodParams ;
6464
6565 if ( ! symbolInfo . ticker ) {
6666 const error = new Error ( 'Symbol ticker is required' ) ;
@@ -76,7 +76,10 @@ export const getSpotDatafeed = (store: RootStore, spotApiUrl: string): IBasicDat
7676 tokenMint,
7777 resolution : interval ,
7878 from,
79- to : clampedTo ,
79+ to,
80+ countback : Math . min ( countBack , 1500 ) ,
81+ removeEmptyBars : true ,
82+ statsType : SpotApiTokenPairStatisticsType . Filtered ,
8083 } ;
8184
8285 const bars = await wrapAndLogBonsaiError (
0 commit comments