@pear-protocol/utils 0.0.23 → 0.2.0

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.
Files changed (44) hide show
  1. package/dist/asset/asset.types.d.ts +1 -0
  2. package/dist/asset/compute.d.ts +9 -1
  3. package/dist/asset/compute.test.d.ts +1 -0
  4. package/dist/fills/compute.test.d.ts +1 -0
  5. package/dist/fills/fill.types.d.ts +1 -0
  6. package/dist/fills/index.d.ts +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1437 -300
  9. package/dist/math/decimal.d.ts +57 -0
  10. package/dist/math/decimal.test.d.ts +1 -0
  11. package/dist/math/index.d.ts +1 -0
  12. package/dist/position/compute.d.ts +16 -0
  13. package/dist/position/compute.test.d.ts +1 -0
  14. package/dist/position/index.d.ts +1 -0
  15. package/dist/position/key.d.ts +15 -0
  16. package/dist/precise-price.d.ts +5 -0
  17. package/dist/precise-quantity.d.ts +4 -0
  18. package/dist/proxy.d.ts +34 -0
  19. package/dist/proxy.test.d.ts +1 -0
  20. package/dist/sync/applicables/basket.d.ts +42 -0
  21. package/dist/sync/applicables/basket.test.d.ts +1 -0
  22. package/dist/sync/applicables/constants.d.ts +19 -0
  23. package/dist/sync/applicables/exposure.d.ts +47 -0
  24. package/dist/sync/applicables/exposure.test.d.ts +1 -0
  25. package/dist/sync/applicables/fills.d.ts +16 -0
  26. package/dist/sync/applicables/fills.test.d.ts +1 -0
  27. package/dist/sync/applicables/index.d.ts +34 -0
  28. package/dist/sync/applicables/index.test.d.ts +1 -0
  29. package/dist/sync/applicables/matching.d.ts +17 -0
  30. package/dist/sync/applicables/matching.test.d.ts +1 -0
  31. package/dist/sync/applicables/position.d.ts +17 -0
  32. package/dist/sync/applicables/position.test.d.ts +1 -0
  33. package/dist/sync/applicables/snapshot.d.ts +41 -0
  34. package/dist/sync/applicables/synthetics.d.ts +52 -0
  35. package/dist/sync/applicables/synthetics.test.d.ts +1 -0
  36. package/dist/sync/applicables/types.d.ts +77 -0
  37. package/dist/sync/compute.d.ts +23 -9
  38. package/dist/sync/cutoff.d.ts +35 -0
  39. package/dist/sync/cutoff.test.d.ts +1 -0
  40. package/dist/sync/index.d.ts +1 -1
  41. package/dist/sync/types.d.ts +12 -13
  42. package/dist/validate-leverage.d.ts +3 -0
  43. package/dist/validate-quantity.d.ts +4 -0
  44. package/package.json +3 -2
@@ -11,6 +11,7 @@ export type AssetRealizedPnL = {
11
11
  id: InstrumentId;
12
12
  grossPnl: BigNumber;
13
13
  netPnl: BigNumber;
14
+ undeterminedSize: BigNumber;
14
15
  totalFees: BigNumber;
15
16
  tradeFees: BigNumber;
16
17
  pearFees: BigNumber;
@@ -20,9 +20,17 @@ export declare function computeAssetUnrealizedPnL(signedQuantity: BigNumber, cur
20
20
  * Compute realized gross PnL for a SINGLE asset.
21
21
  *
22
22
  * Realized trading PnL is accumulated when a fill reduces an existing
23
- * position (using FIFO-style average entry), excluding fees.
23
+ * position (using FIFO-style average entry), excluding fees. Quantity with an
24
+ * unpriced (0-price synthetic) entry or exit contributes 0 — its size is
25
+ * surfaced via computeAssetUndeterminedSizes.
24
26
  */
25
27
  export declare function computeAssetGrossRealizedPnL(fills: Fill[]): BigNumber;
28
+ /**
29
+ * Per-asset quantity whose realized PnL is unpriceable — closed by a 0-price
30
+ * gone-close synthetic, or closed against a 0-price synthetic entry. For UI
31
+ * display alongside realized PnL. Symbols with no such quantity are omitted.
32
+ */
33
+ export declare function computeAssetUndeterminedSizes(fills: Fill[]): Record<InstrumentId, BigNumber>;
26
34
  /**
27
35
  * Compute unrealized PnL for an entire position.
28
36
  *
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,7 @@ export type Fill = {
7
7
  quantity: string;
8
8
  side: Side;
9
9
  reduceOnly: boolean;
10
+ synthetic?: boolean;
10
11
  tradeFee?: string | null;
11
12
  pearFee?: string | null;
12
13
  };
@@ -1 +1,2 @@
1
1
  export * from './compute';
2
+ export * from './realized';
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './math/index';
6
6
  export * from './position/index';
7
7
  export * from './precise-price';
8
8
  export * from './precise-quantity';
9
+ export * from './proxy';
9
10
  export * from './sync/index';
10
11
  export * from './validate-leverage';
11
12
  export * from './validate-quantity';