MCPcopy Create free account
hub / github.com/ccxt/ccxt / createOrder

Method createOrder

js/src/bingx.js:3268–3377  ·  view source on GitHub ↗

* @method * @name bingx#createOrder * @description create a trade order * @see https://bingx-api.github.io/docs-v3/#/en/Spot/Trades%20Endpoints/Place%20order * @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Place%20order * @see https://bingx-api.github

(symbol, type, side, amount, price = undefined, params = {})

Source from the content-addressed store, hash-verified

3266 * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
3267 */
3268 async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3269 await this.loadMarkets();
3270 const market = this.market(symbol);
3271 const test = this.safeBool(params, 'test', false);
3272 params = this.omit(params, 'test');
3273 const request = this.createOrderRequest(symbol, type, side, amount, price, params);
3274 let response = undefined;
3275 if (market['swap']) {
3276 if (test) {
3277 response = await this.swapV2PrivatePostTradeOrderTest(request);
3278 }
3279 else if (market['inverse']) {
3280 response = await this.cswapV1PrivatePostTradeOrder(request);
3281 }
3282 else if (type === 'twap') {
3283 response = await this.swapV1PrivatePostTwapOrder(request);
3284 }
3285 else {
3286 response = await this.swapV2PrivatePostTradeOrder(request);
3287 }
3288 }
3289 else {
3290 response = await this.spotV1PrivatePostTradeOrder(request);
3291 }
3292 //
3293 // spot
3294 //
3295 // {
3296 // "code": 0,
3297 // "msg": "",
3298 // "data": {
3299 // "symbol": "XRP-USDT",
3300 // "orderId": 1514090846268424192,
3301 // "transactTime": 1649822362855,
3302 // "price": "0.5",
3303 // "origQty": "10",
3304 // "executedQty": "0",
3305 // "cummulativeQuoteQty": "0",
3306 // "status": "PENDING",
3307 // "type": "LIMIT",
3308 // "side": "BUY"
3309 // }
3310 // }
3311 //
3312 // linear swap
3313 //
3314 // {
3315 // "code": 0,
3316 // "msg": "",
3317 // "data": {
3318 // "order": {
3319 // "symbol": "BTC-USDT",
3320 // "orderId": 1709036527545438208,
3321 // "side": "BUY",
3322 // "positionSide": "LONG",
3323 // "type": "TRIGGER_LIMIT",
3324 // "clientOrderID": "",
3325 // "workingType": ""

Calls 14

createOrderRequestMethod · 0.95
parseOrderMethod · 0.95
loadMarketsMethod · 0.45
marketMethod · 0.45
safeBoolMethod · 0.45
omitMethod · 0.45

Tested by

no test coverage detected