Heatmap / README.md
thonguyen511's picture
fix: correct YAML frontmatter syntax
35557a2
|
Raw History Blame Contribute Delete
3.47 kB
metadata
title: Global Market Heatmap
emoji: 🌍
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false

Global Market Heatmap 🌍

A beautiful, interactive 3D WebGL visualization of global financial markets utilizing Three.js and automated backend data scraping.

Overview

This project provides an interactive 3D visualization of the Earth and Moon. Global financial markets are plotted across the globe, with their indicators dynamically changing color in real-time based on actual UTC market hours and holidays.

Users can explore the data by interacting with specific countries to view their TradingView stock heatmaps, or by clicking the orbiting Moon to dive into the global cryptocurrency market.

Features

  • 3D Globe & Moon: Built natively with Three.js. Features highly realistic textures, orbital mechanics, and dynamic day/night cycles synchronized to simulated or real time.
  • Live Market Hours: Market dots update their color seamlessly based on their real-world open/close UTC schedules (Green = Open, Red = Closed, Blue = Holiday).
  • Top Time Marquee: A continuous scrolling marquee tracking the real-world time across major global financial hubs.
  • Automated Python Scrapers: Includes robust Playwright scripts (scrape.py and scrape_crypto.py) that run headlessly to navigate TradingView, enable dark mode, and download high-resolution market heatmaps into the local cache.
  • Smart Interactions:
    • Earth Interaction: Hover over any market dot for a quick peek, or left-click to pin the Heatmap UI open.
    • Moon Interaction: Click the moon to explore the global cryptocurrency market (no hover effect).

Technology Stack

  • Three.js: 3D WebGL rendering, orbit controls, camera math, and custom shaders.
  • D3.js: Equirectangular projection of GeoJSON data to map country borders onto the globe.
  • date-holidays: Backend Node.js library utilized to autogenerate accurate worldwide market holiday schedules.
  • HTML/CSS/JS: Pure Vanilla JS, styled elegantly with CSS backdrops and micro-animations.

Running Locally

You can run this project easily using Docker!

Using Docker

  1. Build the image:
docker build -t global-market-heatmap .
  1. Run the container:
docker run -p 8080:80 global-market-heatmap
  1. Open your browser and navigate to http://localhost:8080.

Without Docker (Node.js)

If you prefer running it locally with Node.js:

npx serve .

Folder Structure

.
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ cache_png/   # Autogenerated High-Res PNG Heatmaps
β”‚   β”œβ”€β”€ geo/         # GeoJSON borders & market_chosen.json config
β”‚   └── textures/    # High-res 2k Earth & Moon maps
β”œβ”€β”€ css/             # Stylesheets
β”œβ”€β”€ scripts/         # Automated Scrapers
β”‚   β”œβ”€β”€ scrape.py           # Playwright scraper for all global markets
β”‚   β”œβ”€β”€ scrape_crypto.py    # Playwright scraper for the Crypto market
β”‚   └── generate_holidays.js # Generates holiday JSON data for market schedules
β”œβ”€β”€ src/             # ES6 Modules
β”‚   β”œβ”€β”€ core/        # Scene setup and Time loop manager
β”‚   β”œβ”€β”€ objects/     # Earth, Moon, and Market dot generators
β”‚   β”œβ”€β”€ ui/          # Raycaster and interaction logic
β”‚   └── main.js      # Application entry point
β”œβ”€β”€ Dockerfile       # Nginx static server image
└── index.html       # HTML layout