Skip to content

A JavaFX application that fetches and visualizes real-time stock prices using the Alpha Vantage API, updating every 5 seconds with a live chart. πŸš€

Notifications You must be signed in to change notification settings

SoftwareChoreographer/-Real-Time-Stock-Market-Risk-Visualization-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Real-Time Stock Price Tracker

πŸ“Œ Introduction

The Real-Time Stock Price Tracker is a JavaFX application that retrieves and visualizes live stock prices using the Alpha Vantage API. The application fetches stock prices every 5 seconds and plots them on a real-time line chart.

πŸ“– Table of Contents

βš™οΈ Installation

  1. Clone the repository

    git clone https://github.com/your-repo/stock-price-tracker.git
    cd stock-price-tracker
  2. Install JavaFX
    Make sure you have Java 11+ installed along with JavaFX SDK. You can download JavaFX from:
    https://gluonhq.com/products/javafx/

  3. Set up API Key

    • Get a free API key from Alpha Vantage.
    • Save the key in a file named api_key.txt in the root directory.
  4. Run the application

    javac --module-path /path/to/javafx-sdk/lib --add-modules javafx.controls,javafx.fxml App.java
    java --module-path /path/to/javafx-sdk/lib --add-modules javafx.controls,javafx.fxml App

πŸš€ Usage

  • Launch the application to start tracking stock prices.
  • The stock price data updates automatically every 5 seconds.
  • View the real-time price movement in the line chart.

✨ Features

  • πŸ“ˆ Real-Time Stock Prices: Fetches stock prices using the Alpha Vantage API.
  • πŸ“Š Live Graphing: Displays stock prices dynamically on a JavaFX LineChart.
  • ⏳ Automatic Updates: Refreshes every 5 seconds.
  • πŸ’Ύ Data Management: Maintains the latest 100 data points to keep the graph clean.

πŸ“¦ Dependencies

  • JavaFX
  • Alpha Vantage API (for stock price data)
  • JSON (for parsing API response)

πŸ”§ Configuration

  • Modify the stock symbol in the queryStockPrice() method to track a different stock.
  • Adjust the refresh rate in the startStockPriceQuery() method (TimeUnit.SECONDS.sleep(5);).

πŸ›  Troubleshooting

Issue: "Error fetching stock prices"
βœ… Solution: Ensure your API key is correct and not exceeding the free request limit.

Issue: "JavaFX runtime error"
βœ… Solution: Check that your JavaFX SDK is correctly installed and added to your classpath.

πŸ‘₯ Contributors

  • @SoftwareChorepgrapher

πŸ“œ License

This project is licensed under the MIT License.


πŸ“Œ Note: Make sure you update the paths in the javac and java commands with your JavaFX SDK location.

About

A JavaFX application that fetches and visualizes real-time stock prices using the Alpha Vantage API, updating every 5 seconds with a live chart. πŸš€

Topics

Resources

Stars

Watchers

Forks

Languages