Minor Bug fixes, notebook examples, and Documentation of added functionality#139
Minor Bug fixes, notebook examples, and Documentation of added functionality#139Youbadawy wants to merge 3 commits intoAI4Finance-Foundation:masterfrom
Conversation
|
@Youbadawy Can we divide it into multiple function pieces? Then, we can update each one. |
Yes definitely @XiaoYangLiu-FinRL , currently focused on creating an environment using operations research that fits the stock market, since this is why I added the proposed functionality, I will get to dividing it to smaller portions by the end of this week hopefully! |
commits in the PR not have any example of notebooks/config.json |
i think download_data must be packed on storage (via gzip for example) |
|
@Youbadawy Thank you very much for this work! Any new functionality like this should have testing! If you need help with testing please let me know. It should be as simple as writing tests like the ones already in the repo, building the docker container and running This will ensure the reliability of the functionality and an integration test to ensure we don't break this functionality in the future. |
Hello all, so I fixed the minor bugs working with the current repository,
I will try to make this as well documented as I possibly can as per @spencerR1992's request,
So allow me to explain the included functionality as displayed in the two notebooks created
Let us begin with the first begin with the opening functionality, the guide of our project and all hyperparameters, secret keys, and the usability of each user, The config file
1- Configuration
from finrl.config.configuration import ConfigurationThe configuration file has two main functions/methods that are used to extract a dictionary of information needed across the RL project, like
to retrieve the file within the notebook/script we use the following method
config = Configuration.from_files(["./notebooks/config.json"])and to get the coins for example that shall be traded we use
config.get("exchange").get("pair_whitelist")Now you dont necessarily have to open your config file everytime you want to edit something, so I made two functions/methods in specific to this,
from finrl.config import setup_utils_configuration
Where the method takes in a dictionary and edits the values based on what you signify here.
Another method for example is instead of the constant research of the top volume coins, I made a quick method that extracts the data from the exchange, and rewrites them to your config file using the below code,
2- User Data Directory
Now machine learning and algorithmic trading require the constant use of data, agents, models, and the back and forth of training and constant calculations. Thus data is necessary, and starting off with the clean data we have is essential. If we consider the 5 min timeframes of the crypto market the constant download and re download of this data is quite time consuming and inefficient, thus downloading once and using that data is a must.
To properly store this data each project user starts by creating their own user directory using this following methods,
where the directory being used is defined in the
config["user_data_directory"]or theconfig["datadir"]definition3- Data Downloading
Now the main utility of your Agent, the Data, here we choose which data we want to try and download to our specified user_data_directory using the below methods,
In here we specify which data we would like to download, timeframes, and what not, if you leave it blank, it will automatically fetch it from your config.json file. Note that only in this method timeframes is a list, since you could download multiple data timeframes at once. this functionality is not available for the stock method
Also note how for the amount of data you want to download you can specify two things, either a 'timerange': "20020101-20210101" or number of days 'days': 365, where it goes back 365 days from today.
4- Fetching the Data
Here is where we retrieve the saved data for use, Now this had an issue before where changing the repository of the files or where you save the user_data file caused issies, but it was fixed in a way that does a full directory walk to retrieve all data, and use only that is specified using your
config["datadir"],config["exchange"], andconfig["user_data_dir"]All these functionalities are displayed in two notebooks as mentioned above,
What do we need to currently do is integrated these functionalities with the pre existing code that you have wrote, like for example
Looking forward for further criticism, advice, and ideas to improve on this amazing project!
Thanks
@XiaoYangLiu-FinRL @BruceYanghy @spencerR1992 @Yonv1943