AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.48k stars 2.31k forks source link

only download the first ticker's data #972

Open JesseLT opened 1 year ago

JesseLT commented 1 year ago

`

Download and save the data in a pandas DataFrame

    start_date = pd.Timestamp(start_date)
    end_date = pd.Timestamp(end_date)
    delta = timedelta(days=1)
    data_df = pd.DataFrame()
    for tic in ticker_list:
        while (
            start_date <= end_date
        ):  # downloading daily to workaround yfinance only allowing  max 7 calendar (not trading) days of 1 min data per single download
            temp_df = yf.download(
                tic,
                start=start_date,
                end=start_date + delta,
                interval=self.time_interval,
            )
            temp_df["tic"] = tic
            data_df = pd.concat([data_df, temp_df])
            start_date += delta`

when data of first tic of ticker_list was downloaded, then start_date > end_date,so the rest of ticker_list could never be downloaded. Correct me if i am wrong.

zhumingpassional commented 1 year ago

use str like '2023-01-01' instead of pd.Timestamp