msolters / gdax-multipong

Multi-bucket range trading for the GDAX exchange
12 stars 5 forks source link

Not Found (404) trades not canceling #5

Open dlasher opened 6 years ago

dlasher commented 6 years ago

I originally posted on another tread, but the more I look at this issue, the more I think it's unique, so I'll open a new ticket, and try to edit my comments on the other thread.

So the API returns a "NotFound" - which does appear in the JSON. The GDAX console log shows:

23:35:20 {"response":{"statusCode":404,"body":"{\"message\":\"NotFound\"}","headers":{

However, when I try to echo out the contents of data.message to the log, it comes back empty.

let data try { data = await gdax.get_order_by_id( order_id ) } catch( e ) { ui.logger('gdax_log', JSON.stringify(e)) // TODO: analyze failure modes }

//my new lines ui.logger('sys_log',Trade ${trade.trade_id} Parsing ) ui.logger('sys_log',Message ${data.message} )

23:35:19 Trade 00c46bca-d0ae-4458-8f50-39fa4a694372 Parsing 23:35:19 {}

My current theory, gdax.js isn't handling "NotFound" correctly. I think the matching code is here:

/** * Get information about an order from GDAX by it's ID */ const get_order_by_id = exports.get_order_by_id = ( order_id ) => { return new Promise( (resolve, reject) => { gdax_private.getOrder( order_id, (error, response, data) => { if( error ) { reject( error ) return } resolve( data ) } ) }) }

gdax-node API says:

If the order is canceled the response may have status code 404 if the order had no matches.

epatrasc commented 6 years ago

I have the same issue when i cancel the orders. I have to delete the db and start again.