EODHD-APIs-Python-Financial-Library icon indicating copy to clipboard operation
EODHD-APIs-Python-Financial-Library copied to clipboard

1m historical data is being limited to 120 minutes and is giving the wrong error message

Open whittlem opened this issue 1 year ago • 1 comments

Hi,

The limit on the 1m historical data is too short. It's currently limited to 120 minutes. It should be a lot larger than this. I would say very least 1 day (1440 minutes) as default. A week would probably be a sensible max (10080).

This is my test code:

from eodhd import APIClient
import config as cfg

api = APIClient(cfg.API_KEY)


def get_ohlc_data():
    df = api.get_historical_data("BTC-USD.CC", "1m", results=120)
    return df


if __name__ == "__main__":
    df = get_ohlc_data()

    df["close"] = pd.to_numeric(df["close"], errors="coerce")
    df.dropna(subset=["close"], inplace=True)
    df["close"].fillna(value=df["close"].mean(), inplace=True)

    print(df)

If I leave out the "results" parameter or set it to anything higher than 120, I get this:

[21:11:39] {'errors': {'to': ['Max period length is 120 days'], 'from': ['Max period length is 120 days']}}     

It also talks about "days" which is incorrect.

whittlem avatar Apr 10 '24 20:04 whittlem

Very good suggestion. The 1 minute historical data should be atleast one day indeed. I hope this improvement get implemented.

Sinansi avatar Feb 15 '25 18:02 Sinansi