Skip to content

ExplosiveMax/Stock

 
 

Repository files navigation

MarketMood

A Next.js (App Router) financial dashboard that lets you:

  • 🔎 Search companies/tickers and view price history
  • 📈 Visualize time-range charts (1D, 1W, 1M, 6M, 1Y, All)
  • 📰 Summarize market/news sentiment with an AI agent
  • 🤖 Generate a 30-day price outlook (explanation + target + confidence)
  • ⚖️ Run Black–Scholes option pricing (calls & puts)
  • ☁️ Deploy on Firebase App Hosting

Stack: Next.js + TypeScript, Tailwind + shadcn/ui, Recharts, Zod, React Hook Form, Genkit + Gemini, Polygon.io market data


✨ Demo (How it works)

  1. Use the Company Search to find a ticker (e.g., AAPL).
  2. The Dashboard fetches:
    • Company details, aggregates, and news via Polygon.io.
    • An AI sentiment summary over the latest headlines.
  3. Toggle the time range on the chart to explore price history.
  4. Open Price Predictor to get a 30-day outlook (model rationale + target + confidence).
  5. Use Option Pricer to calculate Black–Scholes call/put values with your inputs.

📦 Project Structure

src/
  ai/
    flows/
    genkit.ts
    dev.ts
  app/
    layout.tsx, page.tsx
    globals.css
  components/
    dashboard.tsx
    company-search.tsx
    stock-chart-card.tsx
    sentiment-analysis-card.tsx
    ai-summary-card.tsx
    price-predictor-card.tsx
    option-pricer-card.tsx
    ui/*
  hooks/
    use-debounce.ts, use-toast.ts, use-mobile.tsx
  lib/
    stock-api.ts
    black-scholes.ts
    types.ts, utils.ts
docs/
  blueprint.md

🔧 Requirements

  • Node.js 18+
  • Polygon.io API key
  • Google Generative AI key for Genkit + Gemini 2.0 Flash

🛠️ Setup

  1. Install dependencies

    npm install
  2. Create .env.local

    POLYGON_API_KEY=your_polygon_api_key
    GOOGLE_GENAI_API_KEY=your_google_genai_api_key
  3. Run the app

    npm run dev
  4. (Optional) Run Genkit dev loop

    npm run genkit:watch

🧩 Scripts

  • npm run dev – Next.js dev server
  • npm run build – Production build
  • npm run start – Start production server
  • npm run lint – ESLint
  • npm run typecheck – TypeScript
  • npm run genkit:dev / npm run genkit:watch – Genkit local dev

🧠 AI Flows

  • Summarize Market Sentiment – Analyzes ticker news via Gemini 2.0 Flash and returns sentiment + summary.
  • Predict Stock Price – Generates a 30-day prediction with rationale, target, and confidence.

📈 Market Data

All market/metadata/news calls live in src/lib/stock-api.ts and use Polygon.io for:

  • Aggregates (OHLCV/time series)
  • Company details & branding
  • Ticker search
  • News sentiment inputs

🧮 Option Pricing

Implements the Black–Scholes model with:

  • Call & put valuation
  • Standard normal CDF approximation
  • User input validation via Zod + React Hook Form

🎨 UI & Styling

  • Tailwind CSS + shadcn/ui
  • Recharts for responsive graphs
  • Lucide icons

🚀 Deploy (Firebase App Hosting)

  1. Install Firebase tools:
    npm install -g firebase-tools
    firebase login
  2. Configure:
    firebase init hosting
  3. Add your API keys to Firebase environment.
  4. Build and deploy:
    npm run build
    firebase deploy

🧭 Roadmap Ideas

  • Add indicators (SMA/EMA/RSI/MACD)
  • Backtesting features
  • Watchlists & alerts
  • Caching for API quotas
  • Multi-provider data failover

🙌 Credits

  • Polygon.io – Market data & news
  • Google Genkit + Gemini – AI flow orchestration
  • shadcn/ui, Recharts, Zod, React Hook Form, Lucide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.3%
  • Other 1.7%