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

Method create_order

python/ccxt/cryptocom.py:1391–1426  ·  view source on GitHub ↗

create a trade order https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order :param str symbol: unified symbol of the market to create an order in :param str type: 'market', 'limit', 'stop_loss', 'stop_limit', 'take_profit', 'take_profi

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

Source from the content-addressed store, hash-verified

1389 return self.extend(request, params)
1390
1391 def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1392 """
1393 create a trade order
1394
1395 https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order
1396
1397 :param str symbol: unified symbol of the market to create an order in
1398 :param str type: 'market', 'limit', 'stop_loss', 'stop_limit', 'take_profit', 'take_profit_limit'
1399 :param str side: 'buy' or 'sell'
1400 :param float amount: how much you want to trade in units of base currency
1401 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1402 :param dict [params]: extra parameters specific to the exchange API endpoint
1403 :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'PO'
1404 :param str [params.ref_price_type]: 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE
1405 :param float [params.triggerPrice]: price to trigger a trigger order
1406 :param float [params.stopLossPrice]: price to trigger a stop-loss trigger order
1407 :param float [params.takeProfitPrice]: price to trigger a take-profit trigger order
1408 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1409 """
1410 self.load_markets()
1411 market = self.market(symbol)
1412 request = self.create_order_request(symbol, type, side, amount, price, params)
1413 response = self.v1PrivatePostPrivateCreateOrder(request)
1414 #
1415 # {
1416 # "id": 1686804664362,
1417 # "method": "private/create-order",
1418 # "code" : 0,
1419 # "result": {
1420 # "order_id": "6540219377766741832",
1421 # "client_oid": "CCXT_d6ef7c3db6c1495aa8b757"
1422 # }
1423 # }
1424 #
1425 result = self.safe_dict(response, 'result', {})
1426 return self.parse_order(result, market)
1427
1428 def create_orders(self, orders: List[OrderRequest], params={}):
1429 """

Callers

nothing calls this directly

Calls 6

create_order_requestMethod · 0.95
parse_orderMethod · 0.95
safe_dictMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected