(orders, params = {})
| 4391 | return this.parseOrder(response, market); |
| 4392 | } |
| 4393 | createOrdersRequest(orders, params = {}) { |
| 4394 | const ordersRequests = []; |
| 4395 | const orderSymbols = []; |
| 4396 | const ordersLength = orders.length; |
| 4397 | if (ordersLength === 0) { |
| 4398 | throw new BadRequest(this.id + ' createOrders() requires at least one order'); |
| 4399 | } |
| 4400 | if (ordersLength > 10) { |
| 4401 | throw new BadRequest(this.id + ' createOrders() accepts a maximum of 10 orders at a time'); |
| 4402 | } |
| 4403 | for (let i = 0; i < orders.length; i++) { |
| 4404 | const rawOrder = orders[i]; |
| 4405 | const marketId = this.safeString(rawOrder, 'symbol'); |
| 4406 | orderSymbols.push(marketId); |
| 4407 | const type = this.safeString(rawOrder, 'type'); |
| 4408 | const side = this.safeString(rawOrder, 'side'); |
| 4409 | const amount = this.safeValue(rawOrder, 'amount'); |
| 4410 | const price = this.safeValue(rawOrder, 'price'); |
| 4411 | const orderParams = this.safeValue(rawOrder, 'params', {}); |
| 4412 | const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params |
| 4413 | const triggerValue = this.safeValueN(orderParams, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice']); |
| 4414 | if (triggerValue !== undefined) { |
| 4415 | throw new NotSupported(this.id + ' createOrders() does not support advanced order properties (stopPrice, takeProfitPrice, stopLossPrice)'); |
| 4416 | } |
| 4417 | extendedParams['textIsRequired'] = true; // the exchange requires a text parameter for each order here |
| 4418 | const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams); |
| 4419 | ordersRequests.push(orderRequest); |
| 4420 | } |
| 4421 | const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true); |
| 4422 | const market = this.market(symbols[0]); |
| 4423 | if (market['future'] || market['option']) { |
| 4424 | throw new NotSupported(this.id + ' createOrders() does not support futures or options markets'); |
| 4425 | } |
| 4426 | return ordersRequests; |
| 4427 | } |
| 4428 | /** |
| 4429 | * @method |
| 4430 | * @name gate#createOrders |
no test coverage detected