* @method * @name bit2c#createOrder * @description create a trade order * @see https://bit2c.co.il/home/api#addo * @param {string} symbol unified symbol of the market to create an order in * @param {string} type 'market' or 'limit' * @param {string} side 'buy' or 'sell'
(symbol, type, side, amount, price = undefined, params = {})
| 525 | * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure} |
| 526 | */ |
| 527 | async createOrder(symbol, type, side, amount, price = undefined, params = {}) { |
| 528 | await this.loadMarkets(); |
| 529 | let method = 'privatePostOrderAddOrder'; |
| 530 | const market = this.market(symbol); |
| 531 | const request = { |
| 532 | 'Amount': amount, |
| 533 | 'Pair': market['id'], |
| 534 | }; |
| 535 | if (type === 'market') { |
| 536 | method += 'MarketPrice' + this.capitalize(side); |
| 537 | } |
| 538 | else { |
| 539 | request['Price'] = price; |
| 540 | const amountString = this.numberToString(amount); |
| 541 | const priceString = this.numberToString(price); |
| 542 | request['Total'] = this.parseToNumeric(Precise.stringMul(amountString, priceString)); |
| 543 | request['IsBid'] = (side === 'buy'); |
| 544 | } |
| 545 | const response = await this[method](this.extend(request, params)); |
| 546 | return this.parseOrder(response, market); |
| 547 | } |
| 548 | /** |
| 549 | * @method |
| 550 | * @name bit2c#cancelOrder |
nothing calls this directly
no test coverage detected