ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.44k stars 7.46k forks source link

binance {"code":-1106,"msg":"Parameter 'stopPrice' sent when not required."} #7052

Closed viniciussvl closed 4 years ago

viniciussvl commented 4 years ago

Hello, Just now my code stopped working for no reason, it no longer creates orders of the type STOP_LOSS_LIMIT in Binance, saying that the stopPrice parameter is not mandatory, would it be a bug in the Binance API?

async createOrder(symbol, type, side, amount, price, stopPrice) {
        let data = []
        let params = {
            'stopPrice': stopPrice,
            'type': 'STOP_LOSS_LIMIT',
        }

        try {
            data = await this.binance.createOrder(symbol, type, side, amount, price, params)
        } catch (e) {
            let error = {
                error: this.extractErrorMessage(e.message)
            }

            return error
        }

        return data
    }
 binance {"code":-1106,"msg":"Parameter 'stopPrice' sent when not required."}
viniciussvl commented 4 years ago

I solved the problem, first updated my version of CCXT to the latest 1.28 and finally changed the type parameter from LIMIT to STOP_LOSS_LIMIT before creating the order

leonardoaraujosantos commented 3 years ago

I solved the problem, first updated my version of CCXT to the latest 1.28 and finally changed the type parameter from LIMIT to STOP_LOSS_LIMIT before creating the order

Hi Vinicius, I'm tying the same in python but is not working (binance {"code":-1106,"msg":"Parameter 'stopPrice' sent when not required."})

    def long(self, symbol: str, amount: float, rate: float, leverage: float, ref_timestamp: datetime):
        """
        Long (Futures COIN-M)
        https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
        https://github.com/ccxt/ccxt/blob/master/examples/py/binance-futures-margin.py
        https://stackoverflow.com/questions/65514350/close-position-binance-futures-with-ccxt
        https://ccxt.readthedocs.io/en/latest/manual.html
        """
        params = {'stopPrice': rate * 0.2, 'type': 'stopLimit'}
        result = self.binance.create_order(symbol=symbol,
                                           type='market', #market, limit
                                           side='buy',
                                           params=params,
                                           amount=amount)
        return result

I've tried also to change the type parameter (which should be limit/market) to STOP_LOSS_LIMIT but still doesn't not work binance {"code":-1106,"msg":"Parameter 'stopPrice' sent when not required."}

kroitor commented 3 years ago

@leonardoaraujosantos hi! Answered your question here: https://github.com/ccxt/ccxt/issues/9092#issuecomment-829113246