Skip to content

Commit 0641bdf

Browse files
Merge pull request #170 from InjectiveLabs/f/fix_margin_conv_bo
F/fix margin conv bo
2 parents c19eba4 + e32ee5f commit 0641bdf

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ Note that the [sync client](https://github.com/InjectiveLabs/sdk-python/blob/mas
7878

7979

8080
### Changelogs
81+
**0.5.9.2**
82+
* Fix margin conversion for binary options
83+
8184
**0.5.9.1**
8285
* Add skip/limit to BinaryOptionsMarketsRequest
8386

pyinjective/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def binary_options_buy_margin_to_backend(price, quantity, denom) -> int:
6969

7070
def binary_options_sell_margin_to_backend(price, quantity, denom) -> int:
7171
price_tick_size = Decimal(denom.min_price_tick_size) / pow(10, denom.quote)
72-
margin = (1 - (Decimal(str(price)) / pow (10, denom.quote))) * Decimal(str(quantity))
72+
margin = (1 - (Decimal(str(price)) * (Decimal(str(quantity)))))
7373
exchange_margin = floor_to(margin, float(price_tick_size)) * pow(10, 18 + denom.quote)
7474
return int(exchange_margin)
7575

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
AUTHOR = "Injective Labs"
1919
REQUIRES_PYTHON = ">=3.7.0"
20-
VERSION = "0.5.9.1"
20+
VERSION = "0.5.9.2"
2121

2222
REQUIRED = [
2323
"protobuf==3.19.1",

0 commit comments

Comments
 (0)