Minor Bug fixes, notebook examples, and Documentation of added functionality #139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 Configuration
The 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