hyperliquid-dex / hyperliquid-python-sdk

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

Adding Market Orders #10

Closed lh14576 closed 10 months ago

lh14576 commented 11 months ago

Created a derived class "ExchangePlus" that has market_open and market_close functionality. Also added a simple example of how to create market orders using that class. If you prefer a different implementation I am open to suggestions.

lh14576 commented 11 months ago

You are right, I was actually using that extended class myself and just cleaned it up a little for this pr. I was working with a different price feed and wanted to have recent hplx prices before sending the market order. I guess we could make passing a mid_price optional? So it only fetches mid_price if not already submitted by the user? I could also ditch it completely whatever you prefer :)