from flask import Flask, render_template_string, jsonify import requests # Initialize Flask app app = Flask(__name__) # API endpoint for getting cryptocurrency prices from CoinGecko API_URL = 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,dogecoin&vs_currencies=usd' @app.route('/') def index(): # Render the main page return render_template_string(HTML_TEMPLATE) @app.route('/api/prices', methods=['GET']) def get_prices(): # Fetch price data response = requests.get(API_URL) prices = response.json() return jsonify(prices) # HTML template with HTMX integration HTML_TEMPLATE = ''' Crypto Price Dashboard

Cryptocurrency Prices

Loading...
''' # Run the application if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')