binance-exchange/node-binance-api

feature req: atomically change order

0xgeert opened this issue · 5 comments

On some Exchange APIs it's possible to atomically change an order. I.e..: withdraw/cancel an order + set a new one. Usescases: changed limit when it's clear it's not going to be filled, etc.

Thoughts?

I'd love to do this, but it has been getting more complicated. I got an error message the other day for making too many orders in a short time, for example, and another for too many cancelled orders, and I was only making a few orders by hand (not with the bot!)

@jaggedsoft hmm. Haven't seen any rate-limits like that. By any chance, have you been in contact with the guys at Binance to see if these rates can get documented somewhere?

Rate-limit info is available on the GET /api/v1/exchangeInfo-endpoint.

Seems to be okayish with:

  • 10 orders / sec
  • 100000 orders / day

@jaggedsoft : do you imagine you went over these limits?

Yes in addition to those, there are new undocumented rules:
https://support.binance.com/hc/en-us/articles/115003235691-Binance-API-Trading-Rules

Really just need a system to keep track of relevant order id's, amount, and price

global.orders[orderid] = {
	symbol: 'BNBBTC',
	type: 'LIMIT',
	side: 'BUY',
	quantity: 10,
	price: 0.00119471
};
binance.cancel('BNBBTC', orderid, (error, symbol, orderid) => {
    if ( error ) return console.error("cancel("+symbol+") error: ", error);
    let obj = global.orders[orderid];
    binance.order(obj.side, symbol, obj.quantity, obj.price, {type: obj.type}, (error, response) => {
	    console.log("Order response", response);
	    console.log("order id: " + response.orderId);
    });
    delete global.orders[orderid];
});