/Stock-Market-Analysis

A web Application to show all available stocks in your portfolio and also their data over different ranges of time

Primary LanguageJavaScriptMIT LicenseMIT

๐Ÿ“ˆ Stock Market Analysis Web App

A Stock Market Analysis Dashboard built using HTML, CSS, JavaScript, Bootstrap, and Chart.js.
This project visualizes stock market data, displays stock statistics, and generates interactive charts for popular companies.


๐Ÿš€ Features

โœ… Real-Time Stock Data โ€“ Fetches live-like stock statistics from an external API.
โœ… Dynamic Chart Generation โ€“ Displays stock price trends over multiple timeframes using Chart.js.
โœ… Stock Summary Section โ€“ Shows key stock insights and summaries.
โœ… Responsive Design โ€“ Built with Bootstrap for clean, mobile-friendly layout.
โœ… Interactive UI โ€“ Users can click on any stock to view detailed trends and stats.
โœ… Custom Timeframes โ€“ Toggle between 1 Month, 3 Months, 1 Year, and 5 Years charts.


๐Ÿงฉ Project Structure

๐Ÿ“ฆ Stock-Market-Analysis โ”œโ”€โ”€ index.html # Main HTML file (structure of the web page) โ”œโ”€โ”€ index.js # JavaScript logic (API fetch, chart rendering, interactivity) โ”œโ”€โ”€ index.css # Styling for the app layout โ””โ”€โ”€ README.md # Project documentation


๐ŸŒ APIs Used

The app retrieves data from a custom backend hosted on Render:

Purpose API Endpoint
Stock Statistics Data https://stock-market-api-k9vl.onrender.com/api/stocksstatsdata
Stock Historical Data https://stock-market-api-k9vl.onrender.com/api/stocksdata
Stock Profile Summary https://stock-market-api-k9vl.onrender.com/api/profiledata

๐Ÿงฑ External Libraries / Dependencies

Library Purpose CDN / Source
Bootstrap 5.3.3 For responsive layout and UI styling jsDelivr CDN
Chart.js To render interactive line charts jsDelivr CDN

No additional build tools or frameworks are used โ€” everything runs directly in the browser.


โš™๏ธ How It Works

1๏ธโƒฃ Fetch and Display Stock Stats

  • The app fetches stock symbols (AAPL, MSFT, GOOGL, etc.)
  • Displays Book Value and Profit % in a clean list format.

2๏ธโƒฃ Generate Dynamic Charts

  • Clicking on a stock loads its historical price chart using Chart.js.
  • Displays highest and lowest price points dynamically.

3๏ธโƒฃ Timeframe Controls

  • Users can switch between multiple timeframes:
    • 1 Month
    • 3 Months
    • 1 Year
    • 5 Years

4๏ธโƒฃ Stock Summary

  • Additional details like company summary are displayed in a dedicated section below the chart.

๐Ÿ–ผ๏ธ UI Overview

Sections:

  1. ๐Ÿ  Header โ€“ Displays the app title.
  2. ๐Ÿ“Š Chart Section โ€“ Shows real-time stock chart and stats.
  3. ๐Ÿ•’ Timeframe Buttons โ€“ Lets users change data range.
  4. ๐Ÿ“‹ Stock List โ€“ Lists all available stock tickers with stats.
  5. ๐Ÿงพ Details Section โ€“ Displays stock summary and insights.

๐Ÿง  Key JavaScript Functions

Function Description
fetchStockData() Fetches stock statistics for each symbol.
displayStockData() Renders the stock list with book value and profit.
createStockChart(symbol) Generates Chart.js line chart for selected stock.
updateTimeframe(timeframe) Updates chart data based on selected timeframe.
renderstockData(symbol) Fetches and displays stock profile summary.

๐Ÿง‘โ€๐Ÿ’ป Tech Stack

  • Frontend: HTML5, CSS3, JavaScript (ES6+)
  • Framework: Bootstrap 5
  • Visualization: Chart.js
  • Data Source: Custom Render-hosted API
  • Runtime: Client-side only (no Node.js required)

โšก Getting Started

1. Clone the Repository

git clone https://github.com/yourusername/stock-market-analysis.git