AI4Finance-Foundation / FinRL-Meta

FinRL­-Meta: Dynamic datasets and market environments for FinRL.
https://ai4finance.org
MIT License
1.24k stars 576 forks source link

Data Sources #46

Open aron-alarik opened 2 years ago

aron-alarik commented 2 years ago

Hi I have a different data source than what is available here, are the data sources customizable or can we define our own data source, if so which module ? Also on the environment and technical indicators, there are several custom indicators i have built, can we add them as well ? The central idea is to add to the environment settings? Thanks !! Hope to use this in a live production environment soon !!

zhumingpassional commented 2 years ago

This version does not support the function. We will update the code to support it. Thanks for your suggestion. Can you list the technical indicators or provide the code to calculate them?

aron-alarik commented 2 years ago

this diagram is a bit patchy, but does give the central Idea, I can provide the code but its more than one long notebook with (connectors to IBrokers and Plygon and offline data streamer to Redis), a complete library if combined (total of 3000+ derived technical indicators), meanwhile will the other version of FinRL solve this purpose? Thanks !! Screenshot 2021-12-24 092921

Athe-kunal commented 2 years ago

Hi @aron-alarik. In this tutorial https://github.com/AI4Finance-Foundation/FinRL-Meta/blob/master/Demo_FinRL_Meta_Integrate_Trends_data_to_DOW_Jones.ipynb, we have a custom user-defined features integration. Here I appended the data frame of user-defined features and did a left join based on date and ticker symbol. This may help you to integrate custom state space into your model. Do try and let me know if you have some other ideas to do this in a better way.

aron-alarik commented 2 years ago

Thanks ! I am looking at it, will try and contribute as much possible to this project, really excited about using FinRL in our core production environment. Also I was looking at the data connectors and checking if they can be customized. The central idea being real time streaming data. Screenshot 2021-12-24 104607

cryptocoinserver commented 2 years ago

Awesome @aron-alarik - this would also fix #45 . I think it's better like you said to make it more modular by accepting the features via a dataframe.

BTW what reward function do you use? You might want to check out the two other issues / suggestions I added: #26 and #27

aron-alarik commented 2 years ago

Absolutely if it can be made more modular with a dataframe !! that would be awesome !!

Also if instead of processing data/Indicators/Env-vars directly via vendor APIs like Yahoo, make it more generic by just accepting a stream of data in JSON format from a forwarded port (like a universal subscriber or specifically from Redis/ZMQ/ Amazon etc). That ways its up to the user to choose their indicator library, vendor, data format- live streaming or historical data and the compression level. Dont think the agents care too much about where the data is coming from !!! Almost anyone can spin up a publisher in a few mins, so that will not be an issue.

I think #26 points are Bang ON !! # 1, 2 and 3 clearly cover the reward function we use, we have a slightly modified version of DSR but mostly in line with this. So not much to add to if this is available. Looking forward to calculating and optimizing the rewards using a GAN. Starting work on this after Christmas.

On the issue of point #27 , again, excellent points, both are extremely important feature sets, we call them temporal zones and Vix alternatives, I have some code for them, we use an extended temporal zone, one additional function is to add temporal zones that are specific to intraday, daily, weekly regimes for a certain index. I will share that scanner here in some time, once I am done with a working model from FinRL, please do share your views/code on this.

Your ideas are excellent, I will share what I have, as and when I am done with this RL project, and maybe we can all do the same. It will be really great to see these ideas take some shape in FinRL. I think the real challenge is here is to let the user expand his scope of the state space and source data and not make it too specific.

Awesome @aron-alarik - this would also fix #45 . I think it's better like you said to make it more modular by accepting the features via a dataframe.

BTW what reward function do you use? You might want to check out the two other issues / suggestions I added: #26 and #27

aron-alarik commented 2 years ago

also forgot to mention: in a high frequency environment, TA-Lib would be working with polars or terality and not Pandas, simply due to the huge pre- processing involved, so that might be an additional consideration.

zhumingpassional commented 2 years ago

Your suggestions are valuable.

We are developing another version, dict, where key is indicator (e.g., "close price"), value is 1-dimension numpy.array, since it is more efficient than dataframe.

I think JSON is more general than other formats. It's a good idea. Other codes (e.g., java) can process them efficiently.

"Dont think the agents care too much about where the data is coming from" It's good. In our defined ticker_list, it's easy to identify which data source it is from. While if users define their own ticker_list, we may have to search tickers over all markets. We have to store the tickers in different time. If some several tickers are away from the markets in 2010, they are not in the newest dataset.

aron-alarik commented 2 years ago

Thanks !! You guys are great !!

Athe-kunal commented 2 years ago

Hi @aron-alarik " Looking forward to calculating and optimizing the rewards using a GAN" Can you please provide more information on this?

aron-alarik commented 2 years ago

Hi @aron-alarik " Looking forward to calculating and optimizing the rewards using a GAN" Can you please provide more information on this?

Hey !! Yes, I am running some experiments on this over the next few days. If the 'fake agent' adds to the model performance, I will post the results here. In fact starting work on this right now.

Athe-kunal commented 2 years ago

Oh alright! This seems interesting. Looking forward to the results, also please post in the slack channel.

aron-alarik commented 2 years ago

Sure thing! Will do !