Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleas-kal committed Sep 15, 2022
2 parents b0fd330 + ef2df04 commit 4782b29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyinjective/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ def derivative_margin_to_backend(price, quantity, leverage, denom) -> int:

def binary_options_buy_margin_to_backend(price, quantity, denom) -> int:
price_tick_size = Decimal(denom.min_price_tick_size) / pow(10, denom.quote)
margin = price * quantity
margin = Decimal(str(price)) * Decimal(str(quantity))
exchange_margin = floor_to(margin, float(price_tick_size)) * pow(10, 18 + denom.quote)
return int(exchange_margin)

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 - (price / pow (10, denom.quote))) * quantity
margin = (1 - (Decimal(str(price)) / pow (10, denom.quote))) * Decimal(str(quantity))
exchange_margin = floor_to(margin, float(price_tick_size)) * pow(10, 18 + denom.quote)
return int(exchange_margin)

Expand Down

0 comments on commit 4782b29

Please sign in to comment.