전현진

Delete market.js

Showing 1 changed file with 0 additions and 27 deletions
const fetch = require('node-fetch');
const fs = require('fs');
const url = 'https://api.upbit.com/v1/market/all?isDetails=false';
const options = {method: 'GET', headers: {Accept: 'application/json'}};
fetch(url, options)
.then(res => res.json())
.then(json => {
var coinName = [];
var j = 0;
var file = 'coin_name.txt';
fs.open(file,'w',function(err,fd){
if(err) throw err;
});
for (i=0;i<json.length;i++) {
if (json[i].market.indexOf("KRW")>-1){
console.log(json[i].market);
coinName[j] = json[i].market;
j=j+1;
}
}
console.log(coinName);
fs.writeFile(file,coinName,'utf8',function(error){
console.log('write end')
});
})
.catch(err => console.error('error:' + err));
\ No newline at end of file