Commit eb6c91be by zihan

bug fixed

parent 06c8f7bb
......@@ -244,7 +244,11 @@ class biboxApi {
_genSign(timestamp,method,path,params){
let signStr = null;
if(params){
signStr = timestamp+method+path+JSON.stringify(params);
if(method === 'GET'){
signStr = timestamp+method+path+"?"+this.transform(params)
}else{
signStr = timestamp+method+path+JSON.stringify(params);
}
}else{
signStr = timestamp+method+path;
}
......@@ -259,6 +263,12 @@ class biboxApi {
}
let url = host + path;
const timestamp = Date.now()+'';
const requestParams = {};
if (method === 'GET' && params) {
url += '?' + this.transform(params);
}else if(method === 'POST'){
requestParams["body"] = JSON.stringify(params);
}
const sign = this._genSign(timestamp,method,path,params);
const headers = {
'KC-API-KEY': this.apiKey,
......@@ -267,12 +277,7 @@ class biboxApi {
'KC-API-PASSPHRASE':this.pass,
"Content-Type": "application/json"
}
const requestParams = {};
if (method === 'GET' && params) {
url += '?' + this.transform(params);
}else if(method === 'POST'){
requestParams["body"] = JSON.stringify(params);
}
requestParams["url"] = url;
requestParams["method"] = method;
requestParams["headers"] = headers;
......@@ -322,7 +327,7 @@ class biboxApi {
}
balance(callback) {
this._request("GET", "/api/v1/accounts", null, callback);
this._request("GET", "/api/v1/accounts", {type:'trade'}, callback);
}
// coins_info(callback) {
......
......@@ -43,7 +43,7 @@ function testCollector(){
// const strategy3 = new BiboxStrategy3(collector);
// strategy3.run();
}
// testCollector();
testCollector();
function printCurrency(){
const currentArray = [,'ETH','BTC','LTC','BCH','USDT','USD','RMB',"RCN","WINGS","TRX","LEND","CMT","POWR","HSR","GAS","RDN","TNT","OAX"
......@@ -141,10 +141,10 @@ function testOrder(){
// console.log(error);
// console.log(result);
// })
api.balance((error,result)=>{
console.log(error);
console.log(result);
})
// api.balance((error,result)=>{
// console.log(error);
// console.log(result);
// })
// const sign = api._genSign('1547015186532','POST', '/api/v1/deposit-addresses',{'currency':'BTC'})
// console.log(sign === '7QP/oM0ykidMdrfNEUmng8eZjg/ZvPafjIqmxiVfYu4=');
// api.balance((error,data)=>{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment