create a trade order https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-limit-order https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-market-order https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-stop-order
(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})
| 1218 | }, market) |
| 1219 | |
| 1220 | async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}): |
| 1221 | """ |
| 1222 | create a trade order |
| 1223 | |
| 1224 | https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-limit-order |
| 1225 | https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-market-order |
| 1226 | https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-stop-order |
| 1227 | https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-position-tp-sl |
| 1228 | |
| 1229 | :param str symbol: unified symbol of the market to create an order in |
| 1230 | :param str type: 'market' or 'limit' |
| 1231 | :param str side: 'buy' or 'sell' |
| 1232 | :param float amount: how much of currency you want to trade in units of base currency. Not used for set tpsl order! |
| 1233 | :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders |
| 1234 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1235 | :param float [params.triggerPrice]: The price a trigger order is triggered at |
| 1236 | :param float [params.stopLossPrice]: the price that a stop loss order is triggered at(optional provide stopLossCloid) |
| 1237 | :param float [params.takeProfitPrice]: the price that a take profit order is triggered at(optional provide takeProfitCloid) |
| 1238 | :param str [params.timeInForce]: "GTC", "IOC", or "PO" or "ALO" or "PO_TOB"(or "TOB" - PO by top of book) |
| 1239 | :param boolean [params.reduceOnly]: Ensures that the executed order does not flip the opened position. |
| 1240 | :param str [params.clientOrderId]: client order id,(optional uuid v4 e.g.: f47ac10b-58cc-4372-a567-0e02b2c3d479) |
| 1241 | :param int [params.expiryWindow]: time to live in milliseconds |
| 1242 | :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>` |
| 1243 | """ |
| 1244 | await self.load_markets() |
| 1245 | await self.initialize_client() |
| 1246 | request, operationType = self.create_order_request(symbol, type, side, amount, price, params) |
| 1247 | params = self.omit(params, [ |
| 1248 | 'reduceOnly', 'clientOrderId', 'stopLimitPrice', 'timeInForce', 'triggerPrice', 'stopLossCloid', |
| 1249 | 'stopLossPrice', 'stopLossLimitPrice', 'takeProfitCloid', 'takeProfitPrice', 'takeProfitLimitPrice', 'expiryWindow', |
| 1250 | ]) |
| 1251 | response = None |
| 1252 | if operationType == 'create_market_order': |
| 1253 | response = await self.privatePostOrdersCreateMarket(self.extend(request, params)) |
| 1254 | elif operationType == 'create_stop_order': |
| 1255 | response = await self.privatePostOrdersStopCreate(self.extend(request, params)) |
| 1256 | elif operationType == 'set_position_tpsl': |
| 1257 | response = await self.privatePostPositionsTpsl(self.extend(request, params)) |
| 1258 | else: # create_order |
| 1259 | response = await self.privatePostOrdersCreate(self.extend(request, params)) |
| 1260 | # |
| 1261 | # { |
| 1262 | # 'success': True, |
| 1263 | # 'data': { |
| 1264 | # "order_id": 12345 |
| 1265 | # }, |
| 1266 | # } |
| 1267 | # |
| 1268 | success = self.safe_bool(response, 'success', False) |
| 1269 | status = None |
| 1270 | if not success: |
| 1271 | status = 'rejected' |
| 1272 | else: |
| 1273 | status = 'open' |
| 1274 | order = self.safe_dict(response, 'data', {}) |
| 1275 | orderId = self.safe_string(order, 'order_id') |
| 1276 | return self.safe_order({'id': orderId, 'status': status, 'info': response, 'symbol': symbol}) |
| 1277 |
nothing calls this directly
no test coverage detected