Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Parameter start received with timezone defined as 'UTC' although a Date must be timezone naive. #297

Open
LunbiWa opened this issue May 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@LunbiWa
Copy link

LunbiWa commented May 23, 2023

run Automated_Paper_Trading.ipynb in FinRL-Meta/Paper Trading/

colab report error

image

Thanks!

@YangletLiu YangletLiu added the bug Something isn't working label May 23, 2023
@onchiptech
Copy link

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)

@krishdotn1
Copy link
Contributor

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants