Skip to content

Commit

Permalink
fix: handle negative free collateral on overview page (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Nov 7, 2024
1 parent ef07bf6 commit 372ab05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/portfolio/AccountOverviewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ export const AccountOverviewSection = () => {
{
id: 'free-collateral',
label: stringGetter({ key: STRING_KEYS.FREE_COLLATERAL }),
amount: freeCollateral?.current,
amount: mapIfPresent(freeCollateral?.current, (fc) => Math.max(fc, 0.0)),
color: ColorToken.GrayPurple2,
},
{
id: 'open-positions',
label: stringGetter({ key: STRING_KEYS.POSITION_MARGIN }),
amount: mapIfPresent(equity?.current, freeCollateral?.current, (e, f) => e - f),
amount: mapIfPresent(equity?.current, freeCollateral?.current, (e, f) =>
Math.max(e - Math.max(f, 0), 0)
),
color: ColorToken.Yellow1,
},
(showVaults || (vaultBalance ?? 0) > 0.01) && {
Expand Down

0 comments on commit 372ab05

Please sign in to comment.