-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindodaxmarkets.html
More file actions
110 lines (93 loc) · 2.4 KB
/
indodaxmarkets.html
File metadata and controls
110 lines (93 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Indodax Markets</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
table {
border-collapse: collapse;
width: 100%;
}
table td,
table th {
border: 1px solid #ddd;
padding: 8px;
}
table tr:nth-child(even) {
background-color: #f2f2f2;
}
table tr:hover {
background-color: #ddd;
}
table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
</style>
<!-- TODO: Missing CoffeeScript 2 -->
<script type="text/javascript">
var reloadData = 30; // dalam detik
var timer;
function updateDataAPI() {
$.ajax({
url: 'https://indodax.com/api/summaries',
success: function(data) {
var row;
$('#coins').html('<tr><th>Pairs</th><th>Harga</th> <th>Beli</th> <th>jual</th> <th>Tertinggi 24h</th><th>Terendah 24h</th></tr>')
for (var key in data.tickers) {
row = `<tr>
<td>` + key.toUpperCase() + `</td>
<td>` + formatNumber(data.tickers[key].last) + `</td>
<td>` + formatNumber(data.tickers[key].buy) + `</td>
<td>` + formatNumber(data.tickers[key].sell) + `</td>
<td>` + formatNumber(data.tickers[key].high) + `</td>
<td>` + formatNumber(data.tickers[key].low) + `</td>
</tr>`
$('#coins tr:last').after(row);
}
clearTimeout(timer)
$('#timer').html(reloadData)
setTimeout(updateDataAPI, reloadData * 1000)
updateTimer()
},
error: function(err) {
alert("Tidak bisa mengambil data API")
}
})
}
function formatNumber(n) {
if (n.indexOf('.') > -1)
return parseFloat(n).toFixed(8);
else
return parseInt(n).toLocaleString("id-ID")
}
function updateTimer() {
a = parseInt($('#timer').html())
$('#timer').html(a - 1)
if (a > 0)
timer = setTimeout(updateTimer, 1000)
}
updateDataAPI()
</script>
</head>
<body>
<p><b>Update data dalam: <span id="timer">0</span> Detik</b></p>
<table id="coins">
<tr>
<th>Pairs</th>
<th>Harga</th>
<th>Beli</th>
<th>jual</th>
<th>Tertinggi 24h</th>
<th>Terendah 24h</th>
</tr>
</table>
</body>
</html>