Commit 4f2228b8 by zihan

502也继续创建卖单

parent 09cc245f
......@@ -48,53 +48,6 @@ class biboxApi {
this.allowRequest = true;
}
// subscribeSymbolsAndTicker(symbols, callback) {
// this._publicRequest('/v1/bullet/usercenter/loginUser',{protocol:'websocket',encrypt:true},(error,result)=>{
// if(error){
// console.log("fetch ws token error");
// this.subscribeSymbolsAndTicker(symbols,callback);
// }else{
// const token = result.data.bulletToken;
// this._openWs(symbols,token,callback);
// }
// });
// }
// _openWs(symbols,token, callback) {
// const reqURL = `${wsUrl}?bulletToken=${token}&format=json&resource=api`;
// const wss = new WebSocket(reqURL, {agent});
// wss.on('open', () => {
// console.log("websocket on open");
// });
// wss.on('message', (data) => {
// const response = JSON.parse(data);
// if(response.type === 'ack'){
// const id = response.id;
// for(const symbol of symbols){
// wss.send(JSON.stringify({id,type:'subscribe','topic':`/trade/${symbol}_TRADE`}))
// }
// setInterval(()=>{
// wss.send(JSON.stringify({id,type:'ping'}))
// },40000);
// }else if(response.type === 'subscribe'){
// callback(null,response);
// }else{
// console.log(data);
// }
// });
// wss.on('error', (error) => {
// console.log(" websocket error:");
// console.log(error);
// })
// wss.on('close', () => {
// console.log("websocket closed");
// setTimeout(() => {
// this.subscribeSymbolsAndTicker(symbols, callback);
// }, 2000);
// })
// }
subscribeSymbols(symbols, depth, callback) {
this._publicRequest('/v1/bullet/usercenter/loginUser',{protocol:'websocket',encrypt:true},(error,result)=>{
if(error){
......
......@@ -37,7 +37,7 @@ class BiboxStrategy3 extends Strategy3 {
sellSymbol, sellPrice, amount, constants.OrderSideSell
, (error, order) => {
if (error) {
if(error.code === "NO_BALANCE" || (error.code === 'ERROR' && error.msg === 'SYMBOL NOT FOUND')){
if(error.code === "NO_BALANCE" || (error.code === 'ERROR' && error.msg === 'SYMBOL NOT FOUND') || error.statusCode == 502){
if(retryTime>0 && !createdSellOrder){
console.log("提示余额不足,再次尝试");
retryTime -- ;
......
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