create a trade order https://hashkeyglobal-apidoc.readme.io/reference/test-new-order https://hashkeyglobal-apidoc.readme.io/reference/create-order https://hashkeyglobal-apidoc.readme.io/reference/create-new-futures-order :param str symbol: unified symbol of
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 2382 | }, currency) |
| 2383 | |
| 2384 | def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order: |
| 2385 | """ |
| 2386 | create a trade order |
| 2387 | |
| 2388 | https://hashkeyglobal-apidoc.readme.io/reference/test-new-order |
| 2389 | https://hashkeyglobal-apidoc.readme.io/reference/create-order |
| 2390 | https://hashkeyglobal-apidoc.readme.io/reference/create-new-futures-order |
| 2391 | |
| 2392 | :param str symbol: unified symbol of the market to create an order in |
| 2393 | :param str type: 'market' or 'limit' or 'LIMIT_MAKER' for spot, 'market' or 'limit' or 'STOP' for swap |
| 2394 | :param str side: 'buy' or 'sell' |
| 2395 | :param float amount: how much of you want to trade in units of the base currency |
| 2396 | :param float [price]: the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| 2397 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2398 | :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount |
| 2399 | :param boolean [params.test]: *spot markets only* whether to use the test endpoint or not, default is False |
| 2400 | :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately |
| 2401 | :param str [params.timeInForce]: "GTC" or "IOC" or "PO" for spot, 'GTC' or 'FOK' or 'IOC' or 'LIMIT_MAKER' or 'PO' for swap |
| 2402 | :param str [params.clientOrderId]: a unique id for the order - is mandatory for swap |
| 2403 | :param float [params.triggerPrice]: *swap markets only* The price at which a trigger order is triggered at |
| 2404 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 2405 | """ |
| 2406 | self.load_markets() |
| 2407 | market = self.market(symbol) |
| 2408 | if market['spot']: |
| 2409 | return self.create_spot_order(symbol, type, side, amount, price, params) |
| 2410 | elif market['swap']: |
| 2411 | return self.create_swap_order(symbol, type, side, amount, price, params) |
| 2412 | else: |
| 2413 | raise NotSupported(self.id + ' createOrder() is not supported for ' + market['type'] + ' type of markets') |
| 2414 | |
| 2415 | def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}) -> Order: |
| 2416 | """ |
no test coverage detected