Skip to content

Commit

Permalink
update thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
onemicky committed Oct 2, 2024
1 parent 6dcf928 commit e9001b4
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/domain/synthetics/accountStats/useIsLargeAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import { expandDecimals } from "lib/numbers";
import { useAccountVolumeStats } from "./useAccountVolumeStats";

// Thresholds to recognise large accounts
const X1_MAX_DAILY_VOLUME = expandDecimals(220_000n, USD_DECIMALS);
const X2_AGG_7_DAYS_VOLUME = expandDecimals(500_000n, USD_DECIMALS);
const X3_AGG_14_DAYS_VOLUME = expandDecimals(1_200_000n, USD_DECIMALS);
const X4_AGG_30_DAYS_VOLUME = expandDecimals(3_000_000n, USD_DECIMALS);
const X5_AGG_ALL_TIME_VOLUME = expandDecimals(5_000_000n, USD_DECIMALS);
const MAX_DAILY_VOLUME = expandDecimals(220_000n, USD_DECIMALS);
const AGG_14_DAYS_VOLUME = expandDecimals(1_200_000n, USD_DECIMALS);
const AGG_ALL_TIME_VOLUME = expandDecimals(3_500_000n, USD_DECIMALS);

export function useIsLargeAccount(account?: string) {
const { data, error, isLoading } = useAccountVolumeStats({ account });
Expand All @@ -21,18 +19,10 @@ export function useIsLargeAccount(account?: string) {

const maxDailyVolume = dailyVolume.reduce((max, day) => (day.volume > max ? day.volume : max), 0n);

const last7DaysVolume = dailyVolume.slice(-7).reduce((acc, day) => acc + day.volume, 0n);

const last14DaysVolume = dailyVolume.slice(-14).reduce((acc, day) => acc + day.volume, 0n);

const last30DaysVolume = dailyVolume.slice(-30).reduce((acc, day) => acc + day.volume, 0n);

return (
maxDailyVolume >= X1_MAX_DAILY_VOLUME ||
last7DaysVolume >= X2_AGG_7_DAYS_VOLUME ||
last14DaysVolume >= X3_AGG_14_DAYS_VOLUME ||
last30DaysVolume >= X4_AGG_30_DAYS_VOLUME ||
totalVolume >= X5_AGG_ALL_TIME_VOLUME
maxDailyVolume >= MAX_DAILY_VOLUME || last14DaysVolume >= AGG_14_DAYS_VOLUME || totalVolume >= AGG_ALL_TIME_VOLUME
);
}, [data, isLoading, error]);

Expand Down

0 comments on commit e9001b4

Please sign in to comment.