diff options
| author | Yuval Adam <_@yuv.al> | 2025-02-27 12:08:26 +0100 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2025-02-27 12:08:26 +0100 |
| commit | 70845c60807f71433dd6a2ba920b475942ba8e8f (patch) | |
| tree | a2350626b1c50f3b8edb2edd920d93c9232109dd | |
| parent | 6f678f4b7ce3fe98bc2b1f05215215ee23dfe403 (diff) | |
Initial btctick
| -rw-r--r-- | btctick/index.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/btctick/index.html b/btctick/index.html new file mode 100644 index 0000000..91a10b2 --- /dev/null +++ b/btctick/index.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html lang="en" dir="ltr"> + +<head> + <meta charset="utf-8"> + <title>BTC Ticker</title> + <style> + body { + font-family: monospace; + } + </style> + <script> + const socket = new WebSocket("wss://stream.binance.com:9443/stream"); + socket.onopen = () => { + socket.send(JSON.stringify({ + "method": "SUBSCRIBE", + "params": ["btcusdt@trade"], + "id": 1 + })); + }; + socket.onmessage = (event) => { + const data = JSON.parse(event.data); + if (data.data !== undefined) { + const d = data.data; + const price = d.p; + const priceElement = document.querySelector("#price"); + priceElement.innerText = price; + } + + }; + </script> +</head> + +<body> + <p id="price"></p> +</body> + +</html>
\ No newline at end of file |
