FinRL-Meta
FinRL-Meta copied to clipboard
ValueError: Parameter `start` received with timezone defined as 'UTC' although a Date must be timezone naive.
run Automated_Paper_Trading.ipynb in FinRL-Meta/Paper Trading/
colab report error
Thanks!
Here is a code snippet to reproduce this error
from finrl.meta.data_processor import DataProcessor from finrl.config_tickers import DOW_30_TICKER
API_KEY = "PKFZO57AZCL2J9TBL7LY" API_SECRET = "LGXALuN2TgJX3dxXRsOLZXZgje16WH9of8cJfFGA" API_BASE_URL = 'https://paper-api.alpaca.markets'
DP = DataProcessor(data_source = 'alpaca', API_KEY = API_KEY, API_SECRET = API_SECRET, API_BASE_URL = API_BASE_URL ) data = DP.download_data(start_date = '2022-08-30', end_date = '2022-09-12', ticker_list = DOW_30_TICKER, time_interval= '1Min') data = DP.clean_data(data)
I fixed this error to change
df = nyse.sessions_in_range(
pd.Timestamp(start, tz=pytz.UTC), pd.Timestamp(end, tz=pytz.UTC)
)
to
df = nyse.sessions_in_range(
start, end
)
noe the methods looks like
def get_trading_days(self, start: str, end: str) -> list[str]:
nyse = tc.get_calendar("NYSE")
df = nyse.sessions_in_range(
start, end
)
trading_days = []
for day in df:
trading_days.append(str(day)[:10])
return trading_days
found this code in meta/data_processors/process_yahoofinance.py
fix this as temproray if anyone has better solution please help !