@pear-protocol/hyperliquid-sdk 0.0.7 → 0.0.8
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/index.d.ts +17 -12
- package/dist/index.esm.js +148 -131
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +148 -131
- package/dist/index.js.map +1 -1
- package/dist/utils/{position-calculator.d.ts → aggregate-position-calculator.d.ts} +16 -11
- package/package.json +1 -1
|
@@ -7,9 +7,9 @@ export declare enum PositionSide {
|
|
|
7
7
|
SHORT = "SHORT"
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Aggregate position calculation utility class that handles cross-position asset syncing
|
|
11
11
|
*/
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class AggregatePositionCalculator {
|
|
13
13
|
private webData2;
|
|
14
14
|
private allMids;
|
|
15
15
|
constructor(webData2: WebData2Response | null, allMids: WsAllMidsData | null);
|
|
@@ -23,22 +23,27 @@ export declare class PositionCalculator {
|
|
|
23
23
|
getUserPositions(): AssetPosition[];
|
|
24
24
|
/**
|
|
25
25
|
* Calculate updated open positions by syncing platform positions with HyperLiquid data
|
|
26
|
+
* Uses aggregate totals across all positions for accurate cross-position sync
|
|
26
27
|
*/
|
|
27
28
|
calculateOpenPositions(platformPositions: OpenPositionDto[]): OpenPositionDto[];
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
+
* Calculate total platform sizes per asset across all positions
|
|
30
31
|
*/
|
|
31
|
-
private
|
|
32
|
+
private calculatePlatformTotalsByAsset;
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
+
* Extract base currency from asset name (handles "LINK/USD" -> "LINK")
|
|
34
35
|
*/
|
|
35
|
-
private
|
|
36
|
+
private extractBaseCurrency;
|
|
36
37
|
/**
|
|
37
|
-
* Sync a
|
|
38
|
+
* Sync a single position with HyperLiquid data using aggregate totals
|
|
38
39
|
*/
|
|
39
|
-
private
|
|
40
|
+
private syncPositionWithAggregateData;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* Sync individual asset with aggregate data awareness
|
|
43
|
+
*/
|
|
44
|
+
private syncAssetWithAggregateData;
|
|
45
|
+
/**
|
|
46
|
+
* Determine sync status with sophisticated side-aware logic
|
|
42
47
|
*/
|
|
43
48
|
private determineSyncStatus;
|
|
44
49
|
/**
|
|
@@ -50,11 +55,11 @@ export declare class PositionCalculator {
|
|
|
50
55
|
*/
|
|
51
56
|
private mapSyncResultToAssetDto;
|
|
52
57
|
/**
|
|
53
|
-
* Calculate entry ratio
|
|
58
|
+
* Calculate entry ratio using actual sizes from sync results
|
|
54
59
|
*/
|
|
55
60
|
private calculateEntryRatio;
|
|
56
61
|
/**
|
|
57
|
-
* Calculate mark ratio
|
|
62
|
+
* Calculate mark ratio using actual sizes and current prices
|
|
58
63
|
*/
|
|
59
64
|
private calculateMarkRatio;
|
|
60
65
|
/**
|