Financial Stock Price Forecasting API

Position:Backend Engineer, Software Engineer, Project Manager Type:Team Project Duration:September - December 2025 Stack:Java, Python, Spring Boot, GitHub Actions, Postman Skills:API design, systems architecture, CI/CD, Machine Learning, Natural Language Processing

Our Financial Stock Price Forecasting API is a Java-based REST API that forecasts short-term stock movements by combining quantitative (historical prices) and qualitative (market sentiment) signals. The system ingests market data from Alpha Vantage and news sentiment from Hugging Face transformers, producing confidence-adjusted predictions via three model pipelines: stock, sentiment, and combined fusion. We deploy API endpoints for X-day price, X-day sentiment, and next-day combined prediction.

Summary

Microservice architecture StockDataService, NewsDataService, ForecastDataService with CompositeController
Multi-model pipeline Combines quantitative (price) and qualitative (sentiment) models for forecasting
Cache & freshness JSON cache with atomic reads/writes and ?force=true override
RESTful API Endpoints for daily prices, sentiment analysis, and predictions with JSON responses

Why This API?

While components like sentiment APIs and stock price feeds already exist, a single developer-facing platform that merges price data and sentiment analytics into one system and produces predictive outputs rather than just raw scores is uncommon. Our Financial Stock Price Forecasting API fills that gap by unifying both signals into a reproducible forecasting API with caching, standardized schemas, and modular endpoints for analytics and scalability.

Methods

  • Modular microservice design: Built with Spring Boot and separated into StockDataService, NewsDataService, and ForecastDataService, orchestrated by a unified CompositeController.
  • Data ingestion layer: Pulls daily time series from Alpha Vantage and real-time news articles, storing results in local JSON cache to limit API calls and accelerate repeated requests.
  • Model orchestration: Each endpoint triggers one of three predictive models: TrendMaster (price), Hugging Face BERT (sentiment), and a custom fusion model combining the two for next-day output (planned).
  • Cache & freshness control: Custom validation for stock (24 h) and sentiment (6 h) responses; optional ?force=true parameter to override.
  • Testing & documentation: Utilize Postman suites and command-line curl validation; automated Maven build and test cycle.

Key Features

  • X-day stock prediction: Time-series model forecasts near-term prices using Alpha Vantage daily or intraday data.
  • X-day sentiment prediction: Transformer-based model computes mean sentiment trajectory from recent financial headlines.
  • X-day combined prediction: Weighted fusion of stock and sentiment forecasts for improved directional accuracy.
  • Adaptive endpoints: Works for any equity ticker; supports custom horizon (?horizon=1d).
  • API-first design: JSON-formatted responses.

API Endpoints

  • GET /market/daily?symbol=AMZN: Retrieves daily stock data (open, close, high, low, volume)
  • GET /market/sentiment?symbol=AMZN: Retrieves news sentiment data for given ticker (very positive, positive, negative, very negative, neutral)
  • GET /market/predict?symbol=AMZN&horizon=1d: Generates X-day stock price prediction (price)
  • GET /market/combined?symbol=AMZN: (Planned) Combines stock + sentiment models for X-day forecast

Next Steps

  • Add a GET /market/combined endpoint
  • Implement a machine learning model for the combined prediction