https://www.gate.io/docs/developers/apiv4/ws/en/#order-place https://www.gate.io/docs/developers/futures/ws/en/#order-place Create an order on the exchange :param str symbol: Unified CCXT market symbol :param str type: 'limit' or 'market' *"market" is contr
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 148 | } |
| 149 | |
| 150 | async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 151 | """ |
| 152 | |
| 153 | https://www.gate.io/docs/developers/apiv4/ws/en/#order-place |
| 154 | https://www.gate.io/docs/developers/futures/ws/en/#order-place |
| 155 | |
| 156 | Create an order on the exchange |
| 157 | :param str symbol: Unified CCXT market symbol |
| 158 | :param str type: 'limit' or 'market' *"market" is contract only* |
| 159 | :param str side: 'buy' or 'sell' |
| 160 | :param float amount: the amount of currency to trade |
| 161 | :param float [price]: *ignored in "market" orders* the price at which the order is to be fulfilled at in units of the quote currency |
| 162 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 163 | :param float [params.stopPrice]: The price at which a trigger order is triggered at |
| 164 | :param str [params.timeInForce]: "GTC", "IOC", or "PO" |
| 165 | :param float [params.stopLossPrice]: The price at which a stop loss order is triggered at |
| 166 | :param float [params.takeProfitPrice]: The price at which a take profit order is triggered at |
| 167 | :param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used |
| 168 | :param int [params.iceberg]: Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely |
| 169 | :param str [params.text]: User defined information |
| 170 | :param str [params.account]: *spot and margin only* "spot", "margin" or "cross_margin" |
| 171 | :param bool [params.auto_borrow]: *margin only* Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough |
| 172 | :param str [params.settle]: *contract only* Unified Currency Code for settle currency |
| 173 | :param bool [params.reduceOnly]: *contract only* Indicates if self order is to reduce the size of a position |
| 174 | :param bool [params.close]: *contract only* Set to close the position, with size set to 0 |
| 175 | :param bool [params.auto_size]: *contract only* Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0 |
| 176 | :param int [params.price_type]: *contract only* 0 latest deal price, 1 mark price, 2 index price |
| 177 | :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount |
| 178 | :returns dict|None: `An order structure <https://docs.ccxt.com/?id=order-structure>` |
| 179 | """ |
| 180 | await self.load_markets() |
| 181 | market = self.market(symbol) |
| 182 | symbol = market['symbol'] |
| 183 | messageType = self.get_type_by_market(market) |
| 184 | channel = messageType + '.order_place' |
| 185 | url = self.get_url_by_market(market) |
| 186 | params['textIsRequired'] = True |
| 187 | request = self.create_order_request(symbol, type, side, amount, price, params) |
| 188 | await self.authenticate(url, messageType) |
| 189 | rawOrder = await self.request_private(url, request, channel) |
| 190 | order = self.parse_order(rawOrder, market) |
| 191 | return order |
| 192 | |
| 193 | async def create_orders_ws(self, orders: List[OrderRequest], params={}): |
| 194 | """ |
nothing calls this directly
no test coverage detected