Skip to content

Repository files navigation

Stock Prediction with TimesFM

A stock prediction application that uses Google's TimesFM (Time Series Foundation Model) to forecast stock prices from Yahoo Finance, with FastAPI serving as the backend API.

Project Structure

The application consists of three main components:

  1. stock_predictor.py - Core prediction logic that handles stock data retrieval and forecasting using the TimesFM model. Configurable parameters include:

    • name: Stock ticker symbol (e.g., AAPL, GOOGL, TSLA)
    • interval: Data sampling frequency (e.g., 1d, 1h, 5m)
    • period: Historical data range (e.g., 1mo, 3mo, 1y)
    • horizon_len: Number of future time steps to predict (e.g., 5, 10, 20)
  2. main.py - FastAPI backend server that exposes the API endpoints and serves the frontend through the templates and static directories

  3. requirements.txt - Python dependencies

Getting Started

This application requires the TimesFM model to be cloned and installed first.

python3 -m venv venv
source venv/bin/activate

git clone https://github.com/google-research/timesfm.git
cd timesfm

pip install -e .[torch]
cd ..
pip install -r requirements.txt

Preview

Stock Prediction Interface

About

A stock prediction application that uses Google's TimesFM (Time Series Foundation Model) to forecast stock prices from Yahoo Finance, with FastAPI serving as the backend API.

Topics

Resources

Stars

11 stars

Watchers

0 watching

Forks

Contributors

Languages