ViewBlock / binance-api-node

:chart: A complete and heavily tested wrapper with typings for the Binance API.
656 stars 501 forks source link

Cannot create STOP_MARKET order for spot trading #529

Open akrolasik opened 2 years ago

akrolasik commented 2 years ago

Cannot create STOP_MARKET order for spot trading

Error TS2322 (TS) Type 'OrderType.STOP_MARKET' is not assignable to type 'OrderType.LIMIT | OrderType.MARKET | OrderType.STOP_LOSS_LIMIT | OrderType.TAKE_PROFIT_LIMIT'

version: "binance-api-node": "^0.11.28"

In general, OrderType types description doesn't match with the API. Any working solution to create price activated market order will be appreciated.

subos2008 commented 2 years ago

Confirmed, the market stop order on Binance is called 'STOP_LOSS'.

binance-api-node has STOP and STOP_MARKET instead.

It appears we have two redundant strings, both incorrect.

subos2008 commented 2 years ago

I fixed the naming bug - however STOP_LOSS orders aren't supported for any of the listed symbols on the spot markets.

You can check orderTypes for all the symbols listed here: https://api.binance.com/api/v1/exchangeInfo

No (spot) symbols as of now support STOP_LOSS or TAKE_PROFIT (market) orderTypes.

subos2008 commented 2 years ago

Just use the _LIMIT equivalents instead

mohammadobaid1 commented 1 year ago

@subos2008 I am facing the same issue while creating a spot order with the type MARKET. I am using version 0.12.0 but getting the same error.