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

Method create_order

python/ccxt/async_support/ascendex.py:1698–1794  ·  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

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