-
-
价格(USDT)
-
数量(BTC)
+
-
-
@@ -240,14 +250,16 @@ if ($user_id) {
let marketData = {};
let orderTypes = { buy: 'market', sell: 'limit' };
let activeTab = 'open';
+ const lang = '';
const pairs = [
- 'BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT', 'ADAUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT', 'AVAXUSDT'
+ 'BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'SOLUSDT', 'XRPUSDT', 'ADAUSDT', 'AVAXUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT',
+ 'MATICUSDT', 'NEARUSDT', 'LTCUSDT', 'ATOMUSDT', 'UNIUSDT', 'XLMUSDT', 'ALGOUSDT', 'TRXUSDT', 'BCHUSDT', 'SHIBUSDT'
];
function initChart(symbol) {
new TradingView.widget({
- "width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": "zh_CN", "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true, "allow_symbol_change": false, "save_image": false
+ "width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": lang === 'zh' ? 'zh_CN' : 'en', "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true, "allow_symbol_change": false, "save_image": false
});
}
initChart(currentPair);
@@ -271,6 +283,7 @@ if ($user_id) {
document.getElementById('last-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('price-change').innerText = (data.P >= 0 ? '+' : '') + data.P + '%';
document.getElementById('ob-mid-price').innerText = currentPrice.toLocaleString();
+ document.getElementById('ob-mid-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('high-24h').innerText = parseFloat(data.h).toLocaleString();
document.getElementById('low-24h').innerText = parseFloat(data.l).toLocaleString();
document.getElementById('vol-24h').innerText = parseFloat(data.v).toLocaleString();
@@ -285,10 +298,18 @@ if ($user_id) {
pairs.forEach(p => {
const d = marketData[p] || {c: 0, P: 0};
const name = p.replace('USDT', '');
+ const icon = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
html += `
-
${name}/USDT
-
${parseFloat(d.c).toLocaleString()}
+

+
+
${name}/USDT
+
Vol ${parseFloat(d.v || 0).toLocaleString()}
+
+
+
${parseFloat(d.c).toLocaleString()}
+
${(d.P >= 0 ? '+' : '') + d.P}%
+
`;
});
@@ -296,10 +317,12 @@ if ($user_id) {
}
function switchPair(p) {
+ if (currentPair === p) return;
currentPair = p;
const name = p.replace('USDT', '');
document.getElementById('current-pair-display').innerText = name + '/USDT';
document.querySelectorAll('.asset-name').forEach(el => el.innerText = name);
+ document.getElementById('current-logo').src = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
initChart(p);
updateAvailable();
}
@@ -328,15 +351,46 @@ if ($user_id) {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
let asksHtml = ''; let bidsHtml = '';
- for(let i=0; i<10; i++) {
- const ap = currentPrice * (1 + (i+1)*0.001);
- const bp = currentPrice * (1 - (i+1)*0.001);
- asksHtml += `
${ap.toFixed(2)}${(Math.random()).toFixed(4)}
`;
- bidsHtml += `
${bp.toFixed(2)}${(Math.random()).toFixed(4)}
`;
+ let maxVol = 0;
+ const rows = 18;
+ const askData = [];
+ const bidData = [];
+
+ for(let i=0; i
+
+ ${ap.toFixed(2)}
+ ${av.toFixed(4)}
+ `;
+ bidsHtml += `
+