StockInsights

StockInsights React TypeScript

This is a React TypeScript conversion of the original StockInsights application. The application maintains the same functionality for analyzing stock price drops while using modern React patterns and TypeScript for better type safety.

Features

Technology Stack

Project Structure

src/
├── components/           # React components
│   ├── StockChart.tsx   # ApexCharts integration
│   ├── SummaryPanel.tsx # Analysis results display
│   ├── ControlPanel.tsx # User controls
│   └── AddStockModal.tsx# Stock symbol picker
├── utils/               # Utility functions
│   ├── StockAnalyser.ts # Drop analysis calculations
│   └── ApiService.ts    # API communication
├── types/               # TypeScript interfaces
│   └── index.ts         # Type definitions
├── App.tsx              # Main application component
├── App.css              # Global styles
└── index.tsx            # Application entry point

Installation

  1. Install dependencies:

    npm install
    
  2. Start the development server:

    npm start
    
  3. Open http://localhost:3000 to view it in the browser.

API Requirements

The application expects a backend API running on localhost:3000 with the following endpoints:

Data Format Specification

Expected Raw Data Format from API

The GET /:symbol endpoint must return data in this exact format:

[
  "{\"Date\":\"12/2/2022\",\"Open\":20,\"High\":20.3799991607666,\"Low\":20,\"Close\":20.200000762939453,\"Volume\":1383500}",
  "{\"Date\":\"12/5/2022\",\"Open\":20.06999969482422,\"High\":20.100000381469727,\"Low\":19.899999618530273,\"Close\":19.93199920654297,\"Volume\":17900}",
  "{\"Date\":\"12/6/2022\",\"Open\":19.90999984741211,\"High\":19.975000381469727,\"Low\":19.84000015258789,\"Close\":19.91900062561035,\"Volume\":165200}",
  "{\"Date\":\"12/7/2022\",\"Open\":19.850000381469727,\"High\":19.940000534057617,\"Low\":19.799999237060547,\"Close\":19.86199951171875,\"Volume\":28900}",
  "{\"Date\":\"12/8/2022\",\"Open\":20.059999465942383,\"High\":20.059999465942383,\"Low\":19.979999542236328,\"Close\":20.027999877929688,\"Volume\":75600}"
]

Format Requirements:

Critical Notes:

⚠️ For complete API documentation and format specifications, see docs/API_DATA_FORMAT.md

Mock Data: Reference implementation available at src/data/mockApiData.json for testing when API is unavailable.

Key Differences from Original

  1. Component Architecture: Modular React components instead of monolithic JavaScript classes
  2. Type Safety: Full TypeScript support with interfaces and type checking
  3. Modern Patterns: React hooks, state management, and functional components
  4. No jQuery: Pure React DOM manipulation
  5. Modern API: Fetch API instead of jQuery AJAX
  6. Responsive Grid: CSS Grid for better mobile support
  7. Error Handling: Comprehensive error handling and loading states

Development

To build for production:

npm run build

To run tests:

npm test

Browser Support

The application uses modern JavaScript features and requires ES6+ support.