BadSymbol: binance does not have market symbol

I tried all possible codes but still error. I tried with symbol in method createOrder(): BTCUSDT, BTC/USDT, BTC, BTCUSD. All give error. I installed newest ccxt version 2.5.7 Code push order here!

    const api_key = '...';
    const secret_key = '...';
    async function createStopMarketOrder(symbol, amount, stopPrice) {
        let binance = new ccxt.binance({
            'apiKey': api_key,
            'secret': secret_key,
            'enableRateLimit': true,
            'options': {
                'defaultType': 'future'
            },
        });
        // set up the order
        let order = {
            'symbol': symbol,
            'type': 'STOP_MARKET',
            'side': 'SELL',
            'amount': amount,
            'stopPrice': stopPrice
        };
        try {
            let response = await binance.createOrder(order);
            console.log(response);
        } catch (error) {
            console.log(error);
        }
    }
    createStopMarketOrder('**BTCUSDT**', 0.001, 21000);

Console error

BadSymbol: binance does not have market symbol [object Object]
at binance.market (C:\Users\pc\Desktop\homes\node_modules\ccxt\js\binance.js:1456:15)
at binance.createOrder (C:\Users\pc\Desktop\homes\node_modules\ccxt\js\binance.js:3380:29)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async createStopMarketOrder (C:\Users\pc\Desktop\homes\start.js:329:32) {
constructor: [class BadSymbol extends BadRequest] }

please open issue for ccxt, it’s the issue from the library.

2 Likes

If you’re using node.js, I recommend the “binance” package on npm (its on github too). I’ve had a lot of problems like this with ccxt.

1 Like