Skip to content

Commit

Permalink
fix spot liab bug
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNineteen committed Nov 15, 2022
1 parent b9b52c0 commit 68e21cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/driftpy/clearing_house_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async def get_spot_market_liability(

if worst_case_token_amount < 0:
baa_value = get_spot_liability_value(
worst_case_token_amount,
abs(worst_case_token_amount),
oracle_data,
spot_market,
margin_category,
Expand All @@ -226,12 +226,12 @@ async def get_spot_market_liability(
)
total_liability += baa_value

if worst_case_quote_amount > 0:
if worst_case_quote_amount < 0:
weight = SPOT_WEIGHT_PRECISION
if margin_category == MarginCategory.INITIAL:
weight = max(weight, user.max_margin_ratio)
weighted_value = (
worst_case_quote_amount * weight / SPOT_WEIGHT_PRECISION
abs(worst_case_quote_amount) * weight / SPOT_WEIGHT_PRECISION
)
total_liability += weighted_value

Expand Down

0 comments on commit 68e21cf

Please sign in to comment.