Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Gdax = require('gdax');
- const publicClient = new Gdax.PublicClient();
- function loop() {
- publicClient.getProduct24HrStats('BTC-USD', (err, response, data) => {
- if (err) {
- console.log(err);
- } else {
- console.log("BITCOIN");
- console.log("Last Price: $" + parseFloat(JSON.parse(response.body).last).toFixed(2));
- console.log("High Price: $" + parseFloat(JSON.parse(response.body).high).toFixed(2));
- console.log("Low Price: $" + parseFloat(JSON.parse(response.body).low).toFixed(2));
- console.log(" ");
- }
- });
- publicClient.getProduct24HrStats('ETH-USD', (err, response, data) => {
- if (err) {
- console.log(err);
- } else {
- console.log("ETHEREUM");
- console.log("Last Price: $" + parseFloat(JSON.parse(response.body).last).toFixed(2));
- console.log("High Price: $" + parseFloat(JSON.parse(response.body).high).toFixed(2));
- console.log("Low Price: $" + parseFloat(JSON.parse(response.body).low).toFixed(2));
- console.log(" ");
- }
- });
- publicClient.getProduct24HrStats('LTC-USD', (err, response, data) => {
- if (err) {
- console.log(err);
- } else {
- console.log("LITECOIN");
- console.log("Last Price: $" + parseFloat(JSON.parse(response.body).last).toFixed(2));
- console.log("High Price: $" + parseFloat(JSON.parse(response.body).high).toFixed(2));
- console.log("Low Price: $" + parseFloat(JSON.parse(response.body).low).toFixed(2));
- console.log(" ");
- }
- });
- setTimeout(function() { loop(); }, 3000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement