LoginSignup
1
0

More than 5 years have passed since last update.

Ether の日本円価格を取得

Posted at
  • Ether の日本円価格(レート)を取得する方法です。
  • coinmarketcap の API を使用します。

Node.js によるサンプルコード

let https = require('https');
const url = 'https://api.coinmarketcap.com/v2/ticker/1027/?convert=JPY';

https.get(url, (response) => {
  response.setEncoding('utf8');
    let rawData = '';
  response.on('data', (chunk) => { rawData += chunk; });
  response.on('end', (response) => {
    json = JSON.parse(rawData);
    console.log('ETH/JPY', json.data.quotes.JPY.price);
  });
}).on('error', (e) => {
  console.log(e.message);
});
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0