@pear-protocol/types 0.0.1

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 (131) hide show
  1. package/dist/auth/entities.d.ts +9 -0
  2. package/dist/auth/entities.js +8 -0
  3. package/dist/auth/index.d.ts +3 -0
  4. package/dist/auth/index.js +3 -0
  5. package/dist/auth/payloads.d.ts +50 -0
  6. package/dist/auth/payloads.js +39 -0
  7. package/dist/auth/response.d.ts +55 -0
  8. package/dist/auth/response.js +21 -0
  9. package/dist/bundle.d.ts +17 -0
  10. package/dist/bundle.js +17 -0
  11. package/dist/common/array.d.ts +10 -0
  12. package/dist/common/array.js +10 -0
  13. package/dist/common/index.d.ts +3 -0
  14. package/dist/common/index.js +3 -0
  15. package/dist/common/refinement.d.ts +20 -0
  16. package/dist/common/refinement.js +60 -0
  17. package/dist/common/request.d.ts +11 -0
  18. package/dist/common/request.js +24 -0
  19. package/dist/common/response.d.ts +12 -0
  20. package/dist/common/response.js +28 -0
  21. package/dist/common/schema.d.ts +8 -0
  22. package/dist/common/schema.js +10 -0
  23. package/dist/common/trade-legs.d.ts +34 -0
  24. package/dist/common/trade-legs.js +30 -0
  25. package/dist/connector/index.d.ts +8 -0
  26. package/dist/connector/index.js +5 -0
  27. package/dist/execution/entities.d.ts +741 -0
  28. package/dist/execution/entities.js +125 -0
  29. package/dist/execution/index.d.ts +3 -0
  30. package/dist/execution/index.js +3 -0
  31. package/dist/execution/queries.d.ts +20 -0
  32. package/dist/execution/queries.js +14 -0
  33. package/dist/execution/responses.d.ts +218 -0
  34. package/dist/execution/responses.js +9 -0
  35. package/dist/fill/entities.d.ts +25 -0
  36. package/dist/fill/entities.js +61 -0
  37. package/dist/fill/index.d.ts +3 -0
  38. package/dist/fill/index.js +3 -0
  39. package/dist/fill/queries.d.ts +13 -0
  40. package/dist/fill/queries.js +11 -0
  41. package/dist/fill/responses.d.ts +55 -0
  42. package/dist/fill/responses.js +12 -0
  43. package/dist/funding/entities.d.ts +11 -0
  44. package/dist/funding/entities.js +16 -0
  45. package/dist/funding/index.d.ts +3 -0
  46. package/dist/funding/index.js +3 -0
  47. package/dist/funding/queries.d.ts +10 -0
  48. package/dist/funding/queries.js +8 -0
  49. package/dist/funding/responses.d.ts +8 -0
  50. package/dist/funding/responses.js +11 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +3 -0
  53. package/dist/instrument/entities.d.ts +43 -0
  54. package/dist/instrument/entities.js +48 -0
  55. package/dist/instrument/index.d.ts +3 -0
  56. package/dist/instrument/index.js +3 -0
  57. package/dist/instrument/queries.d.ts +10 -0
  58. package/dist/instrument/queries.js +8 -0
  59. package/dist/instrument/responses.d.ts +37 -0
  60. package/dist/instrument/responses.js +11 -0
  61. package/dist/instrument-precision/index.d.ts +18 -0
  62. package/dist/instrument-precision/index.js +51 -0
  63. package/dist/misc/index.d.ts +3 -0
  64. package/dist/misc/index.js +1 -0
  65. package/dist/order/entities.d.ts +73 -0
  66. package/dist/order/entities.js +73 -0
  67. package/dist/order/index.d.ts +1 -0
  68. package/dist/order/index.js +1 -0
  69. package/dist/position/entities.d.ts +53 -0
  70. package/dist/position/entities.js +55 -0
  71. package/dist/position/index.d.ts +3 -0
  72. package/dist/position/index.js +3 -0
  73. package/dist/position/queries.d.ts +16 -0
  74. package/dist/position/queries.js +28 -0
  75. package/dist/position/responses.d.ts +28 -0
  76. package/dist/position/responses.js +8 -0
  77. package/dist/price/entities.d.ts +8 -0
  78. package/dist/price/entities.js +7 -0
  79. package/dist/price/index.d.ts +3 -0
  80. package/dist/price/index.js +3 -0
  81. package/dist/price/queries.d.ts +10 -0
  82. package/dist/price/queries.js +8 -0
  83. package/dist/price/responses.d.ts +6 -0
  84. package/dist/price/responses.js +15 -0
  85. package/dist/schedule/entities.d.ts +380 -0
  86. package/dist/schedule/entities.js +159 -0
  87. package/dist/schedule/index.d.ts +4 -0
  88. package/dist/schedule/index.js +4 -0
  89. package/dist/schedule/payloads.d.ts +72 -0
  90. package/dist/schedule/payloads.js +102 -0
  91. package/dist/schedule/queries.d.ts +18 -0
  92. package/dist/schedule/queries.js +12 -0
  93. package/dist/schedule/responses.d.ts +279 -0
  94. package/dist/schedule/responses.js +10 -0
  95. package/dist/trade/index.d.ts +2 -0
  96. package/dist/trade/index.js +2 -0
  97. package/dist/trade/payloads.d.ts +217 -0
  98. package/dist/trade/payloads.js +35 -0
  99. package/dist/trade/responses.d.ts +861 -0
  100. package/dist/trade/responses.js +9 -0
  101. package/dist/trade-accounts/entities.d.ts +50 -0
  102. package/dist/trade-accounts/entities.js +18 -0
  103. package/dist/trade-accounts/index.d.ts +3 -0
  104. package/dist/trade-accounts/index.js +3 -0
  105. package/dist/trade-accounts/payloads.d.ts +137 -0
  106. package/dist/trade-accounts/payloads.js +84 -0
  107. package/dist/trade-accounts/response.d.ts +65 -0
  108. package/dist/trade-accounts/response.js +41 -0
  109. package/dist/trigger/entities/conditions.d.ts +407 -0
  110. package/dist/trigger/entities/conditions.js +239 -0
  111. package/dist/trigger/entities/index.d.ts +1549 -0
  112. package/dist/trigger/entities/index.js +123 -0
  113. package/dist/trigger/index.d.ts +6 -0
  114. package/dist/trigger/index.js +6 -0
  115. package/dist/trigger/payloads/conditions.d.ts +340 -0
  116. package/dist/trigger/payloads/conditions.js +109 -0
  117. package/dist/trigger/payloads/index.d.ts +470 -0
  118. package/dist/trigger/payloads/index.js +47 -0
  119. package/dist/trigger/queries.d.ts +18 -0
  120. package/dist/trigger/queries.js +12 -0
  121. package/dist/trigger/responses.d.ts +1001 -0
  122. package/dist/trigger/responses.js +10 -0
  123. package/dist/users/entities.d.ts +16 -0
  124. package/dist/users/entities.js +14 -0
  125. package/dist/users/index.d.ts +3 -0
  126. package/dist/users/index.js +3 -0
  127. package/dist/users/payloads.d.ts +5 -0
  128. package/dist/users/payloads.js +7 -0
  129. package/dist/users/response.d.ts +23 -0
  130. package/dist/users/response.js +12 -0
  131. package/package.json +35 -0
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './bundle';
2
+ import * as bundle from './bundle';
3
+ export { bundle as HttpTypes };
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ export declare const InstrumentId: z.ZodString;
3
+ export type InstrumentId = z.infer<typeof InstrumentId>;
4
+ export declare const InstrumentType: z.ZodEnum<{
5
+ spot: "spot";
6
+ perp: "perp";
7
+ hip3: "hip3";
8
+ }>;
9
+ export type InstrumentType = z.infer<typeof InstrumentType>;
10
+ export declare const Instrument: z.ZodObject<{
11
+ id: z.ZodString;
12
+ base: z.ZodString;
13
+ quote: z.ZodString;
14
+ connector: z.ZodEnum<{
15
+ hyperliquid: "hyperliquid";
16
+ binanceusdm: "binanceusdm";
17
+ bybit: "bybit";
18
+ okx: "okx";
19
+ }>;
20
+ type: z.ZodEnum<{
21
+ spot: "spot";
22
+ perp: "perp";
23
+ hip3: "hip3";
24
+ }>;
25
+ leverage: z.ZodInt;
26
+ precision: z.ZodObject<{
27
+ quantity: z.ZodObject<{
28
+ decimals: z.ZodInt;
29
+ step: z.ZodNumber;
30
+ contractSize: z.ZodNumber;
31
+ }, z.core.$strip>;
32
+ price: z.ZodObject<{
33
+ decimals: z.ZodInt;
34
+ tick: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
35
+ sigFigs: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodInt, z.ZodTransform<number | undefined, number>>>>;
36
+ }, z.core.$strip>;
37
+ notional: z.ZodOptional<z.ZodObject<{
38
+ min: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
39
+ max: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>;
42
+ }, z.core.$strip>;
43
+ export type Instrument = z.output<typeof Instrument>;
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { Connector } from '../connector';
3
+ import { InstrumentPrecision } from '../instrument-precision';
4
+
5
+ const InstrumentId = z.string();
6
+ const InstrumentType = z.enum(["spot", "perp", "hip3"]);
7
+ const Instrument = z.object({
8
+ /**
9
+ * Exchange specific instrument identifier
10
+ * @example (dexIndex + assetIndex) on Hyperliquid
11
+ * @example "BTCUSDT" on Binance
12
+ */
13
+ id: InstrumentId,
14
+ /**
15
+ * The base asset of the instrument.
16
+ * @example "BTC"
17
+ */
18
+ base: z.string(),
19
+ /**
20
+ * The quote asset of the instrument.
21
+ * @example "USDT"
22
+ */
23
+ quote: z.string(),
24
+ /**
25
+ * The connector of the instrument.
26
+ * @example "hyperliquid"
27
+ * @example "binanceusdm"
28
+ */
29
+ connector: Connector,
30
+ /**
31
+ * The type of the instrument.
32
+ * @example "spot"
33
+ * @example "perp"
34
+ * @example "hip3"
35
+ */
36
+ type: InstrumentType,
37
+ /**
38
+ * The maximum leverage of the instrument.
39
+ * @example 1
40
+ */
41
+ leverage: z.int().min(1),
42
+ /**
43
+ * The precision of the instrument.
44
+ */
45
+ precision: InstrumentPrecision
46
+ });
47
+
48
+ export { Instrument, InstrumentId, InstrumentType };
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const InstrumentListParams: z.ZodObject<{
3
+ connector: z.ZodEnum<{
4
+ hyperliquid: "hyperliquid";
5
+ binanceusdm: "binanceusdm";
6
+ bybit: "bybit";
7
+ okx: "okx";
8
+ }>;
9
+ }, z.core.$strip>;
10
+ export type InstrumentListParams = z.output<typeof InstrumentListParams>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { Connector } from '../connector';
3
+
4
+ const InstrumentListParams = z.object({
5
+ connector: Connector
6
+ });
7
+
8
+ export { InstrumentListParams };
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ export declare const InstrumentListResponse: z.ZodObject<{
3
+ instruments: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodString;
5
+ base: z.ZodString;
6
+ quote: z.ZodString;
7
+ connector: z.ZodEnum<{
8
+ hyperliquid: "hyperliquid";
9
+ binanceusdm: "binanceusdm";
10
+ bybit: "bybit";
11
+ okx: "okx";
12
+ }>;
13
+ type: z.ZodEnum<{
14
+ spot: "spot";
15
+ perp: "perp";
16
+ hip3: "hip3";
17
+ }>;
18
+ leverage: z.ZodInt;
19
+ precision: z.ZodObject<{
20
+ quantity: z.ZodObject<{
21
+ decimals: z.ZodInt;
22
+ step: z.ZodNumber;
23
+ contractSize: z.ZodNumber;
24
+ }, z.core.$strip>;
25
+ price: z.ZodObject<{
26
+ decimals: z.ZodInt;
27
+ tick: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
28
+ sigFigs: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodInt, z.ZodTransform<number | undefined, number>>>>;
29
+ }, z.core.$strip>;
30
+ notional: z.ZodOptional<z.ZodObject<{
31
+ min: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
32
+ max: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>;
37
+ export type InstrumentListResponse = z.output<typeof InstrumentListResponse>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { Instrument } from './entities';
3
+
4
+ const InstrumentListResponse = z.object({
5
+ /**
6
+ * The list of instruments.
7
+ */
8
+ instruments: z.array(Instrument)
9
+ });
10
+
11
+ export { InstrumentListResponse };
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const InstrumentPrecision: z.ZodObject<{
3
+ quantity: z.ZodObject<{
4
+ decimals: z.ZodInt;
5
+ step: z.ZodNumber;
6
+ contractSize: z.ZodNumber;
7
+ }, z.core.$strip>;
8
+ price: z.ZodObject<{
9
+ decimals: z.ZodInt;
10
+ tick: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
11
+ sigFigs: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodInt, z.ZodTransform<number | undefined, number>>>>;
12
+ }, z.core.$strip>;
13
+ notional: z.ZodOptional<z.ZodObject<{
14
+ min: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
15
+ max: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<number | undefined, number>>>>;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>;
18
+ export type InstrumentPrecision = z.output<typeof InstrumentPrecision>;
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+
3
+ const InstrumentPrecision = z.object({
4
+ quantity: z.object({
5
+ /**
6
+ * The maximum number of decimals accepted.
7
+ * @example 4 for a 0.0001 step size.
8
+ */
9
+ decimals: z.int(),
10
+ /**
11
+ * The smallest step size.
12
+ * @example 0.01 for a 2 decimal precision.
13
+ */
14
+ step: z.number(),
15
+ /**
16
+ * Size of one contract in base asset units.
17
+ * For exchanges where 1 contract != 1 base unit (e.g., OKX: 1 contract = 0.01 BTC).
18
+ * 1 means 1:1 mapping (most exchanges).
19
+ */
20
+ contractSize: z.number()
21
+ }),
22
+ price: z.object({
23
+ /**
24
+ * The maximum number of decimals.
25
+ * @example 4 for a 0.0001 tick size.
26
+ */
27
+ decimals: z.int(),
28
+ /**
29
+ * The smallest increment.
30
+ * @example 0.01 for a 2 decimal precision.
31
+ */
32
+ tick: z.number().transform((val) => val === null ? void 0 : val).optional().nullable(),
33
+ /**
34
+ * The number of significant figures.
35
+ * @example 5 on Hyperliquid V2.
36
+ */
37
+ sigFigs: z.int().transform((val) => val === null ? void 0 : val).optional().nullable()
38
+ }),
39
+ notional: z.object({
40
+ /**
41
+ * The minimum notional amount in USD.
42
+ */
43
+ min: z.number().transform((val) => val === null ? void 0 : val).optional().nullable(),
44
+ /**
45
+ * The maximum notional amount in USD.
46
+ */
47
+ max: z.number().transform((val) => val === null ? void 0 : val).optional().nullable()
48
+ }).optional()
49
+ });
50
+
51
+ export { InstrumentPrecision };
@@ -0,0 +1,3 @@
1
+ export type UnsignedDecimalString = string;
2
+ export type SignedDecimalString = string;
3
+ export type Side = 'BUY' | 'SELL';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ export declare const OrderStatus: z.ZodEnum<{
3
+ PENDING: "PENDING";
4
+ PARTIAL: "PARTIAL";
5
+ FILLED: "FILLED";
6
+ CANCELLED: "CANCELLED";
7
+ REJECTED: "REJECTED";
8
+ }>;
9
+ export type OrderStatus = z.infer<typeof OrderStatus>;
10
+ export declare const MarketOrder: z.ZodObject<{
11
+ id: z.ZodUUID;
12
+ connector: z.ZodEnum<{
13
+ hyperliquid: "hyperliquid";
14
+ binanceusdm: "binanceusdm";
15
+ bybit: "bybit";
16
+ okx: "okx";
17
+ }>;
18
+ status: z.ZodEnum<{
19
+ PENDING: "PENDING";
20
+ PARTIAL: "PARTIAL";
21
+ FILLED: "FILLED";
22
+ CANCELLED: "CANCELLED";
23
+ REJECTED: "REJECTED";
24
+ }>;
25
+ error: z.ZodOptional<z.ZodString>;
26
+ createdAt: z.ZodString;
27
+ updatedAt: z.ZodString;
28
+ type: z.ZodLiteral<"MARKET">;
29
+ symbol: z.ZodString;
30
+ side: z.ZodEnum<{
31
+ BUY: "BUY";
32
+ SELL: "SELL";
33
+ }>;
34
+ reduceOnly: z.ZodBoolean;
35
+ leverage: z.ZodInt;
36
+ quantity: z.ZodString;
37
+ price: z.ZodString;
38
+ filledQuantity: z.ZodString;
39
+ filledPrice: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export declare const Order: z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ id: z.ZodUUID;
43
+ connector: z.ZodEnum<{
44
+ hyperliquid: "hyperliquid";
45
+ binanceusdm: "binanceusdm";
46
+ bybit: "bybit";
47
+ okx: "okx";
48
+ }>;
49
+ status: z.ZodEnum<{
50
+ PENDING: "PENDING";
51
+ PARTIAL: "PARTIAL";
52
+ FILLED: "FILLED";
53
+ CANCELLED: "CANCELLED";
54
+ REJECTED: "REJECTED";
55
+ }>;
56
+ error: z.ZodOptional<z.ZodString>;
57
+ createdAt: z.ZodString;
58
+ updatedAt: z.ZodString;
59
+ type: z.ZodLiteral<"MARKET">;
60
+ symbol: z.ZodString;
61
+ side: z.ZodEnum<{
62
+ BUY: "BUY";
63
+ SELL: "SELL";
64
+ }>;
65
+ reduceOnly: z.ZodBoolean;
66
+ leverage: z.ZodInt;
67
+ quantity: z.ZodString;
68
+ price: z.ZodString;
69
+ filledQuantity: z.ZodString;
70
+ filledPrice: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>], "type">;
72
+ export type Order = z.output<typeof Order>;
73
+ export type MarketOrder = z.output<typeof MarketOrder>;
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ import { UnsignedDecimalString, Leverage, Side } from '../common/schema';
3
+ import { Connector } from '../connector';
4
+ import { InstrumentId } from '../instrument';
5
+
6
+ const OrderStatus = z.enum(["PENDING", "PARTIAL", "FILLED", "CANCELLED", "REJECTED"]);
7
+ const BaseOrder = z.object({
8
+ /**
9
+ * Order UUID
10
+ */
11
+ id: z.uuid(),
12
+ /**
13
+ * Connector
14
+ */
15
+ connector: Connector,
16
+ /**
17
+ * Order status
18
+ */
19
+ status: OrderStatus,
20
+ /**
21
+ * Error message
22
+ */
23
+ error: z.string().optional(),
24
+ /**
25
+ * Created at timestamp
26
+ */
27
+ createdAt: z.string(),
28
+ /**
29
+ * Updated at timestamp
30
+ */
31
+ updatedAt: z.string()
32
+ });
33
+ const MarketOrder = BaseOrder.extend({
34
+ /**
35
+ * Order type
36
+ */
37
+ type: z.literal("MARKET"),
38
+ /**
39
+ * Instrument ID
40
+ */
41
+ symbol: InstrumentId,
42
+ /**
43
+ * Side
44
+ */
45
+ side: Side,
46
+ /**
47
+ * Reduce only flag
48
+ */
49
+ reduceOnly: z.boolean(),
50
+ /**
51
+ * Leverage
52
+ */
53
+ leverage: Leverage,
54
+ /**
55
+ * Contract quantity to trade
56
+ */
57
+ quantity: UnsignedDecimalString,
58
+ /**
59
+ * Price
60
+ */
61
+ price: UnsignedDecimalString,
62
+ /**
63
+ * Filled contract quantity
64
+ */
65
+ filledQuantity: UnsignedDecimalString,
66
+ /**
67
+ * Filled price
68
+ */
69
+ filledPrice: UnsignedDecimalString.optional()
70
+ });
71
+ const Order = z.discriminatedUnion("type", [BaseOrder.extend(MarketOrder.shape)]);
72
+
73
+ export { MarketOrder, Order, OrderStatus };
@@ -0,0 +1 @@
1
+ export * from './entities';
@@ -0,0 +1 @@
1
+ export * from './entities';
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ export declare const PositionStatus: z.ZodEnum<{
3
+ OPEN: "OPEN";
4
+ CLOSED: "CLOSED";
5
+ }>;
6
+ export type PositionStatus = z.infer<typeof PositionStatus>;
7
+ export declare const PositionClosedReason: z.ZodEnum<{
8
+ NETTED: "NETTED";
9
+ USER: "USER";
10
+ LIQUIDATED: "LIQUIDATED";
11
+ }>;
12
+ export type PositionClosedReason = z.infer<typeof PositionClosedReason>;
13
+ /**
14
+ * The exposure of a position in directional units for each asset.
15
+ *
16
+ * @example { '0': '0.002' } means BTC 0.002 LONG
17
+ * @example { '1': '-0.5' } means ETH 0.5 SHORT
18
+ */
19
+ export declare const PositionExposure: z.ZodRecord<z.ZodString, z.ZodString>;
20
+ export type PositionExposure = z.infer<typeof PositionExposure>;
21
+ /**
22
+ * The initial exposure in directional USD for each asset.
23
+ *
24
+ * @example { '0': 1000 } means BTC 1000 USD LONG
25
+ * @example { '1': -500 } means ETH 500 USD SHORT
26
+ */
27
+ export declare const PositionInitialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString>;
28
+ export type PositionInitialExposureUSD = z.infer<typeof PositionInitialExposureUSD>;
29
+ export declare const Position: z.ZodObject<{
30
+ id: z.ZodUUID;
31
+ tradeAccountId: z.ZodUUID;
32
+ connector: z.ZodEnum<{
33
+ hyperliquid: "hyperliquid";
34
+ binanceusdm: "binanceusdm";
35
+ bybit: "bybit";
36
+ okx: "okx";
37
+ }>;
38
+ status: z.ZodEnum<{
39
+ OPEN: "OPEN";
40
+ CLOSED: "CLOSED";
41
+ }>;
42
+ closedReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
43
+ NETTED: "NETTED";
44
+ USER: "USER";
45
+ LIQUIDATED: "LIQUIDATED";
46
+ }>>>;
47
+ exposure: z.ZodRecord<z.ZodString, z.ZodString>;
48
+ closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString>;
50
+ createdAt: z.ZodString;
51
+ updatedAt: z.ZodString;
52
+ }, z.core.$strip>;
53
+ export type Position = z.output<typeof Position>;
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import { SignedDecimalString } from '../common/schema';
3
+ import { Connector } from '../connector';
4
+ import { InstrumentId } from '../instrument';
5
+
6
+ const PositionStatus = z.enum(["OPEN", "CLOSED"]);
7
+ const PositionClosedReason = z.enum(["NETTED", "USER", "LIQUIDATED"]);
8
+ const PositionExposure = z.record(InstrumentId, SignedDecimalString);
9
+ const PositionInitialExposureUSD = z.record(InstrumentId, SignedDecimalString);
10
+ const Position = z.object({
11
+ /**
12
+ * Position UUID
13
+ */
14
+ id: z.uuid(),
15
+ /**
16
+ * Trade account UUID
17
+ */
18
+ tradeAccountId: z.uuid(),
19
+ /**
20
+ * Connector
21
+ */
22
+ connector: Connector,
23
+ /**
24
+ * Position status
25
+ */
26
+ status: PositionStatus,
27
+ /**
28
+ * Closed reason
29
+ */
30
+ closedReason: PositionClosedReason.nullable().optional(),
31
+ /**
32
+ * Position exposure
33
+ */
34
+ exposure: PositionExposure,
35
+ /**
36
+ * Closed at timestamp
37
+ */
38
+ closedAt: z.string().nullable().optional(),
39
+ /**
40
+ * The exposure expressed in USD at the time
41
+ * the position was opened. It does not change
42
+ * on adjustments, and is only used for UI purposes.
43
+ */
44
+ initialExposureUSD: PositionInitialExposureUSD,
45
+ /**
46
+ * Created at timestamp
47
+ */
48
+ createdAt: z.string(),
49
+ /**
50
+ * Updated at timestamp
51
+ */
52
+ updatedAt: z.string()
53
+ });
54
+
55
+ export { Position, PositionClosedReason, PositionExposure, PositionInitialExposureUSD, PositionStatus };
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const PositionListParams: z.ZodObject<{
3
+ connector: z.ZodOptional<z.ZodEnum<{
4
+ hyperliquid: "hyperliquid";
5
+ binanceusdm: "binanceusdm";
6
+ bybit: "bybit";
7
+ okx: "okx";
8
+ }>>;
9
+ status: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[] | (("OPEN" | "CLOSED")[] & any[]) | undefined, ("OPEN" | "CLOSED")[]>, z.ZodArray<z.ZodEnum<{
10
+ OPEN: "OPEN";
11
+ CLOSED: "CLOSED";
12
+ }>>>>;
13
+ orderBy: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"createdAt">, z.ZodLiteral<"-createdAt">, z.ZodLiteral<"updatedAt">, z.ZodLiteral<"-updatedAt">]>>;
14
+ }, z.core.$strip>;
15
+ export type PositionListParamsInput = z.input<typeof PositionListParams>;
16
+ export type PositionListParams = z.output<typeof PositionListParams>;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { normalizeArray } from '../common';
3
+ import { Connector } from '../connector';
4
+
5
+ const OrderBy = z.union([
6
+ z.literal("createdAt"),
7
+ z.literal("-createdAt"),
8
+ z.literal("updatedAt"),
9
+ z.literal("-updatedAt")
10
+ ]);
11
+ const StatusEnum = z.enum(["OPEN", "CLOSED"]);
12
+ const StatusArray = z.preprocess((arg) => normalizeArray(arg), z.array(StatusEnum));
13
+ const PositionListParams = z.object({
14
+ /**
15
+ * Connector filter
16
+ */
17
+ connector: Connector.optional(),
18
+ /**
19
+ * Status filter
20
+ */
21
+ status: StatusArray.optional(),
22
+ /**
23
+ * Order by field
24
+ */
25
+ orderBy: OrderBy.default("-createdAt")
26
+ });
27
+
28
+ export { PositionListParams };
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export declare const PositionListResponse: z.ZodObject<{
3
+ positions: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodUUID;
5
+ tradeAccountId: z.ZodUUID;
6
+ connector: z.ZodEnum<{
7
+ hyperliquid: "hyperliquid";
8
+ binanceusdm: "binanceusdm";
9
+ bybit: "bybit";
10
+ okx: "okx";
11
+ }>;
12
+ status: z.ZodEnum<{
13
+ OPEN: "OPEN";
14
+ CLOSED: "CLOSED";
15
+ }>;
16
+ closedReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
17
+ NETTED: "NETTED";
18
+ USER: "USER";
19
+ LIQUIDATED: "LIQUIDATED";
20
+ }>>>;
21
+ exposure: z.ZodRecord<z.ZodString, z.ZodString>;
22
+ closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString>;
24
+ createdAt: z.ZodString;
25
+ updatedAt: z.ZodString;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>;
28
+ export type PositionListResponse = z.output<typeof PositionListResponse>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { Position } from './entities';
3
+
4
+ const PositionListResponse = z.object({
5
+ positions: z.array(Position)
6
+ });
7
+
8
+ export { PositionListResponse };
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const PriceSource: z.ZodEnum<{
3
+ mid: "mid";
4
+ mark: "mark";
5
+ }>;
6
+ export type PriceSource = z.infer<typeof PriceSource>;
7
+ export declare const InstrumentPriceMap: z.ZodRecord<z.ZodString, z.ZodString>;
8
+ export type InstrumentPriceMap = z.output<typeof InstrumentPriceMap>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { InstrumentId } from '../instrument';
3
+
4
+ const PriceSource = z.enum(["mid", "mark"]);
5
+ const InstrumentPriceMap = z.record(InstrumentId, z.string());
6
+
7
+ export { InstrumentPriceMap, PriceSource };
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,3 @@
1
+ export * from './entities';
2
+ export * from './queries';
3
+ export * from './responses';
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const PricesQueryParams: z.ZodObject<{
3
+ connector: z.ZodEnum<{
4
+ hyperliquid: "hyperliquid";
5
+ binanceusdm: "binanceusdm";
6
+ bybit: "bybit";
7
+ okx: "okx";
8
+ }>;
9
+ }, z.core.$strip>;
10
+ export type PricesQueryParams = z.output<typeof PricesQueryParams>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { Connector } from '../connector';
3
+
4
+ const PricesQueryParams = z.object({
5
+ connector: Connector
6
+ });
7
+
8
+ export { PricesQueryParams };