hyperliquid-dex / hyperliquid-rust-sdk

MIT License
57 stars 47 forks source link

When placing orders, format order sizes and prices based on the asset's tick and lot size #33

Closed Frixoe closed 3 months ago

Frixoe commented 3 months ago

https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/tick-and-lot-size

Add this to the ordering to make ordering much easier without the user having to think about these things.

traderben commented 3 months ago

I don't think the sdk should change the values sent by the user. We could add a rounding example similar to the python sdk: https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/master/examples/rounding.py

Frixoe commented 3 months ago

I don't think the sdk should change the values sent by the user. We could add a rounding example similar to the python sdk: https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/master/examples/rounding.py

Any particular reason why we shouldn't? I just thought it would be a good addition because in my personal project I had to write a function to format the perp and the spot price before I placed the order because of the calculations I was doing on the prices

traderben commented 3 months ago

I think the end user should be aware of any rounding as it could make a meaningful difference to them. This also matches the behavior of the python sdk