Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Support newOrderRespType and fix onFailure routing in BinanceApiCallbackAdapter #122

Merged
merged 6 commits into from
May 4, 2018

Conversation

nilswx
Copy link

@nilswx nilswx commented Apr 29, 2018

Thanks for this library! I'm currently using it in my Scala project and I want to share some improvements.

Binance added newOrderRespType on their V3 API, allowing API clients to specify the desired response format by choosing between ACK/RESULT/FULL. FULL makes Binance return full details on the newly created order, including executedQty and fills, which in turn contain price, qty and commission. This enables you to calculate the (average) fill price for market orders. (fixes #105)

binance-java-api did not support this functionality yet. I also added error routing to BinanceApiCallbackAdapter, which previously threw any exceptions rather than calling onFailure of the wrapped BinanceApiCallback. Now you can actually catch exceptions when using the async API.

Copy link
Member

@joaopsilva joaopsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

@joaopsilva joaopsilva merged commit eb1ff5c into binance-exchange:master May 4, 2018
@personalityson
Copy link

Useless for new limit orders. We need it when checking on existing orders.

@nilswx
Copy link
Author

nilswx commented Jul 23, 2018

@personalityson: unfortunately, Binance REST API still does not offer that feature. The only way to get trade/fill details on historic orders is by requesting the trade history for the relevant symbol and then cursor-surfing through it until you find trades with that particular order ID. 😥

Far from efficient, but the only way to get it done. The endpoint is GET /api/v3/myTrades. Every symbol-specific request has a (rate limiting) weight of 5, but you can end up with a 150+ weight if you don't pass a symbol at all, which gets you throttled pretty quickly. v4 should have a filter for order ID.

I noticed in the Telegram group for developers that this is a much requested feature among users of their API. @binance-exchange should prioritize this over listing more shitcoins.

In my application I decided to reduce the excess of calls to /api/v3/myTrades by caching recent results, so that 'getTradesForOrder' can search through there. It works.

nilswx pushed a commit to nilswx/binance-java-api that referenced this pull request Dec 14, 2018
Support newOrderRespType and fix onFailure routing in BinanceApiCallbackAdapter.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to check real buy price
3 participants