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

MARKET orders should not set params "price" and "timeInForce" #353

Closed fpaincha closed 4 months ago

fpaincha commented 10 months ago

Version of this library.

1.46.1

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

Hardware?

Local server/workstation

Operating System?

Windows

Python version?

Python3.10

Installed packages

No response

Logging output

No response

Processing method?

stream_buffer

Used endpoint?

concerns all

Issue

The create_order method always sets params "price" and "timeInForce" but that triggers an error from Binance for MARKET orders since those two params do not make sense for them.

The code should only set those params if the order_type is != "MARKET".

Thanks!

oliver-zehentleitner commented 4 months ago

I have updated the create_order() and create_test_order() functions according to these instructions.

Order type Mandatory parameters
LIMIT
  • timeInForce
  • price
  • quantity
LIMIT_MAKER
  • price
  • quantity
MARKET
  • quantity or quoteOrderQty
STOP_LOSS
  • quantity
  • stopPrice or trailingDelta
STOP_LOSS_LIMIT
  • timeInForce
  • price
  • quantity
  • stopPrice or trailingDelta
TAKE_PROFIT
  • quantity
  • stopPrice or trailingDelta
TAKE_PROFIT_LIMIT
  • timeInForce
  • price
  • quantity
  • stopPrice or trailingDelta

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/