Supercharge your Robinhood options trading strategy with data-driven insights! ๐ The Options Trading Analysis Dashboard is a powerful web application designed for options traders who want to understand and improve their trading performance. By securely fetching your options trading data directly from Robinhood, this dashboard provides in-depth analytics, interactive visualizations, and a platform for you to reflect, take notes, and develop better trading strategies.
Whether you're a seasoned options trader or just getting started, this tool helps you:
- Analyze your trading history in detail.
- Visualize profit and loss trends over time.
- Identify your most profitable instruments and strategies.
- Keep track of your thoughts and strategies with integrated note-taking.
๐ฎ Update
- Chatbot Integration: Interact with a chatbot to get quick answers and assistance on using the dashboard. Knows your data & plots.
- Screenshots stored locally in
backend/screenshots
folder. - Default model set to
meta-llama/llama-3.2-11b-vision-instruct:free
inbackend/chatbot_service.py
. Change as fit.
- Screenshots stored locally in
- ๐ Secure Data Fetching: Log in with your Robinhood credentials to fetch your options trading history within a specified date range.
- ๐ Comprehensive Analytics:
- Total Profit/Loss calculations.
- Win Rate and Total Trades overview.
- Profit/Loss by Instrument: Identify which assets are driving your performance.
- Profit/Loss by Option Type: Understand whether calls or puts are more profitable for you.
- Revenue Analysis by Instrument.
- Cumulative Profit/Loss Over Time: See how your P/L evolves.
- Top Profitable and Loss-Making Trades: Learn from your best and worst trades.
- ๐ Interactive Visualizations: Utilize charts and graphs powered by Recharts for an intuitive analysis experience.
- ๐๏ธ Customizable Date Range: Focus your analysis on specific periods to see how strategies performed over time.
- ๐ Trading Notes:
- Integrated note-taking section with Markdown support.
- Export notes as Markdown files.
- Save and load notes for continuous strategizing and refer back when needed.
- ๐พ CSV Upload Option: Alternatively, upload your trading data via CSV if you prefer not to connect your Robinhood account.
- ๐น Responsive Design: Access the dashboard from desktop or mobile devices.
- Node.js (v14 or higher) -> 18.12.1
- Python (v3.6 or higher)
- Robinhood Account Credentials
-
Clone the repository:
git clone [email protected]:Manojbhat09/optionscope.git
-
Install dependencies:
cd optionscope pip install -r backend/requirements.txt npm run build npm install # make sure to use correct nodejs, 'nvm use 18.12.1' & 'npm audit --fix'
-
Start the development server:
npm start
-
Open your browser and navigate to
http://localhost:3000
Prerequisites:
- Python 3.7+ should be installed
- Pip (Python package manager) should be available
Steps:
-
Clone or Copy the Code
- Place the backend code (the files you showed) in a directory on your machine.
-
Create a Virtual Environment (recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Python Dependencies:
- You need to install Flask, Flask-CORS, pandas, numpy, robin_stocks, yfinance, python-dotenv, tqdm, pillow, requests (and possibly others).
- The simplest way is to create a
requirements.txt
file or just run:pip install flask flask-cors pandas numpy yfinance robin_stocks python-dotenv tqdm pillow requests
- If you already have a
requirements.txt
file, use:pip install -r requirements.txt
-
Set Up Environment Variables:
- Create a
.env
file in your backend directory with the required variables, e.g.:REACT_APP_OPENROUTER_API_KEY=your_api_key_here
- Replace
your_api_key_here
with your real key. - Or use export and put in ~/.bashrc
export REACT_APP_OPENROUTER_API_KEY=sk-
- Create a
-
Run the Flask App:
cd backend python app.py
- The server will run on
http://127.0.0.1:5000/
by default.
- The server will run on
If you use nvm
(Node Version Manager), you can update as follows:
nvm install --lts
nvm use --lts
node -v # Should show v18.x, v20.x, etc.
Or, to get a specific version (example: v20):
nvm install 20
nvm use 20
- You do not "install" Python code with Node. Instead, you run your backend and frontend separately, and connect them via HTTP APIs.
- You can set up a Node.js frontend (React, Next.js, etc) in a separate folder, and call your Flask backend at
http://localhost:5000/api/...
endpoints.- For creating a React app:
npx create-react-app frontend cd frontend npm start
- Then, fetch data from your Flask backend using AJAX/fetch/axios in your React code.
- For creating a React app:
Part | How to install/run | Notes |
---|---|---|
Flask Backend | pip install ... then python app.py |
Python 3, use a virtualenv, set .env |
Node Frontend | npm install , npm start (if using) |
Kept separate; frontend calls backend API |
-
Enter Credentials:
- Username: Your Robinhood account email.
- Password: Your Robinhood account password.
- Start Date: The beginning date for your trading data.
- End Date: The ending date for your trading data.
-
Fetch Data:
- Click the "Fetch Data" button.
- The app will securely authenticate with Robinhood and retrieve your options trading history.
Once data is fetched:
-
Summary Overview:
- Total Profit/Loss: Net earnings from your trades.
- Total Profit: Sum of all profitable trades.
- Total Loss: Sum of all losing trades.
- Win Rate: Percentage of trades that were profitable.
- Total Trades: Number of trades made.
-
Charts and Graphs:
- Profit/Loss by Instrument: Bar chart showing P/L for each traded instrument.
- Revenue by Instrument: Understand which instruments generate the most revenue.
- Profit/Loss by Option Type: Pie chart comparing calls vs. puts.
- Cumulative Profit/Loss Over Time: Line chart of your P/L progression.
- Holding Period Analysis: Insights into the duration of your trades.
-
Top Trades:
- Top Profitable Trades: Review your best trades.
- Top Loss-Making Trades: Identify and learn from your biggest losses.
Scroll down to view a detailed table containing all your trades, including:
- Activity Date
- Instrument
- Description
- Transaction Code
- Quantity
- Strike Price
- Price
- Amount
-
Edit Notes:
- Click on "Edit" to modify your trading notes.
- Notes support Markdown formatting for rich text features.
-
Save Notes:
- After editing, click "Save" to store your notes locally.
-
Export Notes:
- Click "Export as MD" to download your notes as a Markdown file.
-
Reset or Clear Notes:
- Reset to Default: Restore the original sample notes.
- Clear Notes: Remove all notes.
- Use the row sliders to adjust the range of data analyzed.
- Date range and row numbers are displayed for clarity.
- Click on "Upload CSV" to select and upload a CSV file containing your trading data.
- The CSV should have columns similar to those fetched from Robinhood.
-
Credentials Usage:
- Your Robinhood username and password are used only to fetch your trading data.
- Credentials are not stored on any server or sent to any third party.
- Data fetching happens over secure connections directly with Robinhood's API.
-
Data Privacy:
- All fetched data is processed locally on your machine.
- No trading data is uploaded or stored externally.
-
Important:
- Always ensure you trust the application before entering your credentials.
- Review the source code if in doubt, particularly
backend/app.py
andbackend/get_rh_options_app.py
.
We're constantly working to improve the Options Trading Analysis Dashboard. Here are some exciting features on our roadmap:
- ๐ค AI-powered trade recommendations based on historical performance
- ๐ Integration with multiple brokers beyond Robinhood
- ๐ฑ Mobile app for on-the-go analysis
- ๐ Real-time alerts for potential profit-taking or loss-cutting opportunities
- ๐ง Machine learning models to predict option price movements
- ๐๏ธ Custom tagging system for categorizing and filtering trades
- ๐ Backtesting functionality to simulate strategies on historical data
- ๐ฅ Social features to share and compare trading strategies (anonymously)
- Integration with Other Brokers: Support for TD Ameritrade, E*TRADE, etc.
- Advanced Analytics: Add more metrics like Sharpe ratio, volatility analysis.
- Real-Time Data: Incorporate live data feeds for real-time strategy testing.
- Cloud Deployment: Options to deploy the dashboard on cloud platforms.
We welcome contributions from the community! If you'd like to contribute, please:
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Push to your branch
- Open a pull request
- Bug Reports & Feature Requests: Open an issue on GitHub.
- Pull Requests: Feel free to fork the repository and submit pull requests.
- Feedback: Your feedback helps improve the tool for everyone.
This project is licensed under the MIT License - see the LICENSE file for details.
- Robinhood API for providing access to trading data
- React for the frontend framework
- Flask for the backend server
- Recharts for beautiful, responsive charts
Happy trading! ๐๐ฐ May your options always be in the money!