Skip to content

Commit

Permalink
Update perp position to return zero on nonexistent position
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKhalili committed Oct 1, 2024
1 parent 82277e8 commit e652b08
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/driftpy/drift_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ def get_perp_market_liability(
signed: bool = False,
):
perp_position = self.get_perp_position(market_index)
if perp_position is None:
return 0

return self.calculate_weighted_perp_position_liability(
perp_position,
margin_category,
Expand Down

0 comments on commit e652b08

Please sign in to comment.