create a trade order https://docs.delta.exchange/#place-order :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 w
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 1936 | }, market) |
| 1937 | |
| 1938 | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 1939 | """ |
| 1940 | create a trade order |
| 1941 | |
| 1942 | https://docs.delta.exchange/#place-order |
| 1943 | |
| 1944 | :param str symbol: unified symbol of the market to create an order in |
| 1945 | :param str type: 'market' or 'limit' |
| 1946 | :param str side: 'buy' or 'sell' |
| 1947 | :param float amount: how much of currency you want to trade in units of base currency |
| 1948 | :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| 1949 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1950 | :param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position |
| 1951 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 1952 | """ |
| 1953 | self.load_markets() |
| 1954 | orderType = type + '_order' |
| 1955 | market = self.market(symbol) |
| 1956 | request = { |
| 1957 | 'product_id': market['numericId'], |
| 1958 | # 'limit_price': self.price_to_precision(market['symbol'], price), |
| 1959 | 'size': self.amount_to_precision(market['symbol'], amount), |
| 1960 | 'side': side, |
| 1961 | 'order_type': orderType, |
| 1962 | # 'client_order_id': 'string', |
| 1963 | # 'time_in_force': 'gtc', # gtc, ioc, fok |
| 1964 | # 'post_only': 'false', # 'true', |
| 1965 | # 'reduce_only': 'false', # 'true', |
| 1966 | } |
| 1967 | if type == 'limit': |
| 1968 | request['limit_price'] = self.price_to_precision(market['symbol'], price) |
| 1969 | clientOrderId = self.safe_string_2(params, 'clientOrderId', 'client_order_id') |
| 1970 | params = self.omit(params, ['clientOrderId', 'client_order_id']) |
| 1971 | if clientOrderId is not None: |
| 1972 | request['client_order_id'] = clientOrderId |
| 1973 | reduceOnly = self.safe_bool(params, 'reduceOnly') |
| 1974 | if reduceOnly: |
| 1975 | request['reduce_only'] = reduceOnly |
| 1976 | params = self.omit(params, 'reduceOnly') |
| 1977 | response = self.privatePostOrders(self.extend(request, params)) |
| 1978 | # |
| 1979 | # { |
| 1980 | # "result":{ |
| 1981 | # "average_fill_price":null, |
| 1982 | # "bracket_order":null, |
| 1983 | # "bracket_stop_loss_limit_price":null, |
| 1984 | # "bracket_stop_loss_price":null, |
| 1985 | # "bracket_take_profit_limit_price":null, |
| 1986 | # "bracket_take_profit_price":null, |
| 1987 | # "bracket_trail_amount":null, |
| 1988 | # "cancellation_reason":null, |
| 1989 | # "client_order_id":null, |
| 1990 | # "close_on_trigger":"false", |
| 1991 | # "commission":"0", |
| 1992 | # "created_at":"2020-11-16T02:38:26Z", |
| 1993 | # "id":152870626, |
| 1994 | # "limit_price":"10000", |
| 1995 | # "meta_data":{"source":"api"}, |
nothing calls this directly
no test coverage detected