Update Crex24 market

This commit is contained in:
joeuhren
2020-11-20 11:29:11 -07:00
parent 0f050c6475
commit e500a40192
+2 -36
View File
@@ -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);