switched out the defunct xmr.to with binance for xmr prices

This commit is contained in:
Jan Scheiper 2021-04-16 11:15:52 +02:00
parent cd1b9dd071
commit 7f766a1653
3 changed files with 6 additions and 5 deletions

View File

@ -24,9 +24,10 @@ class XMRData extends EventEmitter {
axios.get("https://bitpay.com/api/rates/eur").catch(err => log.error(err.config.url, err.message)), axios.get("https://bitpay.com/api/rates/eur").catch(err => log.error(err.config.url, err.message)),
// axios.get("https://shapeshift.io/marketinfo/btc_xmr").catch(err => log.error(err.config.url, err.message)), // axios.get("https://shapeshift.io/marketinfo/btc_xmr").catch(err => log.error(err.config.url, err.message)),
axios.get("https://api.morphtoken.com/rates").catch(err => log.error(err.config.url, err.message)), axios.get("https://api.morphtoken.com/rates").catch(err => log.error(err.config.url, err.message)),
axios.get("https://xmr.to/api/v2/xmr2btc/order_parameter_query/").catch(err => log.error(err.config.url, err.message)), // axios.get("https://xmr.to/api/v2/xmr2btc/order_parameter_query/").catch(err => log.error(err.config.url, err.message)),
axios.get("https://api.binance.com/api/v3/ticker/price?symbol=XMRBTC").catch(err => log.error(err.config.url, err.message)),
]).then(resp => { ]).then(resp => {
let bitpay = null, morphtoken = null, xmrto = null, morphtoken_xmr = null; let bitpay = null, morphtoken = null, binance = null, morphtoken_xmr = null;
if (resp[0] != undefined) { if (resp[0] != undefined) {
bitpay = resp[0].data.rate; bitpay = resp[0].data.rate;
@ -38,11 +39,11 @@ class XMRData extends EventEmitter {
} }
if (resp[2] != undefined) { if (resp[2] != undefined) {
xmrto = (Math.round((bitpay * resp[2].data.price) * 100) / 100) + "€"; binance = (Math.round((bitpay * resp[2].data.price) * 100) / 100) + "€";
} }
} }
this.emit("data", { morphtoken, xmrto, morphtoken_xmr }); this.emit("data", { morphtoken, binance, morphtoken_xmr });
}); });
} }
} }

BIN
page/img/binance.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -107,7 +107,7 @@
</div> </div>
<div class="databox"> <div class="databox">
<img class="icon" src="img/xmrto.png"><div class="data d-monero-xmrto">---</div> <img class="icon" src="img/binance.png"><div class="data d-monero-binance">---</div>
</div> </div>
</div> </div>