There’s a function called getExchangeRates. That sounds like something we might really be interested in.
kucoin.getExchangeRates();xrates = _;
Now xrates.data.currencies contains an array list of [name,symbol] pairs.
[[ ‘USD’, ‘$’ ], [ ‘EUR’, ‘€’ ], [ ‘AUD’, ‘$’ ], … ]
and xrates.data.rates contains a property for BTC that is a mapping of those currencies to the value in that currency:
BTC : { /*…*/ EUR: 5442.33, DKK: 40570.1, USD: 6380.3, /*…*/ }
Now, these exchange rates are moving around constantly, so I can’t really grab an exact screenshot from when I pulled the rates, but if I look at what Bitstamp is reporting for the BTC/USD rate, it’s ~6380 there as well. Since Kucoin doesn’t really have USD fiat trading pairs, the closest you’d be able to get is comparing BTC/USDT, which is the pair with the “stable coin” called USDT or Tether.
So, if you had a ticker that was priced in BTC, like LOCI/BTC, you could take the current price times the xrates.data.rates.BTC.USD and obtain the US Dollar equivalent price.
First some setup to make our lives easier:
const async = require(‘asyncawait/async’);const await = require(‘asyncawait/await’);async function get_kucoin_ticker_price_in_btc(pair) { return new Promise(function(res, rej) { kucoin.getTicker({pair:pair}).then( function(ticker) { res(ticker.data.lastDealPrice); }); });}
Now we can do some quick calls:
let locibtc = await get_kucoin_ticker_price_in_btc(‘LOCI-BTC’);let wtcbtc = await get_kucoin_ticker_price_in_btc(‘WTC-BTC’);// locibtc = 0.00000517 BTC// wtcbtc = 0.00100298 BTClet loci_per_wtc = wtcbtc / locibtc; // ~194 LOCI per WTC
What can we do with this information? We can approximate how many dollars equivalent a given WTC is versus LOCI without even converting to USD. That’s very clever. That means we could come up with our own base pairs that you wouldn’t find on just about any sites but your own. Or, you could build a service that takes different sorts of tokens under certain conditions as “compatible tokens” as equivalent methods for swapping payment. You could also build a screener that shows how your set of tokens in your portfolio are faring against other tokens you have on a relative-strength basis, or give you a quick way of instantly seeing how many more of X token you could accumulate versus coin Y, using non-stale data, but instead exchange data from Kucoin.
Additional verification with reproducible builds
Experienced users who don’t mind performing additional steps can take advantage of Bitcoin Core’s reproducible builds and the signed checksums generated by contributors who perform those builds.
-
Reproducible builds allow anyone with a copy of Bitcoin Core’s MIT-licensed source code to build identical binaries to those distributed on this website (meaning the binaries will have the same cryptographic checksums as those provided by this website).
-
Verified reproduction is the result of multiple Bitcoin Core contributors each independently reproducing identical binaries as described above. These contributors cryptographically sign and publish the checksums of the binaries they generate.
Verifying that several contributors you trust all signed the same checksums distributed in the release checksums file will provide you with additional assurances over the preceding basic verification instructions. Alternatively, reproducing a binary for yourself will provide you with the highest level of assurance currently available. For more information, visit the project’s repository of trusted build process signatures.
Bitcoin Core is a community-driven free software project, released under the open source MIT license.