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

Method create_order_ws

python/ccxt/pro/hyperliquid.py:94–123  ·  view source on GitHub ↗

create a trade order using WebSocket post request https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order :param str symbol: unified symbol of the market to create an order in :param str type: 'market' or 'limit'

(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})

Source from the content-addressed store, hash-verified

92 return self.parse_orders(statuses, None)
93
94 async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
95 """
96 create a trade order using WebSocket post request
97
98 https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
99
100 :param str symbol: unified symbol of the market to create an order in
101 :param str type: 'market' or 'limit'
102 :param str side: 'buy' or 'sell'
103 :param float amount: how much of currency you want to trade in units of base currency
104 :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
105 :param dict [params]: extra parameters specific to the exchange API endpoint
106 :param str [params.timeInForce]: 'Gtc', 'Ioc', 'Alo'
107 :param bool [params.postOnly]: True or False whether the order is post-only
108 :param bool [params.reduceOnly]: True or False whether the order is reduce-only
109 :param float [params.triggerPrice]: The price at which a trigger order is triggered at
110 :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
111 :param str [params.slippage]: the slippage for market order
112 :param str [params.vaultAddress]: the vault address for order
113 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
114 """
115 await self.load_markets()
116 order, globalParams = self.parseCreateEditOrderArgs(None, symbol, type, side, amount, price, params)
117 orders = await self.create_orders_ws([order], globalParams)
118 ordersLength = len(orders)
119 if ordersLength == 0:
120 # not sure why but it is happening sometimes
121 return self.safe_order({})
122 parsedOrder = orders[0]
123 return parsedOrder
124
125 async def edit_order_ws(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
126 """

Callers

nothing calls this directly

Calls 4

create_orders_wsMethod · 0.95
safe_orderMethod · 0.80
load_marketsMethod · 0.45

Tested by

no test coverage detected