Skip to content

Comprehensive web app designed to help options traders analyze trading history, understand their trading behavior, and strategize better for future trades. It securely fetches options trading data from Robinhood or allows uploads via CSV files, providing in-depth analytics, interactive visualizations, and a platform for reflection & note taking

Notifications You must be signed in to change notification settings

Manojbhat09/optionscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

OptionScope Logo

๐Ÿš€ OptionScope ๐Ÿ“Š

Robinhood Options Performance Dashboard

Elevate Your Options Trading with Data-Driven Insights

License: MIT React Flask

Demo GIF

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.

๐ŸŒŸ Features


๐Ÿ”ฎ 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 in backend/chatbot_service.py. Change as fit.

    Chatbot Image

  • ๐Ÿ“ˆ 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.

Prerequisites

  • Node.js (v14 or higher) -> 18.12.1
  • Python (v3.6 or higher)
  • Robinhood Account Credentials

๐Ÿš€ Quick Start

  1. Clone the repository:

    git clone [email protected]:Manojbhat09/optionscope.git
    
  2. 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' 
    
  3. Start the development server:

    npm start
    
  4. Open your browser and navigate to http://localhost:3000

๐Ÿš€ Elaborate Installing and Running the Flask Python Backend

Prerequisites:

  • Python 3.7+ should be installed
  • Pip (Python package manager) should be available

Steps:

  1. Clone or Copy the Code

    • Place the backend code (the files you showed) in a directory on your machine.
  2. Create a Virtual Environment (recommended):

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. 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
  4. 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-
      
  5. Run the Flask App:

    cd backend
    python app.py
    • The server will run on http://127.0.0.1:5000/ by default.

๐ŸŸข Using with Node.js (e.g., React, Next.js Frontend)

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.

๐Ÿ”— Summary Table

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

๐Ÿ–ฅ๏ธ Usage

Fetching Data from Robinhood

  1. 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.
  2. Fetch Data:

    • Click the "Fetch Data" button.
    • The app will securely authenticate with Robinhood and retrieve your options trading history.

Analyzing Your Trades

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.

Reviewing Individual Trades

Scroll down to view a detailed table containing all your trades, including:

  • Activity Date
  • Instrument
  • Description
  • Transaction Code
  • Quantity
  • Strike Price
  • Price
  • Amount

Trading Notes

  • 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.

Adjusting Data Range

  • Use the row sliders to adjust the range of data analyzed.
  • Date range and row numbers are displayed for clarity.

Uploading CSV Data (Optional)

  • 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.

Security Notice

  • 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 and backend/get_rh_options_app.py.

๐Ÿ”ฎ Future Features

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)

Roadmap

  • 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.

๐Ÿค Contributing

We welcome contributions from the community! If you'd like to contribute, please:

  1. Fork the repository
  2. Create a new branch for your feature
  3. Commit your changes
  4. Push to your branch
  5. 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.

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgements

  • 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!

About

Comprehensive web app designed to help options traders analyze trading history, understand their trading behavior, and strategize better for future trades. It securely fetches options trading data from Robinhood or allows uploads via CSV files, providing in-depth analytics, interactive visualizations, and a platform for reflection & note taking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published