Spaces:
Running
Running
Commit History
-
Goal:β
Verified signatureCreate a live but stable crypto dashboard that fetches Binance market data, calculates PHI and related metrics, stores them in cache, and displays smooth updates through index.html. 1. Folder Layout /cryptopulse-navigator β βββ app.py βββ Procfile βββ requirements.txt β βββ /data β βββ cache.json β βββ history.json β βββ /templates β βββ index.html β βββ /static βββ style.css 2. app.py (backend) from flask import Flask, jsonify, render_template import requests, math, statistics, time, os, json app = Flask(__name__) DATA_DIR = "data" CACHE_FILE = os.path.join(DATA_DIR, "cache.json") HISTORY_FILE = os.path.join(DATA_DIR, "history.json") os.makedirs(DATA_DIR, exist_ok=True) def fetch_json(url): try: r = requests.get(url, timeout=5) r.raise_for_status() return r.json() except Exception: return {} def compute_phi_metrics(symbol): ticker = fetch_json(f"https://api.binance.com/api/v3/ticker/24hr?symbol={symbol}") klines = fetch_jβ¦b2eed1c -
initial commit
Verified signaturebbce23f