add few data sources
This commit is contained in:
@@ -8,11 +8,43 @@ const dataSources = [
|
||||
name: 'blockchain.info',
|
||||
url: 'https://blockchain.info/tobtc?currency=USD&value=1',
|
||||
pick: res => 1 / +res,
|
||||
asset: 'USD',
|
||||
},
|
||||
{
|
||||
name: 'binance',
|
||||
url: 'https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT',
|
||||
pick: res => +res.price,
|
||||
asset: 'USDT',
|
||||
},
|
||||
{
|
||||
name: 'bybit',
|
||||
url: 'https://api.bybit.com/v2/public/tickers?symbol=BTCUSD',
|
||||
pick: res => +res.result[0].last_price,
|
||||
asset: 'USD',
|
||||
},
|
||||
{
|
||||
name: 'coinbase',
|
||||
url: 'https://api.coinbase.com/v2/prices/spot?currency=USD',
|
||||
pick: res => +res.data.amount,
|
||||
asset: 'USD',
|
||||
},
|
||||
{
|
||||
name: 'kraken',
|
||||
url: 'https://api.kraken.com/0/public/Ticker?pair=XXBTZUSD',
|
||||
pick: res => +res.result.XXBTZUSD.a[0],
|
||||
asset: 'USD',
|
||||
},
|
||||
{
|
||||
name: 'bitstamp',
|
||||
url: 'https://www.bitstamp.net/api/v2/ticker/btcusd',
|
||||
pick: res => +res.last,
|
||||
asset: 'USD',
|
||||
},
|
||||
{
|
||||
name: 'coingecko',
|
||||
url: 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd',
|
||||
pick: res => +res.bitcoin.usd,
|
||||
asset: 'USD',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -23,7 +55,6 @@ const get = async (url) => {
|
||||
|
||||
const calcAverage = () => {
|
||||
const arr = prices.value;
|
||||
console.log(arr);
|
||||
average.value = arr.reduce((sum, val) => sum + val, 0) / arr.length;
|
||||
};
|
||||
|
||||
@@ -47,6 +78,11 @@ const prices = ref([]);
|
||||
loop();
|
||||
})();
|
||||
|
||||
// get(`
|
||||
// `.trim()).then(res => {
|
||||
// console.log(res);
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user