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

Method createOrder

js/src/bit2c.js:527–547  ·  view source on GitHub ↗

* @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 = {})

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

parseOrderMethod · 0.95
loadMarketsMethod · 0.45
marketMethod · 0.45
capitalizeMethod · 0.45
numberToStringMethod · 0.45
parseToNumericMethod · 0.45
stringMulMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected