create a trade order https://www.bitget.com/api-doc/spot/trade/Place-Order https://www.bitget.com/api-doc/spot/plan/Place-Plan-Order https://www.bitget.com/api-doc/contract/trade/Place-Order https://www.bitget.com/api-doc/contract/plan/Place-Tpsl-Order
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 4927 | return self.create_order(symbol, 'market', 'buy', cost, None, self.extend(req, params)) |
| 4928 | |
| 4929 | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 4930 | """ |
| 4931 | create a trade order |
| 4932 | |
| 4933 | https://www.bitget.com/api-doc/spot/trade/Place-Order |
| 4934 | https://www.bitget.com/api-doc/spot/plan/Place-Plan-Order |
| 4935 | https://www.bitget.com/api-doc/contract/trade/Place-Order |
| 4936 | https://www.bitget.com/api-doc/contract/plan/Place-Tpsl-Order |
| 4937 | https://www.bitget.com/api-doc/contract/plan/Place-Plan-Order |
| 4938 | https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order |
| 4939 | https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order |
| 4940 | https://www.bitget.com/api-doc/uta/trade/Place-Order |
| 4941 | https://www.bitget.com/api-doc/uta/strategy/Place-Strategy-Order |
| 4942 | |
| 4943 | :param str symbol: unified symbol of the market to create an order in |
| 4944 | :param str type: 'market' or 'limit' |
| 4945 | :param str side: 'buy' or 'sell' |
| 4946 | :param float amount: how much you want to trade in units of the base currency |
| 4947 | :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders, and used execution price for contract stop-loss / take-profit orders |
| 4948 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 4949 | :param float [params.cost]: *spot only* how much you want to trade in units of the quote currency, for market buy orders only |
| 4950 | :param float [params.triggerPrice]: *swap only* The price at which a trigger order is triggered at |
| 4951 | :param float [params.stopLossPrice]: *swap only* The price at which a stop loss order is triggered at |
| 4952 | :param float [params.takeProfitPrice]: *swap only* The price at which a take profit order is triggered at |
| 4953 | :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) |
| 4954 | :param float [params.takeProfit.triggerPrice]: *swap only* take profit trigger price |
| 4955 | :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) |
| 4956 | :param float [params.stopLoss.triggerPrice]: *swap only* stop loss trigger price |
| 4957 | :param str [params.timeInForce]: "GTC", "IOC", "FOK", or "PO" |
| 4958 | :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading |
| 4959 | :param str [params.loanType]: *spot margin only* 'normal', 'autoLoan', 'autoRepay', or 'autoLoanAndRepay' default is 'normal' |
| 4960 | :param str [params.holdSide]: *contract stopLossPrice, takeProfitPrice only* Two-way position: ('long' or 'short'), one-way position: ('buy' or 'sell') |
| 4961 | :param float [params.stopLoss.price]: *swap only* the execution price for a stop loss attached to a trigger order |
| 4962 | :param float [params.takeProfit.price]: *swap only* the execution price for a take profit attached to a trigger order |
| 4963 | :param str [params.stopLoss.type]: *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' |
| 4964 | :param str [params.takeProfit.type]: *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' |
| 4965 | :param str [params.trailingPercent]: *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10 |
| 4966 | :param str [params.trailingTriggerPrice]: *swap and future only* the price to trigger a trailing stop order, default uses the price argument |
| 4967 | :param str [params.triggerType]: *swap and future only* 'fill_price', 'mark_price' or 'index_price' |
| 4968 | :param boolean [params.oneWayMode]: *swap and future only* required to set self to True in one_way_mode and you can leave self in hedge_mode, can adjust the mode using the setPositionMode() method |
| 4969 | :param bool [params.hedged]: *swap and future only* True for hedged mode, False for one way mode, default is False |
| 4970 | :param bool [params.reduceOnly]: True or False whether the order is reduce-only |
| 4971 | :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False |
| 4972 | :param str [params.posSide]: *uta only* hedged two-way position side, long or short |
| 4973 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 4974 | """ |
| 4975 | self.load_markets() |
| 4976 | market = self.market(symbol) |
| 4977 | marginParams = self.handle_margin_mode_and_params('createOrder', params) |
| 4978 | marginMode = marginParams[0] |
| 4979 | triggerPrice = self.safe_value_2(params, 'stopPrice', 'triggerPrice') |
| 4980 | stopLossTriggerPrice = self.safe_value(params, 'stopLossPrice') |
| 4981 | takeProfitTriggerPrice = self.safe_value(params, 'takeProfitPrice') |
| 4982 | trailingPercent = self.safe_string_2(params, 'trailingPercent', 'callbackRatio') |
| 4983 | isTrailingPercentOrder = trailingPercent is not None |
| 4984 | isTriggerOrder = triggerPrice is not None |
| 4985 | isStopLossTriggerOrder = stopLossTriggerPrice is not None |
| 4986 | isTakeProfitTriggerOrder = takeProfitTriggerPrice is not None |
no test coverage detected