Skip to content

Commit

Permalink
Merge pull request #170 from InjectiveLabs/f/fix_margin_conv_bo
Browse files Browse the repository at this point in the history
F/fix margin conv bo
  • Loading branch information
achilleas-kal authored Dec 13, 2022
2 parents c19eba4 + e32ee5f commit 0641bdf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyinjective/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
EMAIL = "[email protected]"
AUTHOR = "Injective Labs"
REQUIRES_PYTHON = ">=3.7.0"
VERSION = "0.5.9.1"
VERSION = "0.5.9.2"

REQUIRED = [
"protobuf==3.19.1",
Expand Down

0 comments on commit 0641bdf

Please sign in to comment.