1, CURLOPT_TIMEOUT => 10, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_USERAGENT => 'MarketPractice/1.0']); $body = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } else { $body = @file_get_contents($url, false, stream_context_create(['http' => ['timeout' => 10, 'header' => "User-Agent: MarketPractice/1.0\r\n"]])); $code = $body === false ? 0 : 200; } if ($body !== false && $code === 200 && json_decode($body) !== null) { file_put_contents($file, $body, LOCK_EX); header('X-Cache: miss'); echo $body; exit; } if (is_file($file)) { header('X-Cache: stale'); readfile($file); exit; } http_response_code(502); echo '{"error":"upstream unavailable"}'; exit; } ?> Market Practice | Live crypto markets
Educational project. Live data from public APIs. No trading, accounts or deposits.

Track the crypto market in real time

Prices, biggest movers and headlines for the top coins, refreshed automatically from public data sources.

Searches the top 100 coins by market cap.

Latest headlines

Loading…

Markets

Loading…
CoinPrice (USD)24h change24h volume7 days
Loading coins…

News and insight

Headlines are live from CoinDesk. The other two tabs hold sample text.
Loading news…

Built for learning

◔

Live prices

Straight from CoinGecko and Binance. Nothing is adjusted.

★

Favorites

Star any coin. Your list is saved in this browser.

◐

Light and dark

Follows your device. The header button overrides it.

⚡

Cached by the server

Many visitors cost one upstream request per cache window.

How the data gets here

The browser asks this file

The page calls index.php?r=top on the same site.

The server fetches and caches

It asks CoinGecko, Binance and a CoinDesk feed, then keeps the answer for 30 to 120 seconds.

JavaScript draws the page

The JSON becomes the tickers, rows, charts and headlines you see.

Questions

Can I trade here?

No. There are no accounts, deposits or orders.

Why might a price differ from my exchange?

Each source updates on its own schedule, and the server cache can make data up to two minutes old.

Why do Gainers sometimes say CoinGecko, not Binance?

Binance blocks some server locations. The page then falls back to CoinGecko data and says so.

Want to learn from the code?

Open this one file. Server code first, then styles, page and JavaScript.

Back to the markets