@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
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
1
  export { computeSyncPayload } from './compute';
2
- export type { ComputeSyncPayloadArgs, ComputeSyncPayloadResult, } from './types';
2
+ export type { ComputeSyncPayloadArgs, ComputeSyncPayloadResult } from './types';
@@ -1,27 +1,26 @@
1
1
  import type { HttpTypes } from '@pear-protocol/types';
2
- import type BigNumber from 'bignumber.js';
3
- export type OrphanCreatableExternalFill = Omit<HttpTypes.CreatableExternalFill, 'positionId' | 'type'>;
4
- export type CompositeGroupKey = `${string}-${string}`;
5
- export type GroupedCreatables = {
6
- positionId: string;
7
- symbol: string;
8
- exposure: BigNumber;
9
- fills: [HttpTypes.CreatableExternalFill, ...HttpTypes.CreatableExternalFill[]];
10
- };
11
- export type GroupedCreatablesMap = Map<CompositeGroupKey, GroupedCreatables>;
12
2
  export type ComputeSyncPayloadArgs = {
3
+ tradeAccountId: string;
4
+ connector: HttpTypes.Connector;
13
5
  openPositions: HttpTypes.OpenPositionLite[];
6
+ entryBySymbol: Record<string, string>;
14
7
  provisionalFills: HttpTypes.ProvisionalFill[];
15
8
  confirmedExchangeFillIds: string[];
16
9
  externalFills: HttpTypes.UnknownExternalFill[];
10
+ exchangePositions: HttpTypes.ExternalPosition[];
11
+ neverSynced: boolean;
17
12
  };
18
13
  export type ComputeSyncPayloadResult = {
19
14
  reconcilables: HttpTypes.ReconcileFillsRequest | null;
20
15
  confirmables: HttpTypes.ConfirmFillsRequest | null;
21
- creatables: HttpTypes.CreateFillsRequest | null;
16
+ applicables: HttpTypes.ApplicablePosition[];
17
+ exchangePositions: HttpTypes.ExternalPosition[];
22
18
  meta: {
23
- externalMinTs: number | null;
24
19
  externalMaxTs: number | null;
25
- processedCount: number;
26
20
  };
21
+ firstSyncTrim: {
22
+ cutoffTs: number | null;
23
+ trimmedCount: number;
24
+ trimmedMaxTs: number;
25
+ } | null;
27
26
  };
@@ -1,2 +1,5 @@
1
1
  import type { Instrument } from '@pear-protocol/types';
2
+ /**
3
+ * True when a requested leverage is within global bounds and supported by the instrument.
4
+ */
2
5
  export declare function validateLeverage(leverage: number, instrument: Instrument): boolean;
@@ -1,2 +1,6 @@
1
1
  import type { InstrumentPrecision } from '@pear-protocol/types';
2
+ /**
3
+ * True when an order quantity is positive, step-aligned, and within the
4
+ * instrument's optional notional bounds at the given price.
5
+ */
2
6
  export declare function validateQuantity(quantity: string, price: string, precision: InstrumentPrecision): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/utils",
3
- "version": "0.0.23",
3
+ "version": "0.2.0",
4
4
  "description": "Pear Protocol Utility functions",
5
5
  "private": false,
6
6
  "type": "module",
@@ -26,7 +26,8 @@
26
26
  "typecheck": "tsc --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@pear-protocol/types": "^1.0.0",
29
+ "@noble/hashes": "^1.3.2",
30
+ "@pear-protocol/types": "^1.9.0",
30
31
  "bignumber.js": "9.3.1"
31
32
  },
32
33
  "devDependencies": {