Commit cd48e3d3 by zihan

bug修复;添加日志

parent 9b2ca2fc
......@@ -23,6 +23,9 @@ let getUpdatedData = function (currentData, response) {
}
else if (response.data.action === 'CANCEL') {
newCount -= response.data.count;
if(newCount <0){
newCount = 0;
}
}
break;
}
......@@ -120,16 +123,17 @@ class biboxApi {
let asks = totalOrderbook[symbol].asks || [];
let bids = totalOrderbook[symbol].bids || [];
if(response.data.type === 'SELL'){
const oldD = totalOrderbook[symbol];
const updateData = getUpdatedData(oldD.asks, response);
const updateData = getUpdatedData(asks, response);
asks = mergeDepth(asks, updateData, true);
}else if(response.data.type === 'BUY'){
const oldD = totalOrderbook[symbol];
const updateData = getUpdatedData(oldD.bids,response);
const updateData = getUpdatedData(bids,response);
bids = mergeDepth(bids, updateData, false);
}
totalOrderbook[symbol].bids = bids
totalOrderbook[symbol].asks = asks
totalOrderbook[symbol].bids = bids;
totalOrderbook[symbol].asks = asks;
if(symbol === 'ETH-BTC'){
console.log(JSON.stringify(totalOrderbook['ETH-BTC']));
}
const ret = {data: {SELL: asks, BUY: bids}, timestamp: timeStamp, symbol: symbol}
callback(null,ret);
}else{
......@@ -342,7 +346,7 @@ class biboxApi {
this._request("POST","/v1/orderpending","orderpending/pendingHistoryList",params,callback);
}
getOrderbook(symbol,depth,bindIP,callback){
this._publicRequest("/v1/open/orders",{"symbol":symbol},callback,bindIP);
this._publicRequest("/v1/open/orders",{"symbol":symbol,"limit":20},callback,bindIP);
}
}
......
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