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

Method create_order

python/ccxt/ascendex.py:1697–1793  ·  view source on GitHub ↗

create a trade order on the exchange https://ascendex.github.io/ascendex-pro-api/#place-order https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order :param str symbol: unified CCXT market symbol :param str type: "limit" or "market" :param

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

Source from the content-addressed store, hash-verified

1695 return self.extend(request, params)
1696
1697 def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1698 """
1699 create a trade order on the exchange
1700
1701 https://ascendex.github.io/ascendex-pro-api/#place-order
1702 https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order
1703
1704 :param str symbol: unified CCXT market symbol
1705 :param str type: "limit" or "market"
1706 :param str side: "buy" or "sell"
1707 :param float amount: the amount of currency to trade
1708 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1709 :param dict [params]: extra parameters specific to the exchange API endpoint
1710 :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO"
1711 :param bool [params.postOnly]: True or False
1712 :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1713 :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered(perpetual swap markets only)
1714 :param float [params.takeProfit.triggerPrice]: *swap only* take profit trigger price
1715 :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered(perpetual swap markets only)
1716 :param float [params.stopLoss.triggerPrice]: *swap only* stop loss trigger price
1717 :returns: `An order structure <https://docs.ccxt.com/?id=order-structure>`
1718 """
1719 self.load_markets()
1720 self.load_accounts()
1721 market = self.market(symbol)
1722 request = self.create_order_request(symbol, type, side, amount, price, params)
1723 response = None
1724 if market['swap']:
1725 response = self.v2PrivateAccountGroupPostFuturesOrder(request)
1726 else:
1727 response = self.v1PrivateAccountCategoryPostOrder(request)
1728 #
1729 # spot
1730 #
1731 # {
1732 # "code":0,
1733 # "data": {
1734 # "accountId":"cshwT8RKojkT1HoaA5UdeimR2SrmHG2I",
1735 # "ac":"CASH",
1736 # "action":"place-order",
1737 # "status":"Ack",
1738 # "info": {
1739 # "symbol":"TRX/USDT",
1740 # "orderType":"StopLimit",
1741 # "timestamp":1654290662172,
1742 # "id":"",
1743 # "orderId":"a1812b6840ddU8191168955av0k6Eyhj"
1744 # }
1745 # }
1746 # }
1747 #
1748 # swap
1749 #
1750 # {
1751 # "code":0,
1752 # "data": {
1753 # "meta": {
1754 # "id":"",

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected