-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
181 lines (156 loc) · 6.27 KB
/
index.html
File metadata and controls
181 lines (156 loc) · 6.27 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TurtleCoin Supply</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
</head>
<body>
<div class="container">
<nav class="navbar is-transparent">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<img src="/img/turtlecoin_wordmark_color@HD.png" alt="TurtleCoin Supply info" width="112" height="40">
</a>
<div class="navbar-burger burger" data-target="navbarExampleTransparentExample">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="navbarExampleTransparentExample" class="navbar-menu">
<!-- <div class="navbar-start">
<a class="navbar-item" href="https://turtlecoin.lol/" target="_blank">
About TRTL
</a>
</div> -->
<div class="navbar-end">
<div class="navbar-item">
<div class="field is-grouped">
<p class="control">
<a class="button is-primary" href="https://medium.com/@turtlecoin/one-trillion-turtles-coin-supply-and-unit-economics-5bfbea0aa1f1" target="_blank">
<span>Coin Supply and Unit Economics</span>
</a>
</p>
</div>
</div>
</div>
</div>
</nav>
<section id="mainmsg">
<article class="message is-primary">
<div class="message-header">
<p>TurtleCoin.supply</p>
</div>
<div class="message-body">
<div class="columns">
<div class="column">
Current supply: <strong id="supply"></strong>
</div>
<div class="column">
Current price: <strong id="currentPrice"></strong>
</div>
<div class="column">
Market Cap: <strong id="marketCap"></strong>
</div>
</div>
</div>
</article>
</section>
<section id="chart">
<canvas id="myChart" width="400" height="400"></canvas>
</section>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js"></script>
<script src="https://npmcdn.com/Chart.Zoom.js@latest/Chart.Zoom.min.js
"></script>
<script>
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function getDates() {
return axios.get('/dates.json');
}
function getSupply() {
return axios.get('/supply.json');
}
// function getCurrentSupply() {
// return axios.get('https://trtl-explorer.xhub.cloud/q/supply/')
// }
// function getTurtleCoinPrice() {
// return axios.get('https://tradeogre.com/api/v1/ticker/BTC-TRTL')
// }
// function getCurrentBitcoinPrice() {
// return axios.get('https://api.coindesk.com/v1/bpi/currentprice.json')
// }
function getMarketData() {
return axios.get('https://api.coinmarketcap.com/v2/ticker/2958/')
}
axios.all([getMarketData(), getDates(), getSupply()])
.then(axios.spread(function(marketData, dates, supply, ) {
// btc_price = bitcoinPrice.data.bpi.USD.rate_float;
// trtl_price = turtleCoinPrice.data.price;
// usdTrtlPrice = (btc_price * trtl_price).toFixed(8);
document.querySelector("#supply").innerText = numberWithCommas(marketData.data.data.circulating_supply);
document.querySelector("#currentPrice").innerText = `$${marketData.data.data.quotes.USD.price.toFixed(6)}`;
document.querySelector("#marketCap").innerText = `$${numberWithCommas(marketData.data.data.quotes.USD.market_cap.toFixed(0))}`;
console.log(marketData.data.data.circulating_supply)
console.log(marketData.data.data.quotes.USD)
var ctx = document.getElementById("myChart").getContext('2d');
new Chart(ctx, {
type: 'line',
data: {
labels: dates.data.dates,
datasets: [{
data: supply.data.supply,
label: "Supply (Billion)",
borderColor: "#3cba9f",
fill: false
},{
data: supply.data.supply,
label: "Block Reward",
borderColor: "red",
fill: false
}]
},
options: {
title: {
display: true,
text: 'TurtleCoin Supply in Billions'
},
// Container for pan options
// pan: {
// // Boolean to enable panning
// enabled: true,
// // Panning directions. Remove the appropriate direction to disable
// // Eg. 'y' would only allow panning in the y direction
// mode: 'xy'
// },
// Container for zoom options
zoom: {
// Boolean to enable zooming
enabled: true,
// Zooming directions. Remove the appropriate direction to disable
// Eg. 'y' would only allow zooming in the y direction
mode: 'x',
}
}
});
}));
</script>
</body>
</html>
<style>
#mainmsg {
margin-top: 3em;
}
#myChart {
display: table;
margin: 0 auto;
margin-top: 2em;
max-width: 1000px;
max-height: 800px;
}
</style>