Guest User

Untitled

a guest
Nov 10th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const request = require('request');
  2.  
  3. const fetchEthexData = (ticker, callback) => {
  4.   request({
  5.     url:'https://api.ethex.market:5055/ticker24',
  6.     json: true
  7.   }, (error, response, body) => {
  8.     if(error) {
  9.       callback('Unable to connect to ethex');
  10.     } else {
  11.       console.log(body.ETH_BAT.last);
  12.         //tutaj chciałbym aby dostawałem dane w zależności od tego co podam do funkcji jako "ticker", czyli jeśli po 'BAT' to wyświetla //mi się body.ETH_BAT.last, jeśli podam 'DAI' to wyświetla mi się body.ETH_DAI.last itp.
  13. //Da się tak w ogóle?
  14.     }
  15.   });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment