Use this tool to scrape portfolio data from your Robinhood account
Currently the tool scrapes the following data from the website and stores it in a JSON file:
- Stocks data from https://robinhood.com/account
- Dividends history from https://robinhood.com/account/history?type=dividends
- Portfolio and sector distribution percentage from https://robinhood.com/profile
- Transfer history from https://robinhood.com/account/history?type=transfers
- Mac OS
- Node JS and npm(prefer node version 12+)
- Clone the repo to your machine
- Run
npm i
from the repo's root directory - Fill the robinhood account username and password in
/config/credentials.json
file- Alternatively, the username and password can also be set as environment variables with names
RH_USERNAME
andRH_PASSWORD
respectively
- Alternatively, the username and password can also be set as environment variables with names
- Once the setup is done, run
npm start
from the terminal for the tool to start scraping - The user will be asked to enter a six digit code, the code can be OTP through sms or from the Authenticaor app depending on the user settings, the tool should pass here waiting for the user input. Click inside the input field and enter the six digit code(do not press enter or submit button), the program should resume automatically once all the six digits are typed
- Scarping all the pages might take 2-3 minutes
- The tool should exit automatically once scraping is done
The data scraped is written to stocks.json file in the data directory, it contains the following properties(inside parent object named data
)
Property | Type | Description |
---|---|---|
crypto |
Array | contains crypto information |
dividendData |
Object | contains dividend information |
humanizedLocalTime |
String | human interpretable local time |
portfolioDistribution |
Object | contains portfolio distribution in percentages, includes Stocks, ETFs, Crypto, Options |
sectorDistribution |
Object | contains sector distribution scraped from profile page |
stocks |
Array | lists all the stocks owned |
stockCount |
Number | total number of stocks owned |
timeStampInMilliSecs |
Number | Unix time stamp in milli secs |
totalPortfolioValue |
Object | contains total portfolio value scraped from account page |
transferInfo |
Object | contains bank deposits and withdrawals information |
- The tool also outputs a csv file
stocks.csv
in the data folder. This file can be directly used to upload portfolio data to https://www.simplysafedividends.com/ - The tool supports accounts with Two-Factor Authentication(2FA) turned on, just enter the One Time Password(OTP) in the webpage when requested and the app should successfully log you in and start scraping data
- The tool does not yet support accounts which does options trading.