FinRL icon indicating copy to clipboard operation
FinRL copied to clipboard

Higher Trading Frequency in FinRL-meta

Open Hongshen-Yang opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. The majority of the functionalities in FinRL-meta are daily based, including technical INDICATORS and StockTradingEnv. If want to trade in higher frequency based on timestamp instead of days, where should be modified?

Describe the solution you'd like Be able to trade based on timestamp instead of daily data

Describe alternatives you've considered An ugly solution is to create fake dates based on timestamp and convert back before plotting graphs.

Hongshen-Yang avatar Sep 11 '23 04:09 Hongshen-Yang

You can create a custom function that calls the yfinance library and passes a parameter "interval" with the desired period: data = yf.download(tickers='VALE3.SA', period='5d', interval='60m') The function that you can use to create your own is in: finrl/meta/preprocessor/yahoodownloader.py image

mmmarchetti avatar Sep 11 '23 12:09 mmmarchetti

You can create a custom function that calls the yfinance library and passes a parameter "interval" with the desired period: data = yf.download(tickers='VALE3.SA', period='5d', interval='60m') The function that you can use to create your own is in: finrl/meta/preprocessor/yahoodownloader.py image

Thank you mmmarchetti. Your suggestion focus on the "downloading" side.

Such as INDICATOR in the preprocessor. It uses days to calculate some indicators. Example: https://github.com/AI4Finance-Foundation/FinRL/blob/e85aaab4ede4d8ed0a245da967c10b6a1cd66d7d/finrl/meta/preprocessor/preprocessors.py#L228

Same applies to StockTradingEnv. Some functions are by-default built upon daily data. https://github.com/AI4Finance-Foundation/FinRL/blob/e85aaab4ede4d8ed0a245da967c10b6a1cd66d7d/finrl/meta/env_stock_trading/env_stocktrading.py#L243

Do you have an easy idea about how to switch to higher frequency? Thanks

Hongshen-Yang avatar Sep 17 '23 23:09 Hongshen-Yang