AI4Finance-Foundation / FinRL

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

Higher Trading Frequency in FinRL-meta #1097

Open Hongshen-Yang opened 1 year ago

Hongshen-Yang commented 1 year ago

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.

mmmarchetti commented 1 year ago

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

Hongshen-Yang commented 1 year ago

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