@pear-protocol/hyperliquid-sdk 0.1.3 → 0.1.4-pnl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/auth.d.ts +1 -1
- package/dist/clients/tradeHistory.d.ts +7 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useAllUserBalances.d.ts +2 -1
- package/dist/hooks/useAuth.d.ts +4 -1
- package/dist/hooks/useBasketCandles.d.ts +1 -0
- package/dist/hooks/useHistoricalPriceData.d.ts +1 -0
- package/dist/hooks/usePnlCalendar.d.ts +57 -0
- package/dist/hooks/usePnlHeatmap.d.ts +13 -0
- package/dist/hooks/usePosition.d.ts +21 -0
- package/dist/index.d.ts +108 -2
- package/dist/index.js +1137 -183
- package/dist/provider.d.ts +1 -1
- package/dist/store/historicalPriceDataStore.d.ts +3 -0
- package/dist/store/hyperliquidDataStore.d.ts +3 -2
- package/dist/store/userDataStore.d.ts +5 -1
- package/dist/types.d.ts +6 -0
- package/dist/utils/http.d.ts +2 -2
- package/package.json +1 -1
package/dist/clients/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResponse, GetEIP712MessageResponse, AuthenticateRequest, AuthenticateResponse, RefreshTokenResponse, LogoutResponse } from
|
|
1
|
+
import type { ApiResponse, GetEIP712MessageResponse, AuthenticateRequest, AuthenticateResponse, RefreshTokenResponse, LogoutResponse } from "../types";
|
|
2
2
|
export declare function getEIP712Message(baseUrl: string, address: string, clientId: string): Promise<ApiResponse<GetEIP712MessageResponse>>;
|
|
3
3
|
export declare function authenticate(baseUrl: string, body: AuthenticateRequest): Promise<ApiResponse<AuthenticateResponse>>;
|
|
4
4
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApiResponse, TradeHistoryDataDto } from '../types';
|
|
2
|
+
export interface GetTradeHistoryParams {
|
|
3
|
+
startDate?: string;
|
|
4
|
+
endDate?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function getTradeHistory(baseUrl: string, params?: GetTradeHistoryParams): Promise<ApiResponse<TradeHistoryDataDto[]>>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AvailableToTrades, SpotBalances, CollateralToken } from '../types';
|
|
1
|
+
import { AvailableToTrades, SpotBalances, CollateralToken, UserAbstraction } from '../types';
|
|
2
2
|
export interface MarginRequiredPerCollateral {
|
|
3
3
|
collateral: CollateralToken;
|
|
4
4
|
marginRequired: number;
|
|
@@ -16,6 +16,7 @@ interface AllUserBalancesResult {
|
|
|
16
16
|
spotBalances: SpotBalances;
|
|
17
17
|
availableToTrades: AvailableToTrades;
|
|
18
18
|
isLoading: boolean;
|
|
19
|
+
abstractionMode: UserAbstraction | null;
|
|
19
20
|
getMarginRequired: (assetsLeverage: Record<string, number>, size: number) => MarginRequiredResult;
|
|
20
21
|
getMaxSize: (assetsLeverage: Record<string, number>) => number;
|
|
21
22
|
}
|
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { GetEIP712MessageResponse } from
|
|
1
|
+
import type { GetEIP712MessageResponse } from '../types';
|
|
2
2
|
export declare function useAuth(): {
|
|
3
3
|
readonly isReady: boolean;
|
|
4
4
|
readonly isAuthenticated: boolean;
|
|
5
|
+
readonly address: string | null;
|
|
5
6
|
readonly accessToken: string | null;
|
|
6
7
|
readonly refreshToken: string | null;
|
|
7
8
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
@@ -9,4 +10,6 @@ export declare function useAuth(): {
|
|
|
9
10
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
10
11
|
readonly refreshTokens: () => Promise<import("../types").RefreshTokenResponse>;
|
|
11
12
|
readonly logout: () => Promise<void>;
|
|
13
|
+
readonly clearSession: () => void;
|
|
14
|
+
readonly setAddress: (address: string | null) => void;
|
|
12
15
|
};
|
|
@@ -3,6 +3,7 @@ export interface UseBasketCandlesReturn {
|
|
|
3
3
|
fetchBasketCandles: (startTime: number, endTime: number, interval: CandleInterval) => Promise<CandleData[]>;
|
|
4
4
|
fetchPerformanceCandles: (startTime: number, endTime: number, interval: CandleInterval, symbol: string) => Promise<CandleData[]>;
|
|
5
5
|
fetchOverallPerformanceCandles: (startTime: number, endTime: number, interval: CandleInterval) => Promise<CandleData[]>;
|
|
6
|
+
getEffectiveDataBoundary: (interval: CandleInterval) => number | null;
|
|
6
7
|
isLoading: boolean;
|
|
7
8
|
addRealtimeListener: (cb: RealtimeBarsCallback) => string;
|
|
8
9
|
removeRealtimeListener: (id: string) => void;
|
|
@@ -4,6 +4,7 @@ export interface UseHistoricalPriceDataReturn {
|
|
|
4
4
|
fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
|
|
5
5
|
hasHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval) => boolean;
|
|
6
6
|
getHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval) => Record<string, CandleData[]>;
|
|
7
|
+
getEffectiveDataBoundary: (interval: CandleInterval) => number | null;
|
|
7
8
|
getAllHistoricalPriceData(): Promise<Record<string, TokenHistoricalPriceData>>;
|
|
8
9
|
isLoading: (symbol?: string) => boolean;
|
|
9
10
|
clearCache: () => void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TokenMetadata } from '../types';
|
|
2
|
+
export type PnlCalendarTimeframe = '2W' | '3W' | '2M' | '3M';
|
|
3
|
+
export interface PnlCalendarOptions {
|
|
4
|
+
timeframe?: PnlCalendarTimeframe;
|
|
5
|
+
startDate?: Date | string;
|
|
6
|
+
endDate?: Date | string;
|
|
7
|
+
}
|
|
8
|
+
export interface PnlCalendarAsset {
|
|
9
|
+
coin: string;
|
|
10
|
+
metadata: TokenMetadata | null;
|
|
11
|
+
}
|
|
12
|
+
export interface PnlCalendarTrade {
|
|
13
|
+
tradeHistoryId: string;
|
|
14
|
+
realizedPnl: number;
|
|
15
|
+
result: 'profit' | 'loss' | 'breakeven';
|
|
16
|
+
closedLongAssets: PnlCalendarAsset[];
|
|
17
|
+
closedShortAssets: PnlCalendarAsset[];
|
|
18
|
+
}
|
|
19
|
+
export interface PnlCalendarDay {
|
|
20
|
+
date: string;
|
|
21
|
+
totalPnl: number;
|
|
22
|
+
volume: number;
|
|
23
|
+
positionsClosed: number;
|
|
24
|
+
result: 'profit' | 'loss' | 'breakeven';
|
|
25
|
+
trades: PnlCalendarTrade[];
|
|
26
|
+
}
|
|
27
|
+
export interface PeriodSummary {
|
|
28
|
+
pnl: number;
|
|
29
|
+
volume: number;
|
|
30
|
+
winRate: number;
|
|
31
|
+
wins: number;
|
|
32
|
+
losses: number;
|
|
33
|
+
totalProfit: number;
|
|
34
|
+
totalLoss: number;
|
|
35
|
+
}
|
|
36
|
+
export interface PnlCalendarWeek {
|
|
37
|
+
weekStart: string;
|
|
38
|
+
weekEnd: string;
|
|
39
|
+
days: PnlCalendarDay[];
|
|
40
|
+
summary: PeriodSummary;
|
|
41
|
+
}
|
|
42
|
+
export interface PnlCalendarMonth {
|
|
43
|
+
month: string;
|
|
44
|
+
label: string;
|
|
45
|
+
days: PnlCalendarDay[];
|
|
46
|
+
summary: PeriodSummary;
|
|
47
|
+
}
|
|
48
|
+
export interface UsePnlCalendarResult {
|
|
49
|
+
timeframe: PnlCalendarTimeframe;
|
|
50
|
+
weeks: PnlCalendarWeek[];
|
|
51
|
+
months: PnlCalendarMonth[];
|
|
52
|
+
overall: PeriodSummary;
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
error: string | null;
|
|
55
|
+
refetch: () => void;
|
|
56
|
+
}
|
|
57
|
+
export declare function usePnlCalendar(options?: PnlCalendarTimeframe | PnlCalendarOptions): UsePnlCalendarResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PnlCalendarTrade } from './usePnlCalendar';
|
|
2
|
+
export type PnlHeatmapTimeframe = 'allTime' | '100D' | '30D' | '7D';
|
|
3
|
+
export interface PnlHeatmapTrade extends PnlCalendarTrade {
|
|
4
|
+
percentage: number;
|
|
5
|
+
}
|
|
6
|
+
export interface UsePnlHeatmapResult {
|
|
7
|
+
timeframe: PnlHeatmapTimeframe;
|
|
8
|
+
trades: PnlHeatmapTrade[];
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
refetch: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function usePnlHeatmap(timeframe?: PnlHeatmapTimeframe): UsePnlHeatmapResult;
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { type UpdateRiskParametersRequestInput, type UpdateRiskParametersResponseDto, type ClosePositionRequestInput, type ClosePositionResponseDto, type CloseAllPositionsResponseDto, type AdjustPositionRequestInput, type AdjustPositionResponseDto, type AdjustAdvanceItemInput, type AdjustAdvanceResponseDto, type UpdateLeverageResponseDto } from '../clients/positions';
|
|
2
2
|
import type { ApiResponse, CreatePositionRequestInput, CreatePositionResponseDto, OpenPositionDto } from '../types';
|
|
3
|
+
export interface RebalanceAssetPlan {
|
|
4
|
+
coin: string;
|
|
5
|
+
side: 'long' | 'short';
|
|
6
|
+
currentWeight: number;
|
|
7
|
+
targetWeight: number;
|
|
8
|
+
currentValue: number;
|
|
9
|
+
targetValue: number;
|
|
10
|
+
deltaValue: number;
|
|
11
|
+
currentSize: number;
|
|
12
|
+
newSize: number;
|
|
13
|
+
deltaSize: number;
|
|
14
|
+
skipped: boolean;
|
|
15
|
+
skipReason?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RebalancePlan {
|
|
18
|
+
positionId: string;
|
|
19
|
+
assets: RebalanceAssetPlan[];
|
|
20
|
+
canExecute: boolean;
|
|
21
|
+
}
|
|
3
22
|
export declare function usePosition(): {
|
|
4
23
|
readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
5
24
|
readonly updateRiskParameters: (positionId: string, payload: UpdateRiskParametersRequestInput) => Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
|
|
@@ -10,4 +29,6 @@ export declare function usePosition(): {
|
|
|
10
29
|
readonly updateLeverage: (positionId: string, leverage: number) => Promise<ApiResponse<UpdateLeverageResponseDto | null>>;
|
|
11
30
|
readonly openPositions: OpenPositionDto[] | null;
|
|
12
31
|
readonly isLoading: boolean;
|
|
32
|
+
readonly planRebalance: (positionId: string, targetWeights?: Record<string, number>) => RebalancePlan;
|
|
33
|
+
readonly executeRebalance: (positionId: string, targetWeights?: Record<string, number>) => Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
13
34
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -228,6 +228,7 @@ interface TwapMonitoringDto {
|
|
|
228
228
|
interface TradeHistoryAssetDataDto {
|
|
229
229
|
coin: string;
|
|
230
230
|
entryWeight: number;
|
|
231
|
+
closeWeight: number;
|
|
231
232
|
entryPrice: number;
|
|
232
233
|
limitPrice: number;
|
|
233
234
|
leverage: number;
|
|
@@ -283,7 +284,9 @@ interface PositionAssetDetailDto {
|
|
|
283
284
|
unrealizedPnl: number;
|
|
284
285
|
liquidationPrice: number;
|
|
285
286
|
initialWeight: number;
|
|
287
|
+
currentWeight: number;
|
|
286
288
|
fundingPaid?: number;
|
|
289
|
+
targetWeight?: number;
|
|
287
290
|
metadata?: TokenMetadata | null;
|
|
288
291
|
}
|
|
289
292
|
interface TpSlThreshold {
|
|
@@ -591,6 +594,7 @@ interface HLChannelDataMap {
|
|
|
591
594
|
allDexsAssetCtxs: AllDexsAssetCtxsData;
|
|
592
595
|
userFills: any;
|
|
593
596
|
}
|
|
597
|
+
type UserAbstraction = 'dexAbstraction' | 'disabled' | 'unifiedAccount' | 'portfolioMargin';
|
|
594
598
|
interface WebData3UserState {
|
|
595
599
|
agentAddress?: string;
|
|
596
600
|
agentValidUntil?: number;
|
|
@@ -599,6 +603,7 @@ interface WebData3UserState {
|
|
|
599
603
|
isVault: boolean;
|
|
600
604
|
user: string;
|
|
601
605
|
dexAbstractionEnabled?: boolean;
|
|
606
|
+
abstraction: UserAbstraction;
|
|
602
607
|
}
|
|
603
608
|
interface WebData3AssetCtx {
|
|
604
609
|
funding: string;
|
|
@@ -759,6 +764,7 @@ interface RawAssetDto {
|
|
|
759
764
|
side: string;
|
|
760
765
|
fundingPaid?: number;
|
|
761
766
|
leverage: number;
|
|
767
|
+
targetWeight?: number;
|
|
762
768
|
}
|
|
763
769
|
/**
|
|
764
770
|
* Raw position data from open-positions channel
|
|
@@ -1068,6 +1074,8 @@ interface TokenHistoricalPriceData {
|
|
|
1068
1074
|
candles: CandleData[];
|
|
1069
1075
|
oldestTime: number | null;
|
|
1070
1076
|
latestTime: number | null;
|
|
1077
|
+
requestedRanges: HistoricalRange[];
|
|
1078
|
+
noDataBefore: number | null;
|
|
1071
1079
|
}
|
|
1072
1080
|
interface HistoricalPriceDataState {
|
|
1073
1081
|
historicalPriceData: Record<string, TokenHistoricalPriceData>;
|
|
@@ -1075,6 +1083,7 @@ interface HistoricalPriceDataState {
|
|
|
1075
1083
|
addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
|
|
1076
1084
|
hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
|
|
1077
1085
|
getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
|
|
1086
|
+
getEffectiveDataBoundary: (symbols: string[], interval: CandleInterval) => number | null;
|
|
1078
1087
|
setTokenLoading: (symbol: string, loading: boolean) => void;
|
|
1079
1088
|
isTokenLoading: (symbol: string) => boolean;
|
|
1080
1089
|
removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
|
|
@@ -1086,6 +1095,7 @@ interface UseHistoricalPriceDataReturn {
|
|
|
1086
1095
|
fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
|
|
1087
1096
|
hasHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval) => boolean;
|
|
1088
1097
|
getHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval) => Record<string, CandleData[]>;
|
|
1098
|
+
getEffectiveDataBoundary: (interval: CandleInterval) => number | null;
|
|
1089
1099
|
getAllHistoricalPriceData(): Promise<Record<string, TokenHistoricalPriceData>>;
|
|
1090
1100
|
isLoading: (symbol?: string) => boolean;
|
|
1091
1101
|
clearCache: () => void;
|
|
@@ -1096,6 +1106,7 @@ interface UseBasketCandlesReturn {
|
|
|
1096
1106
|
fetchBasketCandles: (startTime: number, endTime: number, interval: CandleInterval) => Promise<CandleData[]>;
|
|
1097
1107
|
fetchPerformanceCandles: (startTime: number, endTime: number, interval: CandleInterval, symbol: string) => Promise<CandleData[]>;
|
|
1098
1108
|
fetchOverallPerformanceCandles: (startTime: number, endTime: number, interval: CandleInterval) => Promise<CandleData[]>;
|
|
1109
|
+
getEffectiveDataBoundary: (interval: CandleInterval) => number | null;
|
|
1099
1110
|
isLoading: boolean;
|
|
1100
1111
|
addRealtimeListener: (cb: RealtimeBarsCallback) => string;
|
|
1101
1112
|
removeRealtimeListener: (id: string) => void;
|
|
@@ -1286,6 +1297,25 @@ interface UpdateLeverageResponseDto {
|
|
|
1286
1297
|
}
|
|
1287
1298
|
declare function updateLeverage(baseUrl: string, positionId: string, payload: UpdateLeverageRequestInput): Promise<ApiResponse<UpdateLeverageResponseDto | null>>;
|
|
1288
1299
|
|
|
1300
|
+
interface RebalanceAssetPlan {
|
|
1301
|
+
coin: string;
|
|
1302
|
+
side: 'long' | 'short';
|
|
1303
|
+
currentWeight: number;
|
|
1304
|
+
targetWeight: number;
|
|
1305
|
+
currentValue: number;
|
|
1306
|
+
targetValue: number;
|
|
1307
|
+
deltaValue: number;
|
|
1308
|
+
currentSize: number;
|
|
1309
|
+
newSize: number;
|
|
1310
|
+
deltaSize: number;
|
|
1311
|
+
skipped: boolean;
|
|
1312
|
+
skipReason?: string;
|
|
1313
|
+
}
|
|
1314
|
+
interface RebalancePlan {
|
|
1315
|
+
positionId: string;
|
|
1316
|
+
assets: RebalanceAssetPlan[];
|
|
1317
|
+
canExecute: boolean;
|
|
1318
|
+
}
|
|
1289
1319
|
declare function usePosition(): {
|
|
1290
1320
|
readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
1291
1321
|
readonly updateRiskParameters: (positionId: string, payload: UpdateRiskParametersRequestInput) => Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
|
|
@@ -1296,6 +1326,8 @@ declare function usePosition(): {
|
|
|
1296
1326
|
readonly updateLeverage: (positionId: string, leverage: number) => Promise<ApiResponse<UpdateLeverageResponseDto | null>>;
|
|
1297
1327
|
readonly openPositions: OpenPositionDto[] | null;
|
|
1298
1328
|
readonly isLoading: boolean;
|
|
1329
|
+
readonly planRebalance: (positionId: string, targetWeights?: Record<string, number>) => RebalancePlan;
|
|
1330
|
+
readonly executeRebalance: (positionId: string, targetWeights?: Record<string, number>) => Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
1299
1331
|
};
|
|
1300
1332
|
|
|
1301
1333
|
declare function useOrders(): {
|
|
@@ -1414,6 +1446,7 @@ declare function usePortfolio(): UsePortfolioResult;
|
|
|
1414
1446
|
declare function useAuth(): {
|
|
1415
1447
|
readonly isReady: boolean;
|
|
1416
1448
|
readonly isAuthenticated: boolean;
|
|
1449
|
+
readonly address: string | null;
|
|
1417
1450
|
readonly accessToken: string | null;
|
|
1418
1451
|
readonly refreshToken: string | null;
|
|
1419
1452
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
@@ -1421,6 +1454,8 @@ declare function useAuth(): {
|
|
|
1421
1454
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
1422
1455
|
readonly refreshTokens: () => Promise<RefreshTokenResponse>;
|
|
1423
1456
|
readonly logout: () => Promise<void>;
|
|
1457
|
+
readonly clearSession: () => void;
|
|
1458
|
+
readonly setAddress: (address: string | null) => void;
|
|
1424
1459
|
};
|
|
1425
1460
|
|
|
1426
1461
|
interface MarginRequiredPerCollateral {
|
|
@@ -1440,6 +1475,7 @@ interface AllUserBalancesResult {
|
|
|
1440
1475
|
spotBalances: SpotBalances;
|
|
1441
1476
|
availableToTrades: AvailableToTrades;
|
|
1442
1477
|
isLoading: boolean;
|
|
1478
|
+
abstractionMode: UserAbstraction | null;
|
|
1443
1479
|
getMarginRequired: (assetsLeverage: Record<string, number>, size: number) => MarginRequiredResult;
|
|
1444
1480
|
getMaxSize: (assetsLeverage: Record<string, number>) => number;
|
|
1445
1481
|
}
|
|
@@ -1462,6 +1498,76 @@ interface UseHyperliquidUserFillsState {
|
|
|
1462
1498
|
*/
|
|
1463
1499
|
declare function useHyperliquidUserFills(options: UseHyperliquidUserFillsOptions): UseHyperliquidUserFillsState;
|
|
1464
1500
|
|
|
1501
|
+
type PnlCalendarTimeframe = '2W' | '3W' | '2M' | '3M';
|
|
1502
|
+
interface PnlCalendarOptions {
|
|
1503
|
+
timeframe?: PnlCalendarTimeframe;
|
|
1504
|
+
startDate?: Date | string;
|
|
1505
|
+
endDate?: Date | string;
|
|
1506
|
+
}
|
|
1507
|
+
interface PnlCalendarAsset {
|
|
1508
|
+
coin: string;
|
|
1509
|
+
metadata: TokenMetadata | null;
|
|
1510
|
+
}
|
|
1511
|
+
interface PnlCalendarTrade {
|
|
1512
|
+
tradeHistoryId: string;
|
|
1513
|
+
realizedPnl: number;
|
|
1514
|
+
result: 'profit' | 'loss' | 'breakeven';
|
|
1515
|
+
closedLongAssets: PnlCalendarAsset[];
|
|
1516
|
+
closedShortAssets: PnlCalendarAsset[];
|
|
1517
|
+
}
|
|
1518
|
+
interface PnlCalendarDay {
|
|
1519
|
+
date: string;
|
|
1520
|
+
totalPnl: number;
|
|
1521
|
+
volume: number;
|
|
1522
|
+
positionsClosed: number;
|
|
1523
|
+
result: 'profit' | 'loss' | 'breakeven';
|
|
1524
|
+
trades: PnlCalendarTrade[];
|
|
1525
|
+
}
|
|
1526
|
+
interface PeriodSummary {
|
|
1527
|
+
pnl: number;
|
|
1528
|
+
volume: number;
|
|
1529
|
+
winRate: number;
|
|
1530
|
+
wins: number;
|
|
1531
|
+
losses: number;
|
|
1532
|
+
totalProfit: number;
|
|
1533
|
+
totalLoss: number;
|
|
1534
|
+
}
|
|
1535
|
+
interface PnlCalendarWeek {
|
|
1536
|
+
weekStart: string;
|
|
1537
|
+
weekEnd: string;
|
|
1538
|
+
days: PnlCalendarDay[];
|
|
1539
|
+
summary: PeriodSummary;
|
|
1540
|
+
}
|
|
1541
|
+
interface PnlCalendarMonth {
|
|
1542
|
+
month: string;
|
|
1543
|
+
label: string;
|
|
1544
|
+
days: PnlCalendarDay[];
|
|
1545
|
+
summary: PeriodSummary;
|
|
1546
|
+
}
|
|
1547
|
+
interface UsePnlCalendarResult {
|
|
1548
|
+
timeframe: PnlCalendarTimeframe;
|
|
1549
|
+
weeks: PnlCalendarWeek[];
|
|
1550
|
+
months: PnlCalendarMonth[];
|
|
1551
|
+
overall: PeriodSummary;
|
|
1552
|
+
isLoading: boolean;
|
|
1553
|
+
error: string | null;
|
|
1554
|
+
refetch: () => void;
|
|
1555
|
+
}
|
|
1556
|
+
declare function usePnlCalendar(options?: PnlCalendarTimeframe | PnlCalendarOptions): UsePnlCalendarResult;
|
|
1557
|
+
|
|
1558
|
+
type PnlHeatmapTimeframe = 'allTime' | '100D' | '30D' | '7D';
|
|
1559
|
+
interface PnlHeatmapTrade extends PnlCalendarTrade {
|
|
1560
|
+
percentage: number;
|
|
1561
|
+
}
|
|
1562
|
+
interface UsePnlHeatmapResult {
|
|
1563
|
+
timeframe: PnlHeatmapTimeframe;
|
|
1564
|
+
trades: PnlHeatmapTrade[];
|
|
1565
|
+
isLoading: boolean;
|
|
1566
|
+
error: string | null;
|
|
1567
|
+
refetch: () => void;
|
|
1568
|
+
}
|
|
1569
|
+
declare function usePnlHeatmap(timeframe?: PnlHeatmapTimeframe): UsePnlHeatmapResult;
|
|
1570
|
+
|
|
1465
1571
|
/**
|
|
1466
1572
|
* Mark notifications as read up to a given timestamp (ms)
|
|
1467
1573
|
*/
|
|
@@ -1736,5 +1842,5 @@ interface MarketDataState {
|
|
|
1736
1842
|
}
|
|
1737
1843
|
declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
|
|
1738
1844
|
|
|
1739
|
-
export { ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, ReadyState, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, executeSpotOrder, getCompleteTimestamps, getKalshiMarkets, getOrderDirection, getOrderLadderConfig, getOrderLeverage, getOrderReduceOnly, getOrderTpSlTriggerType, getOrderTrailingInfo, getOrderTriggerType, getOrderTriggerValue, getOrderTwapDuration, getOrderUsdValue, getPortfolio, isBtcDomOrder, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useAgentWallet, useAllUserBalances, useAuth, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidUserFills, useMarket, useMarketData, useMarketDataHook, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWatchlist, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1740
|
-
export type { AccountSummaryResponseDto, ActiveAssetData, ActiveAssetGroupItem, ActiveAssetsAllResponse, ActiveAssetsResponse, AddressState, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, AgentWalletStatus, AllDexsAssetCtxsData, AllDexsClearinghouseStateData, AllPerpMetasItem, AllPerpMetasResponse, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AuthenticateRequest, AuthenticateResponse, AvailableToTrades, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ChunkFillDto, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CollateralToken, CreateAgentWalletResponseDto, CreatePositionRequestInput, CreatePositionResponseDto, CrossAssetPriceTriggerParams, CrossMarginSummaryDto, CumFundingDto, EIP712AuthDetails, ExecutionType, ExternalFillDto, ExternalLiquidationDto, ExtraAgent, GetAgentWalletResponseDto, GetEIP712MessageResponse, GetKalshiMarketsParams, HLChannel, HLChannelDataMap, HLWebSocketResponse, HistoricalRange, KalshiMarket, KalshiMarketsResponse, KalshiMveLeg, KalshiPriceRange, LadderConfigInput, LadderOrderParameters, LeverageInfo, LogoutRequest, LogoutResponse, MarginRequiredPerCollateral, MarginRequiredResult, MarginSummaryDto, MarginTableDef, MarginTablesEntry, MarginTier, MarketOrderParameters, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderDirection, OrderParameters, OrderStatus, OrderType, PairAssetDto, PairAssetInput, PerformanceOverlay, PerpDex, PerpDexsResponse, PerpMetaAsset, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PredictionMarketOutcomeTriggerParams, PriceRatioTriggerParams, PriceTriggerParams, PrivyAuthDetails, RawAssetDto, RawPositionDto, RealtimeBar, RealtimeBarsCallback, RefreshTokenRequest, RefreshTokenResponse, SpotBalance, SpotBalances, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, SyncFillsRequestDto, SyncFillsResponseDto, ToggleWatchlistResponseDto, TokenConflict, TokenEntry, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TokenSelectorConfig, TpSlOrderParameters, TpSlThreshold, TpSlThresholdInput, TpSlThresholdType, TpSlTriggerType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TriggerOrderNotificationAsset, TriggerOrderNotificationParams, TriggerOrderNotificationType, TriggerOrderParameters, TriggerType, TwapChunkStatus, TwapChunkStatusDto, TwapMonitoringDto, TwapOrderOverallStatus, TwapOrderParameters, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseHyperliquidUserFillsOptions, UseHyperliquidUserFillsState, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistAssetDto, WatchlistItemDto, WebData3AssetCtx, WebData3PerpDexState, WebData3Response, WebData3UserState, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|
|
1845
|
+
export { ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, ReadyState, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, executeSpotOrder, getCompleteTimestamps, getKalshiMarkets, getOrderDirection, getOrderLadderConfig, getOrderLeverage, getOrderReduceOnly, getOrderTpSlTriggerType, getOrderTrailingInfo, getOrderTriggerType, getOrderTriggerValue, getOrderTwapDuration, getOrderUsdValue, getPortfolio, isBtcDomOrder, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useAgentWallet, useAllUserBalances, useAuth, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidUserFills, useMarket, useMarketData, useMarketDataHook, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePnlCalendar, usePnlHeatmap, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWatchlist, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1846
|
+
export type { AccountSummaryResponseDto, ActiveAssetData, ActiveAssetGroupItem, ActiveAssetsAllResponse, ActiveAssetsResponse, AddressState, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, AgentWalletStatus, AllDexsAssetCtxsData, AllDexsClearinghouseStateData, AllPerpMetasItem, AllPerpMetasResponse, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AuthenticateRequest, AuthenticateResponse, AvailableToTrades, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ChunkFillDto, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CollateralToken, CreateAgentWalletResponseDto, CreatePositionRequestInput, CreatePositionResponseDto, CrossAssetPriceTriggerParams, CrossMarginSummaryDto, CumFundingDto, EIP712AuthDetails, ExecutionType, ExternalFillDto, ExternalLiquidationDto, ExtraAgent, GetAgentWalletResponseDto, GetEIP712MessageResponse, GetKalshiMarketsParams, HLChannel, HLChannelDataMap, HLWebSocketResponse, HistoricalRange, KalshiMarket, KalshiMarketsResponse, KalshiMveLeg, KalshiPriceRange, LadderConfigInput, LadderOrderParameters, LeverageInfo, LogoutRequest, LogoutResponse, MarginRequiredPerCollateral, MarginRequiredResult, MarginSummaryDto, MarginTableDef, MarginTablesEntry, MarginTier, MarketOrderParameters, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderDirection, OrderParameters, OrderStatus, OrderType, PairAssetDto, PairAssetInput, PerformanceOverlay, PeriodSummary, PerpDex, PerpDexsResponse, PerpMetaAsset, PlatformAccountSummaryResponseDto, PnlCalendarAsset, PnlCalendarDay, PnlCalendarMonth, PnlCalendarOptions, PnlCalendarTimeframe, PnlCalendarTrade, PnlCalendarWeek, PnlHeatmapTimeframe, PnlHeatmapTrade, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PredictionMarketOutcomeTriggerParams, PriceRatioTriggerParams, PriceTriggerParams, PrivyAuthDetails, RawAssetDto, RawPositionDto, RealtimeBar, RealtimeBarsCallback, RebalanceAssetPlan, RebalancePlan, RefreshTokenRequest, RefreshTokenResponse, SpotBalance, SpotBalances, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, SyncFillsRequestDto, SyncFillsResponseDto, ToggleWatchlistResponseDto, TokenConflict, TokenEntry, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TokenSelectorConfig, TpSlOrderParameters, TpSlThreshold, TpSlThresholdInput, TpSlThresholdType, TpSlTriggerType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TriggerOrderNotificationAsset, TriggerOrderNotificationParams, TriggerOrderNotificationType, TriggerOrderParameters, TriggerType, TwapChunkStatus, TwapChunkStatusDto, TwapMonitoringDto, TwapOrderOverallStatus, TwapOrderParameters, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseHyperliquidUserFillsOptions, UseHyperliquidUserFillsState, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePnlCalendarResult, UsePnlHeatmapResult, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserAbstraction, UserProfile, UserSelectionState, WatchlistAssetDto, WatchlistItemDto, WebData3AssetCtx, WebData3PerpDexState, WebData3Response, WebData3UserState, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|