index.js 1.18 KB
// const fetch = require('node-fetch');

// const url = 'https://api.upbit.com/v1/candles/weeks/?market=KRW-BTC&count=1';
// const options = {method: 'GET', headers: {Accept: 'application/json'}};

// fetch(url, options)
//   .then(res => res.json())
//   .then(json => console.log(json))
//   .catch(err => console.error('error:' + err));

//  const url = 'https://api.upbit.com/v1/candles/weeks/?market=' + data + '&count=1';
// var pumpingArr = new Array();
// const options = {method: 'GET', headers: {Accept: 'application/json'}};
// var coinJson = new Object();
// fetch(url, options)
// .then(res => res.json())
// .then(json => {
//     coinJson.coin = 'KRW-BTC';
//     coinJson.tradeVolume = json[0].candle_acc_trade_volume;
//     console.log(coinJson);
//     pumpingArr.push(coinJson);
//     console.log(pumpingArr);
// })
// .catch(err => console.error('error:' + err));


const fetch = require('node-fetch');

const url = 'https://api.upbit.com/v1/candles/minutes/1?market=KRW-BTC&count=1';
const options = {method: 'GET', headers: {Accept: 'application/json'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));