stas-prokopiev / binance_historical_data

python PYPI package to dump all needed crypto historical data from binance just by 2 lines of code
MIT License
71 stars 25 forks source link

it does not download as per mentioned start_date #14

Open Devarsh-leo opened 1 year ago

Devarsh-leo commented 1 year ago

Hello, when I tried to download file by providing only start date, it did data from start of the current month. To reproduce the problem use below code:

from binance_historical_data import BinanceDataDumper
from datetime import date

data_dumper = BinanceDataDumper(
    path_dir_where_to_dump=".",
    asset_class="um",  # spot, um, cm
    data_type="klines",  # aggTrades, klines, trades
    data_frequency="1m",
)

data_dumper.dump_data(
    tickers=None,
    date_start=date(day=23,month=6,year=2023),
    date_end=None,
    is_to_update_existing=False,
    tickers_to_exclude=["UST"],
)

maybe replacing below code:

# 2) Download all daily date
if self._data_type == "metrics":
    date_start_daily = date_start
else:
    date_start_daily = date_end_first_day_of_month

with:

# 2) Download all daily date
date_start_daily = date_start

will do the job.