krystianity / node-bitstamp

bitstamp REST and WS API Node.js client :dollar:
MIT License
59 stars 41 forks source link

bitstamp.sellMarketOrder() - anyone else noticed this sometimes doesn't sell 100%? #28

Closed tiagosiebler closed 5 years ago

tiagosiebler commented 5 years ago

Bit of a vague question, has anyone noticed that sellMarketOrder doesn't always sell 100% of the desired amount?

Pseudo-example:

var amount = 5000;
var asset = "xrpeur";

console.log(`Selling ${amount}`);
bitstamp.sellMarketOrder(amount, asset)
  .then(orderResponse => logicToSumAmountSoldFromAPIResponse(orderResponse))
  .then(amountSold => console.log(`Sold ${amountSold}`));

It doesn't happen every time, but I've noticed this twice in two or three weeks. The output might look something like:

Selling 5000
Sold 2145

I've eliminated my own logic from the scenario, and even the API response from binance shows the order finished ("status": "Finished") and the fills only partially match what I wanted to sell.

On bitstamp, I see I'm still holding the remaining assets and there's no open order. It just didn't sell everything I wanted it to. Contacted bitstamp support too.

tiagosiebler commented 5 years ago

Spoke with bitstamp, two running tests (different sub accounts) triggered conflicting orders. One tried to market buy, one tried to market sell. This self-matching cancelled the order, you can see this in your account history page: https://www.bitstamp.net/account/history/

In case anyone else struggles with this.