Files
ritmex-bot/docs/ccxt/examples/html/basic-cors-proxy.html
2025-10-03 15:28:16 +08:00

47 lines
1.1 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>CCXT Basic example for the browser</title>
<script type="text/javascript" src="https://unpkg.com/ccxt"></script>
<script>
document.addEventListener ("DOMContentLoaded", function () {
alert ('ccxt version ' + ccxt.version);
const exchange = new ccxt.bittrex ({
'proxyUrl': 'https://cors-anywhere.herokuapp.com/'
})
const symbol = 'BTC/USDT'
exchange.fetchTicker (symbol).then (ticker => {
const text = [
exchange.id,
symbol,
JSON.stringify (ticker, undefined, '\n\t')
]
document.getElementById ('content').innerHTML = text.join (' ')
}).catch (e => {
const text = [
e.constructor.name,
e.message,
]
document.getElementById ('content').innerHTML = text.join (' ')
})
})
</script>
</head>
<body>
<h1>Hello, CCXT!</h1>
<pre id="content"></pre>
</body>
</html>