A wrapper around Robinhood API calls to export your watchlist, options history, and stocks order history to JSON, HTML, or XLS files. This also creates a summary data for your options and stock transactions. *** Summary feature is very basic as of now, and there are issues/bugs which I will fix in the coming days. Feel free to create new issue when you come across something ***
Download the repo/code to a folder on your laptop via the green code button. Install the dependencies listed in requirements.txt.
pip install -r requirements.txt
- Login to Robinhood on your browser.
- Right click the page and click "Inspect". This will open up your developer console.
- Now in the developer console, open the Network tab and search for "orders".
- Select the first option and scroll down until you see a section titled "Request Headers".
You'll need the full text of that authorization section. It's blacked out here for privacy.
- Copy everything that appears after "Bearer" to your clipboard. This is your API bearer token.
- Paste the token into
token.example.txt
. Rename the file totoken.txt
..gitignore
has this file ignored for your privacy to prevent it from being committed to the repo.
Alternatively, instead of saving your token to token.txt
, you can pass in this string when initializing the RHDataCollector class:
Open the file rh_data_collector.py and replace line 16
def __init__(self):
self.rhApihelper = RHApiHelper("YOUR TOKEN HERE")
src/rh_data_collector.py
is set up to export your watchlist, options history, and stocks order history to HTML or XLS files. src/main.py
is all set up for you to export all three to XLS. Whether you're exporting as HTML or XLS, JSON files for the paginated API collection data will also be generated.
To run the code:
python src/main.py
- Enter 1 to export your watchlist
- Enter 2 to export your stock transactions and summary
- Enter 3 to export your option transactions and summary
- Enter 4 to exit