hyperliquid-dex / hyperliquid-python-sdk

SDK for Hyperliquid API trading with Python.
MIT License
238 stars 97 forks source link

How to place market order? #29

Closed kanekoshoyu closed 6 months ago

kanekoshoyu commented 6 months ago

I am trying to implement market order request, but then I have some problem understanding this. https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint

now I checked the code, but then I saw this.

# Get aggressive Market Price
px = self._slippage_price(coin, is_buy, slippage, px)
# Market Order is an aggressive Limit Order IoC
return self.order(coin, is_buy, sz, px, order_type={"limit": {"tif": "Ioc"}}, reduce_only=False, cloid=cloid)

should I be using the isMarket parameter or I should do IoC with aggressive price (e.g. best ask when buying)

traderben commented 6 months ago

The isMarket parameter is for trigger orders. There is no isMarket parameter for regular orders. The sdk's implementation is correct.

kanekoshoyu commented 6 months ago

thanks for the clarification @traderben