A full-stack web application for analyzing and visualizing stock data with MarketStack, FusionCharts, and optional GPT insights. The frontend offers multi-symbol charting, sentiment, and AI commentary, while the backend securely proxies all MarketStack requests.
git clone https://github.com/apilayer/stock-market-predictor.git
cd stock-market-predictorInstall backend and frontend dependencies separately.
Backend (Python/Flask)
cd backend
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtFrontend (React/Vite)
cd frontend
npm install- Create
.envinbackendfrom the example:cd backend cp .env.example .env - Add your MarketStack API key to
.env:MARKETSTACK_API_KEY=your_key_here - (Optional) Add an OpenAI API key in the frontend UI via Connect APIs; it is stored locally in the browser.
Backend
cd backend
source venv/bin/activate
python app.py # http://localhost:5000Frontend
cd frontend
npm run dev # http://localhost:5173- Fetch historical EOD/intraday data via backend proxy
- Multi-symbol comparisons with validation
- Timeframe presets: 1M, 3M, 6M, 1Y, 5Y, YTD
- FusionCharts zoomline + volume visuals
- GPT-powered insights per selected symbols (optional OpenAI key)
- Sentiment signals using breadth and average return
- Add/remove symbols with validation and suggestions
- Refresh data on demand
- Toast feedback for errors and actions
- Responsive dark UI with Tailwind styling
- Flask with Flask-CORS
- requests for outbound MarketStack calls
- Environment-configured
MARKETSTACK_API_KEY
- React 19 with Vite
- Tailwind CSS v4 for styling
- FusionCharts for charting
- Custom hooks for MarketStack data
GET http://localhost:5000/api/eod?symbols={SYM}&limit=100&sort=DESC
GET http://localhost:5000/api/intraday?symbols={SYM}&interval=1h
GET http://localhost:5000/api/tickers?exchange=NASDAQ&limit=100
GET http://localhost:5000/api/exchanges?limit=100
GET http://localhost:5000/api/currencies?limit=100
GET http://localhost:5000/api/timezones?limit=100
Parameters are forwarded and the API key is injected server-side. See backend/README.md for full details.
- Start backend (port 5000) and frontend (port 5173).
- Open
http://localhost:5173. - Add one or more stock symbols (e.g., AAPL, MSFT).
- Pick a timeframe and view charts.
- (Optional) Open Connect APIs to add OpenAI key, then generate GPT insights.
- App.jsx — overall state, data refresh, layout
- Header — Connect APIs modal trigger and refresh control
- ControlPanel — symbol management and timeframe selection
- ChartPanel — FusionCharts price/volume rendering
- InsightsPanel — GPT insights workflow
- SentimentPanel — derived sentiment metrics
- ApiModal / Toast — key capture and feedback
- app.py — Flask app, CORS setup, and MarketStack proxy routes (
/api/eod,/api/intraday,/api/tickers,/api/exchanges,/api/currencies,/api/timezones)
- Backend must be running for data requests; frontend proxies
/api/*tohttp://localhost:5000. .envis gitignored; never commit secrets.- MarketStack free tier has request and data freshness limits.
- OpenAI key is optional and stored locally in the browser.
- Backend caching/rate limiting
- Loading and error states on charts
- Saved symbol watchlists
- Server-side GPT proxy option
