create a trade order https://api.docs.extended.exchange/#create-or-edit-order :param str symbol: unified symbol of the market to create an order in :param str type: 'limit' or 'market' :param str side: 'buy' or 'sell' :param float amount: how much o
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 2641 | } |
| 2642 | |
| 2643 | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order: |
| 2644 | """ |
| 2645 | create a trade order |
| 2646 | |
| 2647 | https://api.docs.extended.exchange/#create-or-edit-order |
| 2648 | |
| 2649 | :param str symbol: unified symbol of the market to create an order in |
| 2650 | :param str type: 'limit' or 'market' |
| 2651 | :param str side: 'buy' or 'sell' |
| 2652 | :param float amount: how much of currency you want to trade in units of base currency |
| 2653 | :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, required for all order types |
| 2654 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2655 | :param str [params.clientOrderId]: client order id, sent exchange order id |
| 2656 | :param str [params.cancelId]: previous external order id to replace |
| 2657 | :param str [params.timeInForce]: 'GTT' or 'IOC' |
| 2658 | :param boolean [params.postOnly]: True if the order should only make liquidity |
| 2659 | :param boolean [params.reduceOnly]: True if the order should only reduce a position |
| 2660 | :param str [params.fee]: max fee rate for the order, default is 0.0005 |
| 2661 | :param int [params.expiryEpochMillis]: order expiration timestamp in milliseconds, default is now + 1 hour |
| 2662 | :param float [params.triggerPrice]: *swap only* The price at which a trigger order is triggered at |
| 2663 | :param float [params.stopLossPrice]: *swap only* The price at which a stop loss order is triggered at |
| 2664 | :param float [params.takeProfitPrice]: *swap only* The price at which a take profit order is triggered at |
| 2665 | :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered(perpetual swap markets only) |
| 2666 | :param float [params.takeProfit.triggerPrice]: *swap only* take profit trigger price |
| 2667 | :param float [params.takeProfit.price]: *swap only* the execution price for a take profit attached to a trigger order |
| 2668 | :param str [params.takeProfit.type]: *swap only* the type for a take profit attached to a trigger order, 'LAST', 'MARK' or 'INDEX', default is '' |
| 2669 | :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered(perpetual swap markets only) |
| 2670 | :param float [params.stopLoss.triggerPrice]: *swap only* stop loss trigger price |
| 2671 | :param float [params.stopLoss.price]: *swap only* the execution price for a stop loss attached to a trigger order |
| 2672 | :param str [params.stopLoss.type]: *swap only* the type for a stop loss attached to a trigger order, 'LAST', 'MARK' or 'INDEX', default is '' |
| 2673 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 2674 | """ |
| 2675 | self.check_required_credentials() |
| 2676 | extendedOrderRequest = self.create_extended_order_request(symbol, type, side, amount, price, params) |
| 2677 | request = self.safe_dict(extendedOrderRequest, 'request', {}) |
| 2678 | response = self.v1PrivatePostUserOrder(request) |
| 2679 | # |
| 2680 | # { |
| 2681 | # "status": "OK", |
| 2682 | # "data": { |
| 2683 | # "id": "2051479786538188800", |
| 2684 | # "externalId": "3480985089570526249141260266819446928410958787024864860785196119336740291620" |
| 2685 | # } |
| 2686 | # } |
| 2687 | # |
| 2688 | data = self.safe_dict(response, 'data', {}) |
| 2689 | market = extendedOrderRequest['market'] |
| 2690 | now = self.safe_integer(extendedOrderRequest, 'timestamp') |
| 2691 | data['timestamp'] = now |
| 2692 | data['status'] = 'NEW' |
| 2693 | return self.parse_order(self.extend(request, data), market) |
| 2694 | |
| 2695 | def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order: |
| 2696 | """ |
nothing calls this directly
no test coverage detected