FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

create order handle errors · ccxt/ccxt Wiki · GitHub

create order handle errors · ccxt/ccxt Wiki · GitHub
Skip to content

Navigation Menu

create order handle errors

github-actions[bot] edited this page Jun 24, 2026 · 4 revisions
// @NO_AUTO_TRANSPILE
// ----------------------------------------------------------------------------
import ccxt from '../../js/ccxt.js';
// ----------------------------------------------------------------------------
(async () => {
    const exchange = new ccxt.binance({
        'apiKey': 'YOUR_API_KEY',
        'secret': 'YOUR_SECRET_KEY',
        'verbose': false, // set to true to see more debugging output
        'timeout': 60000,
    });
    // try to load markets first, retry on request timeouts until it succeeds:
    while (true) {
        try {
            await exchange.loadMarkets();
            break;
        }
        catch (e) {
            if (e instanceof ccxt.RequestTimeout)
                console.log(exchange.iso8601(Date.now()), e.constructor.name, e.message);
        }
    }
    const symbol = 'ETH/BTC';
    const orderType = 'limit';
    const side = 'sell';
    const amount = 0.321;
    const price = 0.123;
    // try just one attempt to create an order
    try {
        const response = await exchange.createOrder(symbol, orderType, side, amount, price);
        console.log(response);
        console.log('Succeeded');
    }
    catch (e) {
        console.log(exchange.iso8601(Date.now()), e.constructor.name, e.message);
        console.log('Failed');
    }
})();

Wiki pages Pages 1,103

Clone this wiki locally

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL