MCPcopy Create free account
hub / github.com/ccxt/ccxt / create_orders

Method create_orders

python/ccxt/async_support/pacifica.py:1439–1485  ·  view source on GitHub ↗

create a list of trade orders. It is supports only limit orders and have a random jitter ~100-300ms! https://docs.pacifica.fi/api-documentation/api/rest-api/orders/batch-order :param Array orders: list of orders to create, each object should contain the parameters required

(self, orders: List[OrderRequest], params={})

Source from the content-addressed store, hash-verified

1437 return self.batch_orders_request(actions)
1438
1439 async def create_orders(self, orders: List[OrderRequest], params={}):
1440 """
1441 create a list of trade orders. It is supports only limit orders and have a random jitter ~100-300ms!
1442
1443 https://docs.pacifica.fi/api-documentation/api/rest-api/orders/batch-order
1444
1445 :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type(optional or 'limit'), side, amount, price and params
1446 :param dict [params]: extra parameters specific to the exchange API endpoint
1447 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1448 """
1449 await self.load_markets()
1450 await self.initialize_client()
1451 request = self.create_orders_request(orders)
1452 response = await self.privatePostOrdersBatch(self.extend(request, params))
1453 # {
1454 # "success": True,
1455 # "data": {
1456 # "results": [
1457 # {
1458 # "success": True,
1459 # "order_id": 470506,
1460 # "error": null
1461 # },
1462 # {
1463 # "success": True,
1464 # }
1465 # ]
1466 # },
1467 # "error": null,
1468 # "code": null
1469 # }
1470 #
1471 data = self.safe_dict(response, 'data', {})
1472 results = self.safe_list(data, 'results', [])
1473 ordersToReturn = []
1474 for i in range(0, len(results)):
1475 order = results[i]
1476 error = self.safe_string(order, 'error', None)
1477 success = self.safe_bool(order, 'success', False)
1478 status = None
1479 if (error is not None) or (not success):
1480 status = 'rejected'
1481 else:
1482 status = 'open'
1483 orderId = self.safe_string(order, 'order_id')
1484 ordersToReturn.append(self.safe_order({'info': order, 'id': orderId, 'status': status}))
1485 return ordersToReturn
1486
1487 async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1488 """

Callers

nothing calls this directly

Calls 12

initialize_clientMethod · 0.95
create_orders_requestMethod · 0.95
safe_dictMethod · 0.80
safe_listMethod · 0.80
safe_stringMethod · 0.80
safe_boolMethod · 0.80
safe_orderMethod · 0.80
rangeFunction · 0.50
load_marketsMethod · 0.45
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected