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

Method create_order

python/ccxt/bit2c.py:517–547  ·  view source on GitHub ↗

create a trade order https://bit2c.co.il/home/api#addo :param str symbol: unified symbol of the market to create an order in :param str type: 'market' or 'limit' :param str side: 'buy' or 'sell' :param float amount: how much of currency you want to

(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})

Source from the content-addressed store, hash-verified

515 return result
516
517 def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
518 """
519 create a trade order
520
521 https://bit2c.co.il/home/api#addo
522
523 :param str symbol: unified symbol of the market to create an order in
524 :param str type: 'market' or 'limit'
525 :param str side: 'buy' or 'sell'
526 :param float amount: how much of currency you want to trade in units of base currency
527 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
528 :param dict [params]: extra parameters specific to the exchange API endpoint
529 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
530 """
531 self.load_markets()
532 method = 'privatePostOrderAddOrder'
533 market = self.market(symbol)
534 request = {
535 'Amount': amount,
536 'Pair': market['id'],
537 }
538 if type == 'market':
539 method += 'MarketPrice' + self.capitalize(side)
540 else:
541 request['Price'] = price
542 amountString = self.number_to_string(amount)
543 priceString = self.number_to_string(price)
544 request['Total'] = self.parse_to_numeric(Precise.string_mul(amountString, priceString))
545 request['IsBid'] = (side == 'buy')
546 response = getattr(self, method)(self.extend(request, params))
547 return self.parse_order(response, market)
548
549 def cancel_order(self, id: str, symbol: Str = None, params={}):
550 """

Callers

nothing calls this directly

Calls 7

parse_orderMethod · 0.95
parse_to_numericMethod · 0.80
string_mulMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
capitalizeMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected