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

Method createOrder

ts/src/bingx.ts:3268–3371  ·  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: string, type: OrderType, side: OrderSide, amount: number, price: Num = 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: string, type: OrderType, side: OrderSide, amount: number, price: Num = 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 } else if (market['inverse']) {
3279 response = await this.cswapV1PrivatePostTradeOrder (request);
3280 } else if (type === 'twap') {
3281 response = await this.swapV1PrivatePostTwapOrder (request);
3282 } else {
3283 response = await this.swapV2PrivatePostTradeOrder (request);
3284 }
3285 } else {
3286 response = await this.spotV1PrivatePostTradeOrder (request);
3287 }
3288 //
3289 // spot
3290 //
3291 // {
3292 // "code": 0,
3293 // "msg": "",
3294 // "data": {
3295 // "symbol": "XRP-USDT",
3296 // "orderId": 1514090846268424192,
3297 // "transactTime": 1649822362855,
3298 // "price": "0.5",
3299 // "origQty": "10",
3300 // "executedQty": "0",
3301 // "cummulativeQuoteQty": "0",
3302 // "status": "PENDING",
3303 // "type": "LIMIT",
3304 // "side": "BUY"
3305 // }
3306 // }
3307 //
3308 // linear swap
3309 //
3310 // {
3311 // "code": 0,
3312 // "msg": "",
3313 // "data": {
3314 // "order": {
3315 // "symbol": "BTC-USDT",
3316 // "orderId": 1709036527545438208,
3317 // "side": "BUY",
3318 // "positionSide": "LONG",
3319 // "type": "TRIGGER_LIMIT",
3320 // "clientOrderID": "",
3321 // "workingType": ""
3322 // }
3323 // }
3324 // }
3325 //

Callers 7

exampleFunction · 0.95
exampleFunction · 0.95
exampleFunction · 0.95
exampleFunction · 0.95

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