diff --git a/README.md b/README.md index a6e9bdee..3688f04d 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ Note that the [sync client](https://github.com/InjectiveLabs/sdk-python/blob/mas ### Changelogs +**0.5.9.2** +* Fix margin conversion for binary options + **0.5.9.1** * Add skip/limit to BinaryOptionsMarketsRequest diff --git a/pyinjective/utils.py b/pyinjective/utils.py index 33b7030b..142c5453 100644 --- a/pyinjective/utils.py +++ b/pyinjective/utils.py @@ -69,7 +69,7 @@ def binary_options_buy_margin_to_backend(price, quantity, denom) -> int: def binary_options_sell_margin_to_backend(price, quantity, denom) -> int: price_tick_size = Decimal(denom.min_price_tick_size) / pow(10, denom.quote) - margin = (1 - (Decimal(str(price)) / pow (10, denom.quote))) * Decimal(str(quantity)) + margin = (1 - (Decimal(str(price)) * (Decimal(str(quantity))))) exchange_margin = floor_to(margin, float(price_tick_size)) * pow(10, 18 + denom.quote) return int(exchange_margin) diff --git a/setup.py b/setup.py index d9de458d..8f57fd01 100755 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ EMAIL = "achilleas@injectivelabs.com" AUTHOR = "Injective Labs" REQUIRES_PYTHON = ">=3.7.0" -VERSION = "0.5.9.1" +VERSION = "0.5.9.2" REQUIRED = [ "protobuf==3.19.1",