From 42f9595c0a7b937a66e9bc81bf3347333442d3c8 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 Jan 2018 19:37:12 +1300 Subject: [PATCH] Get Trade history working and update nonce to allow more than one request/sec. --- index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index a90ebfe..e1b3d3d 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ Cryptopia.prototype.privateRequest = function(method, params, callback) var uri = this.privateApiPath + "/" + method var url = this.server + "/" + uri - var nonce = Math.floor(new Date().getTime() / 1000) + var nonce = Math.floor(new Date().getTime() / 1000) - Math.floor(Math.random() * 100); var md5 = crypto.createHash("md5").update( JSON.stringify( params ) ).digest() var requestContentBase64String = md5.toString("base64") var signature = this.api_key + "POST" + encodeURIComponent( url ).toLowerCase() + nonce + requestContentBase64String @@ -282,12 +282,11 @@ Cryptopia.prototype.getAccountRecords = function getAccountRecords(callback, sym }, callback) } -Cryptopia.prototype.getTradeHistory = function getTradeHistory(callback, symbol, since) -{ - this.privateRequest("trade_history", { - symbol: symbol, - since: since - }, callback) +Cryptopia.prototype.getTradeHistory = function getTradeHistory(callback, market) +{ + this.privateRequest("GetTradeHistory", { + Market: market + }, callback); } Cryptopia.prototype.getOrderHistory = function getOrderHistory(callback, symbol, status, current_page, page_length)