전현진

Delete test6.js

Showing 1 changed file with 0 additions and 31 deletions
1 -const fetch = require('node-fetch');
2 -const url = 'https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT';
3 -const options = {method: 'GET', headers: {Accept: 'application/json'}};
4 -const rp = require('request-promise');
5 -const requestOptions = {
6 - method: 'GET',
7 - uri: 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest',
8 - qs: {
9 - 'start': '1',
10 - 'limit': '10',
11 - 'convert': 'KRW'
12 - },
13 - headers: {
14 - 'X-CMC_PRO_API_KEY': 'c2f8e0b0-a253-4de3-a63f-9f564c8cdd1f'
15 - },
16 - json: true,
17 - gzip: true
18 -};
19 -fetch(url, options)
20 - .then(res => res.json())
21 - .then(json =>
22 - rp(requestOptions).then(response =>{
23 - var i=0;
24 - while(response.data[i].id !== 825){
25 - i = i+1;
26 - }
27 - console.log('API call response:', json.price*response.data[i].quote.KRW.price);
28 - })
29 -
30 - )
31 - .catch(err => console.error('error:' + err));