askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.08k stars 3.93k forks source link

Unable to add new Exchange Stex .. #2782

Closed AmjadIqbal closed 5 years ago

AmjadIqbal commented 5 years ago

hi to all,

I am adding a new exchange call stex , I have done almost all the thing which was required to add a new exchange, I make a request to stex api and get the result and send to handle the response

const fetch = cb => this.stex.tradeHistoryPub('BTCZ_LTC', this.handleResponse('getTrades', cb));

i try to console.log the result handleresponse receive

first i try to console.log(body) i got nothing when i try console.log(error) i got result data

{"success":1,"result":[ here comes result ]}' }

Trader.prototype.handleResponse = function(funcName, callback) { return (error, body) => { // return callback; console.log(error); if (body && body.code) { error = new Error(Error ${body.code}: ${body.msg}); } if(error) { if(_.isString(error)) { error = new Error(error); } if(includes(error.message, recoverableErrors)) { error.notFatal = true; } if(funcName === 'cancelOrder' && error.message.includes('UNKNOWN_ORDER')) { console.log(new Date, 'cancelOrder', 'UNKNOWN_ORDER'); // order got filled in full before it could be // cancelled, meaning it was NOT cancelled. return callback(false, {filled: true}); } if(funcName === 'checkOrder' && error.message.includes('Order does not exist.')) { console.log(new Date, 'Binance doesnt know this order, retrying up to 10 times..'); error.retry = 10; }

  if(funcName === 'addOrder' && error.message.includes('Account has insufficient balance')) {
    console.log(new Date, 'insufficientFunds');
    error.type = 'insufficientFunds';
  }
  return callback(error);
}
return callback(undefined, body);

} };

stex-output

can anyone know how to fix this isssue?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.