Загрузка данных


export function getStartTime(timeframe: Timeframes, date: number) {
  const { candleWidth, startOfUnit } = parseTimeframe(timeframe, date);

  if (candleWidth === 1) {
    return startOfUnit.unix();
  }

  const sec = timeframeToSeconds(timeframe);
  const offsetSec = startOfUnit.utcOffset() * 60;

  return startOfUnit.unix() - ((startOfUnit.unix() + offsetSec) % sec);
}