diff --git a/lib/markets/crex.js b/lib/markets/crex.js index edcc03e..a819d1b 100644 --- a/lib/markets/crex.js +++ b/lib/markets/crex.js @@ -1,16 +1,6 @@ var request = require('postman-request'); var base_url = 'https://api.crex24.com/v2/public'; -/** - * Get the Trades from the Crex24 API - * - * Request : https://api.crex24.com/v2/public/tickers?instrument=IPS-BTC - * - * - * @param {*} coin = ips - * @param {*} exchange = btc - * @param {*} cb = Callback - */ function get_summary(coin, exchange, cb) { var summary = {}; var url=base_url + '/tickers?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase(); @@ -33,15 +23,6 @@ function get_summary(coin, exchange, cb) { }); } -/** - * Get the Latest Trades from the Crex24 API - * - * Request : https://api.crex24.com/v2/public/recentTrades?instrument=LTC-BTC - * Issues : Label is not present in API - * @param {*} coin = ips - * @param {*} exchange = btc - * @param {*} cb = Callback - */ function get_trades(coin, exchange, cb) { var req_url = base_url + '/recentTrades?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase(); request({ uri: req_url, json: true }, function (error, response, body) { @@ -56,8 +37,6 @@ function get_trades(coin, exchange, cb) { ordertype: tTrades[i].side, amount: parseFloat(tTrades[i].volume).toFixed(8), price: parseFloat(tTrades[i].price).toFixed(8), - // total: parseFloat(tTrades[i].Total).toFixed(8) - // Necessary because API will return 0.00 for small volume transactions total: (parseFloat(tTrades[i].volume).toFixed(8) * parseFloat(tTrades[i].price)).toFixed(8), timestamp: parseInt((new Date(tTrades[i].timestamp).getTime() / 1000).toFixed(0)) } @@ -70,15 +49,6 @@ function get_trades(coin, exchange, cb) { }); } -/** - * Get the Latest Orders from the Crex24 API - * - * Request : https://api.crex24.com/v2/public/orderBook?instrument=IPS-BTC - * - * @param {*} coin = ips - * @param {*} exchange = btc - * @param {*} cb = Callback - */ function get_orders(coin, exchange, cb) { var req_url = base_url + '/orderBook?instrument=' + coin.toUpperCase() + '-' + exchange.toUpperCase(); request({ uri: req_url, json: true }, function (error, response, body) { @@ -94,20 +64,16 @@ function get_orders(coin, exchange, cb) { var order = { amount: parseFloat(buyorders[i].volume).toFixed(8), price: parseFloat(buyorders[i].price).toFixed(8), - // total: parseFloat(orders.BuyOrders[i].Total).toFixed(8) - // Necessary because API will return 0.00 for small volume transactions total: (parseFloat(buyorders[i].volume).toFixed(8) * parseFloat(buyorders[i].price)).toFixed(8) } buys.push(order); } - } - if (sellorders.length > 0) { + } else {} + if (sellorders.length > 0) { for (var x = 0; x < sellorders.length; x++) { var order = { amount: parseFloat(sellorders[x].volume).toFixed(8), price: parseFloat(sellorders[x].price).toFixed(8), - // total: parseFloat(orders.SellOrders[x].Total).toFixed(8) - // Necessary because API will return 0.00 for small volume transactions total: (parseFloat(sellorders[x].volume).toFixed(8) * parseFloat(sellorders[x].price)).toFixed(8) } sells.push(order);