LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
677 stars 166 forks source link

Support parameter "quoteOrderQty" for MARKET orders in create_order (WebSocket) #352

Closed fpaincha closed 4 months ago

fpaincha commented 10 months ago

Is your feature request related to a problem? Please describe.

For MARKET orders, Binance supports a parameter called "quoteOrderQty" in order to specify the quantity of BTC to buy or sell by using an amount in the quote asset versus the base asset. Thus, for instance, one can order to market buy 1200 USDT worth of BTC on BTCUSDT. One does not need to convert 1200 USDT into BTC using the current BTC value, Binance does the conversion.

Ref: https://binance-docs.github.io/apidocs/websocket_api/en/#place-new-order-trade

The issue here is simply that the Unicorn library does not support that parameter.

Describe the solution you'd like.

The parameter should be added to create_order (in fact, it is even referenced in the method's documentation since it is a copy and paste of Binance's).

In the code, if quote_order_qty (new param) is 0.0, then quantity is used, else quote_order_qty is used.

Thanks!

Describe alternatives you've considered

No response

Additional context

No response

oliver-zehentleitner commented 4 months ago

The update is also included here: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/commit/3a715ee331592c7170fddeabf0f9dbe60c81b92e

After extensive testing I will create new packages for the installation. I will let you know here as soon as they are available.

oliver-zehentleitner commented 4 months ago

Its released: https://pypi.org/project/unicorn-binance-websocket-api/2.1.4/