Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ OptiScout-Web

Advanced Options Research Platform - AI-powered research agent that provides comprehensive options trading insights backed by real-time market data and authoritative web sources.

Next.js FastAPI Python TypeScript

🎯 Overview

OptiScout-Web is a sophisticated financial research platform designed for options traders, analysts, and finance professionals. It combines AI-powered analysis with real-time market data and comprehensive web research to deliver accurate, cited, and actionable insights on options trading strategies, market conditions, and risk management.

✨ Key Features

  • πŸ” Intelligent Research: Advanced web search with content extraction from authoritative financial sources
  • πŸ“Š Live Market Data: Real-time price feeds and volatility indicators via Polygon.io integration
  • πŸ€– AI-Powered Analysis: GPT-4 powered insights with beginner-friendly explanations
  • πŸ“ Structured Responses: Professional markdown format with citations and data tables
  • ⚑ Real-Time Processing: Fast, concurrent data fetching and analysis
  • 🎨 Modern UI: Responsive design with Fidelity-inspired professional styling

πŸ—οΈ Architecture

Frontend Stack

  • Framework: Next.js 14 with App Router
  • Language: TypeScript 5.0+
  • Styling: TailwindCSS with custom Fidelity design system
  • UI Components: Custom component library with professional styling
  • State Management: React hooks with optimistic updates

Backend Stack

  • Framework: FastAPI with async/await patterns
  • Language: Python 3.11+
  • AI Integration: OpenAI GPT-4 with optimized prompts
  • Web Search: Tavily API for authoritative source discovery
  • Market Data: Polygon.io integration for live quotes and historical data
  • Content Processing: Advanced extraction with trafilatura and custom parsers

Data Flow

User Query β†’ Frontend β†’ FastAPI Backend β†’ AI Processing β†’ Web Search + Live Data β†’ Structured Response

πŸš€ Quick Start

Prerequisites

  • Python 3.11 or higher
  • Node.js 18 or higher
  • OpenAI API key
  • Tavily API key
  • (Optional) Polygon.io API key for live market data

1. Backend Setup

# Navigate to backend directory
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env with your API keys

# Start the server
uvicorn main:app --reload --host 0.0.0.0 --port 8000

2. Frontend Setup

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

3. Access the Application

βš™οΈ Configuration

Required Environment Variables

Create backend/.env with the following:

# Core AI & Search APIs (Required)
OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here

# Application Settings
ENVIRONMENT=development

# Live Market Data (Optional)
POLYGON_API_KEY=your_polygon_api_key_here
SUPABASE_FUNCTION_URL=your_supabase_function_url_here

LLM Provider (Optional)

By default, the app uses OpenAI models. You can point to any OpenAI-compatible endpoint (e.g., xAI Grok) by setting these variables in backend/.env:

# Use an OpenAI-compatible endpoint
OPENAI_BASE_URL=https://api.x.ai/v1
# Choose the model served by that endpoint
OPENAI_MODEL=grok-code-fast-1

The backend reads these at startup and will report the active model in GET /status.

Optional Integrations

  • Polygon.io: For real-time stock and options data
  • Custom Data Sources: Extend with your own market data APIs

πŸ’‘ Usage Examples

Basic Options Research

Query: "Explain iron condor strategy for beginners"
Response: Comprehensive explanation with visual diagrams, risk profiles, and current market examples

Market Analysis

Query: "What's the current implied volatility for SPY options?"
Response: Live IV data, historical context, and trading implications

Strategy Evaluation

Query: "Covered call risks for dividend stocks"
Response: Detailed analysis with real examples and risk mitigation strategies

🎯 Target Audience

  • Options Traders: Professional and retail traders seeking comprehensive research
  • Financial Analysts: Research professionals requiring cited, authoritative sources
  • Educators: Finance instructors teaching options trading concepts
  • Students: Finance students learning about derivatives and risk management

πŸ”§ Development

Project Structure

optiscout-web/
β”œβ”€β”€ backend/                 # FastAPI application
β”‚   β”œβ”€β”€ main.py             # API entry point
β”‚   β”œβ”€β”€ agent.py            # Core research agent
β”‚   β”œβ”€β”€ web_search.py       # Web search and content extraction
β”‚   β”œβ”€β”€ live_data.py        # Market data integration
β”‚   └── schemas.py          # Data models and validation
β”œβ”€β”€ frontend/               # Next.js application
β”‚   β”œβ”€β”€ app/                # App router pages
β”‚   β”œβ”€β”€ components/         # React components
β”‚   └── lib/                # Utility functions
└── docs/                   # Documentation

Running Tests

# Backend tests
cd backend
pytest

# Frontend tests
cd frontend
npm test

Building for Production

# Backend
cd backend
pip install -r requirements.txt
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker

# Frontend
cd frontend
npm run build
npm start

πŸ”’ Security & Compliance

  • API Key Security: Environment variable management with secure defaults
  • Rate Limiting: Built-in request throttling for external APIs
  • CORS Configuration: Secure cross-origin resource sharing
  • Input Validation: Comprehensive request validation and sanitization

πŸ“Š Performance

  • Response Time: < 3 seconds for complex research queries
  • Concurrent Users: Supports 100+ simultaneous users
  • Caching: Intelligent caching for frequently requested data
  • Scalability: Horizontal scaling with Docker containers

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

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

⚠️ Important Disclaimers

Educational Use Only: This platform is designed for research and educational purposes only. All content and analysis provided should not be construed as financial advice, investment recommendations, or trading signals.

No Investment Advice: The information generated by OptiScout-Web does not constitute professional financial advice. Users should conduct their own research and consult with qualified financial advisors before making investment decisions.

Market Risk: Options trading involves substantial risk and is not suitable for all investors. Past performance does not guarantee future results.


Built with ❀️ for the trading community

Back to Top β€’ Report Bug β€’ Request Feature

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages