CurrencyQuote
JavaScript library of currency quotes. It is included by default - installation is not required.
It is have currencies and crypto currencies (top 100 list)
Update time:
    currencies update time is: once at 1 hour
    crypto currencies update time is: once at 5 minutes
Possibly longer update times due to network errors and other errors.
But you can check this.

Usage

Get prices:
1
// get EUR / USD cost
2
var eur_price = CurrencyQuote.fiat.EUR;
3
var btc_price = CurrencyQuote.crypto.BTC;
Copied!
Get crypto details:
1
// get EUR / USD cost
2
var btcDetails = CurrencyQuote.crypto.details.BTC;
3
Bot.inspect(btcDetails)
4
​
5
/* result:
6
{
7
"id": 1,
8
"name": "Bitcoin",
9
"symbol": "BTC",
10
"slug": "bitcoin",
11
"num_market_pairs": 9189,
12
"date_added": "2013-04-28T00:00:00.000Z",
13
"tags": [
14
"mineable",
15
"pow",
16
"sha-256",
17
...
18
],
19
"max_supply": 21000000,
20
"circulating_supply": 18741687,
21
"total_supply": 18741687,
22
"platform": null,
23
"cmc_rank": 1,
24
"last_updated": "2021-06-24T11:03:02.000Z",
25
"quote": {
26
"USD": {
27
"price": 33330.324732476154,
28
"volume_24h": 33455787206.23486,
29
"percent_change_1h": -0.01335238,
30
"percent_change_24h": -2.7360215,
31
...
32
"market_cap": 624666513744.4268,
33
"last_updated": "2021-06-24T11:03:02.000Z"
34
}
35
}
36
}
37
​
38
*/
Copied!
Convertation:
1
// convert 15 EUR to TRX
2
var trx = CurrencyQuote.convert({ amount: 15, from: "EUR", to: "TRX" })
3
​
4
// from 0.1 BTC to INR
5
var inr = CurrencyQuote.convert({ amount: 0.1, from: "BTC", to: "INR" })
Copied!

Check last updated time

1
// update time in seconds
2
// max time in normal 3600 seconds
3
var secsFiat = CurrencyQuote.fiat.getCachingTime();
4
var secsCrypto = CurrencyQuote.crypto.getCachingTime();
5
​
6
var oneHour = 60*60;
7
if(secsCrypto > oneHour){
8
// it is very old data! Last updated a hour ago
9
Bot.sendMessage("Please try later")
10
return
11
}
12
​
13
var oneDay = oneHour*24;
14
if(secsFiat > oneDay){
15
// it is very old data! Last updated a day ago
16
Bot.sendMessage("Please try later")
17
return
18
}
19
​
20
// get EUR
21
var eur_price = CurrencyQuote.fiat.EUR;
22
var btc_price = CurrencyQuote.crypto.BTC;
Copied!
​
Last modified 3mo ago