@pear-protocol/types 2.20.0 → 2.22.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.
- package/dist/bundle.d.ts +1 -0
- package/dist/fee/entities.d.ts +1 -0
- package/dist/fee/responses.d.ts +26 -0
- package/dist/index.js +7355 -3
- package/dist/rewards/entities.d.ts +28 -0
- package/dist/rewards/payloads.d.ts +7 -0
- package/dist/rewards/responses.d.ts +73 -0
- package/dist/statistics/queries.d.ts +25 -0
- package/dist/statistics/responses.d.ts +120 -0
- package/dist/sync/responses.d.ts +1 -0
- package/dist/users/entities.d.ts +4 -0
- package/dist/users/response.d.ts +3 -0
- package/package.json +4 -3
- package/dist/auth/api-keys.js +0 -44
- package/dist/auth/entities.js +0 -25
- package/dist/auth/index.js +0 -4
- package/dist/auth/payloads.js +0 -84
- package/dist/auth/response.js +0 -82
- package/dist/baskets/recommended/entities.js +0 -22
- package/dist/baskets/recommended/index.js +0 -2
- package/dist/baskets/recommended/responses.js +0 -8
- package/dist/baskets/saved/entities.js +0 -23
- package/dist/baskets/saved/payloads.js +0 -18
- package/dist/baskets/saved/responses.js +0 -14
- package/dist/bundle.js +0 -36
- package/dist/common/address.js +0 -5
- package/dist/common/array.js +0 -17
- package/dist/common/client-id.js +0 -5
- package/dist/common/hex-string.js +0 -5
- package/dist/common/index.js +0 -4
- package/dist/common/refinement.js +0 -64
- package/dist/common/request.js +0 -24
- package/dist/common/response.js +0 -28
- package/dist/common/schema.js +0 -18
- package/dist/common/trade-legs.js +0 -50
- package/dist/connector/index.js +0 -12
- package/dist/copy/entities.js +0 -151
- package/dist/copy/index.js +0 -5
- package/dist/copy/payloads.js +0 -8
- package/dist/copy/performance.js +0 -63
- package/dist/copy/queries.js +0 -20
- package/dist/copy/responses.js +0 -89
- package/dist/execution/entities.js +0 -196
- package/dist/execution/index.js +0 -3
- package/dist/execution/queries.js +0 -18
- package/dist/execution/responses.js +0 -12
- package/dist/fee/entities.js +0 -34
- package/dist/fee/index.js +0 -3
- package/dist/fee/queries.js +0 -12
- package/dist/fee/responses.js +0 -29
- package/dist/fill/entities.js +0 -82
- package/dist/fill/index.js +0 -3
- package/dist/fill/queries.js +0 -14
- package/dist/fill/responses.js +0 -23
- package/dist/funding/entities.js +0 -16
- package/dist/funding/index.js +0 -3
- package/dist/funding/queries.js +0 -8
- package/dist/funding/responses.js +0 -11
- package/dist/instrument/entities.js +0 -102
- package/dist/instrument/index.js +0 -3
- package/dist/instrument/queries.js +0 -15
- package/dist/instrument/responses.js +0 -20
- package/dist/instrument-precision/index.js +0 -56
- package/dist/ladder/entities.js +0 -24
- package/dist/ladder/index.js +0 -4
- package/dist/ladder/payloads.js +0 -96
- package/dist/ladder/queries.js +0 -12
- package/dist/ladder/responses.js +0 -18
- package/dist/leverage/index.js +0 -2
- package/dist/leverage/payloads.js +0 -14
- package/dist/leverage/response.js +0 -5
- package/dist/margin/index.js +0 -2
- package/dist/margin/payloads.js +0 -20
- package/dist/margin/response.js +0 -11
- package/dist/market/entities.js +0 -52
- package/dist/market/index.js +0 -4
- package/dist/market/payloads.js +0 -11
- package/dist/market/queries.js +0 -19
- package/dist/market/responses.js +0 -18
- package/dist/misc/index.js +0 -2
- package/dist/misc/payloads.js +0 -99
- package/dist/misc/responses.js +0 -85
- package/dist/notification/entities.js +0 -274
- package/dist/notification/index.js +0 -4
- package/dist/notification/payloads.js +0 -15
- package/dist/notification/queries.js +0 -29
- package/dist/notification/responses.js +0 -20
- package/dist/order/entities.js +0 -81
- package/dist/order/index.js +0 -1
- package/dist/portfolio/entities.js +0 -77
- package/dist/portfolio/index.js +0 -3
- package/dist/portfolio/queries.js +0 -34
- package/dist/portfolio/responses.js +0 -33
- package/dist/position/entities.js +0 -433
- package/dist/position/index.js +0 -3
- package/dist/position/queries.js +0 -109
- package/dist/position/responses.js +0 -41
- package/dist/price/entities.js +0 -10
- package/dist/price/index.js +0 -3
- package/dist/price/queries.js +0 -8
- package/dist/price/responses.js +0 -15
- package/dist/realtime/channels.js +0 -16
- package/dist/realtime/frames.js +0 -140
- package/dist/realtime/index.js +0 -6
- package/dist/realtime/messages.js +0 -118
- package/dist/realtime/public-events.js +0 -92
- package/dist/realtime/user-events.js +0 -32
- package/dist/realtime/vault-events.js +0 -42
- package/dist/rebalance/entities.js +0 -86
- package/dist/rebalance/index.js +0 -4
- package/dist/rebalance/payloads.js +0 -56
- package/dist/rebalance/queries.js +0 -14
- package/dist/rebalance/responses.js +0 -41
- package/dist/schedule/entities.js +0 -239
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/payloads.js +0 -85
- package/dist/schedule/queries.js +0 -30
- package/dist/schedule/randomization.js +0 -15
- package/dist/schedule/responses.js +0 -22
- package/dist/schedule/twap-config.js +0 -29
- package/dist/statistics/entities.js +0 -105
- package/dist/statistics/index.js +0 -3
- package/dist/statistics/queries.js +0 -93
- package/dist/statistics/responses.js +0 -17
- package/dist/sync/index.js +0 -2
- package/dist/sync/payloads.js +0 -136
- package/dist/sync/responses.js +0 -26
- package/dist/tca/entities.js +0 -9
- package/dist/tca/index.js +0 -3
- package/dist/tca/queries.js +0 -14
- package/dist/tca/responses.js +0 -126
- package/dist/trade/entities.js +0 -101
- package/dist/trade/index.js +0 -4
- package/dist/trade/payloads.js +0 -84
- package/dist/trade/queries.js +0 -9
- package/dist/trade/responses.js +0 -25
- package/dist/trade-accounts/entities.js +0 -61
- package/dist/trade-accounts/index.js +0 -4
- package/dist/trade-accounts/payloads.js +0 -132
- package/dist/trade-accounts/queries.js +0 -7
- package/dist/trade-accounts/response.js +0 -79
- package/dist/traders/index.js +0 -2
- package/dist/traders/performance.js +0 -21
- package/dist/traders/public.js +0 -192
- package/dist/trigger/common/index.js +0 -39
- package/dist/trigger/entities/conditions.js +0 -174
- package/dist/trigger/entities/index.js +0 -257
- package/dist/trigger/index.js +0 -9
- package/dist/trigger/oracle.js +0 -22
- package/dist/trigger/payloads/conditions.js +0 -213
- package/dist/trigger/payloads/config.js +0 -3
- package/dist/trigger/payloads/index.js +0 -173
- package/dist/trigger/queries.js +0 -16
- package/dist/trigger/refinement/index.js +0 -2
- package/dist/trigger/refinement/static.refinement.js +0 -50
- package/dist/trigger/refinement/trailing.refinement.js +0 -83
- package/dist/trigger/responses.js +0 -18
- package/dist/triggers/entities.js +0 -27
- package/dist/triggers/index.js +0 -3
- package/dist/triggers/queries.js +0 -10
- package/dist/triggers/responses.js +0 -9
- package/dist/users/entities.js +0 -45
- package/dist/users/index.js +0 -4
- package/dist/users/payloads.js +0 -33
- package/dist/users/queries.js +0 -8
- package/dist/users/response.js +0 -27
- package/dist/vaults/entities.js +0 -96
- package/dist/vaults/index.js +0 -4
- package/dist/vaults/payloads.js +0 -65
- package/dist/vaults/queries.js +0 -66
- package/dist/vaults/responses.js +0 -368
- /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Side, UnsignedDecimalString } from '../common/schema';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
import { TpSlBracketType } from '../trigger/common';
|
|
5
|
-
|
|
6
|
-
const NotificationCategory = z.enum([
|
|
7
|
-
"TAKE_PROFIT_HIT",
|
|
8
|
-
"STOP_LOSS_HIT",
|
|
9
|
-
"TRIGGER_ORDER_HIT",
|
|
10
|
-
"TAKE_PROFIT_FAILED",
|
|
11
|
-
"STOP_LOSS_FAILED",
|
|
12
|
-
"TRIGGER_ORDER_FAILED",
|
|
13
|
-
"ATTACHED_TRIGGER_DISCARDED",
|
|
14
|
-
"AUTO_REBALANCE_EXECUTED",
|
|
15
|
-
"AUTO_REBALANCE_FAILED",
|
|
16
|
-
"AUTO_REBALANCE_PAUSED",
|
|
17
|
-
"TRIGGER_TWAP_STARTED",
|
|
18
|
-
"TRIGGER_TWAP_SKIPPED",
|
|
19
|
-
"TRIGGER_TWAP_FAILED",
|
|
20
|
-
"TRIGGER_TWAP_POSITION_CHANGED",
|
|
21
|
-
"TRIGGER_CANCELLED_MIS_SCALED",
|
|
22
|
-
"COPY_PLACED",
|
|
23
|
-
"COPY_FAILED",
|
|
24
|
-
"COPY_SUBSCRIPTION_STOPPED",
|
|
25
|
-
"COPY_LEVERAGE_NOT_APPLIED",
|
|
26
|
-
"POSITION_LIQUIDATION"
|
|
27
|
-
]);
|
|
28
|
-
const NotificationMetric = z.enum([
|
|
29
|
-
"ratio",
|
|
30
|
-
"price",
|
|
31
|
-
"weighted_ratio",
|
|
32
|
-
"notional",
|
|
33
|
-
"upnl",
|
|
34
|
-
"upnl_bps",
|
|
35
|
-
"ratio_trailing",
|
|
36
|
-
"price_trailing",
|
|
37
|
-
"weighted_ratio_trailing",
|
|
38
|
-
"notional_trailing",
|
|
39
|
-
"upnl_trailing",
|
|
40
|
-
"upnl_bps_trailing",
|
|
41
|
-
"funding_rate",
|
|
42
|
-
"prediction_market",
|
|
43
|
-
"btc_dominance"
|
|
44
|
-
]);
|
|
45
|
-
const TriggerNotificationEnrichment = {
|
|
46
|
-
metric: NotificationMetric.optional(),
|
|
47
|
-
level: z.number().optional(),
|
|
48
|
-
reason: z.string().max(255).optional()
|
|
49
|
-
};
|
|
50
|
-
const TriggerNotificationLeg = z.object({
|
|
51
|
-
id: z.string().min(1),
|
|
52
|
-
symbol: z.string().min(1),
|
|
53
|
-
side: Side
|
|
54
|
-
});
|
|
55
|
-
const PositionLegParameters = z.object({
|
|
56
|
-
legs: z.array(TriggerNotificationLeg)
|
|
57
|
-
});
|
|
58
|
-
const TakeProfitNotificationParameters = PositionLegParameters.safeExtend({
|
|
59
|
-
type: z.literal("take_profit"),
|
|
60
|
-
triggerId: z.uuid(),
|
|
61
|
-
positionId: z.uuid(),
|
|
62
|
-
connector: Connector,
|
|
63
|
-
...TriggerNotificationEnrichment,
|
|
64
|
-
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
65
|
-
semanticBracketType: TpSlBracketType.optional()
|
|
66
|
-
});
|
|
67
|
-
const StopLossNotificationParameters = PositionLegParameters.safeExtend({
|
|
68
|
-
type: z.literal("stop_loss"),
|
|
69
|
-
triggerId: z.uuid(),
|
|
70
|
-
positionId: z.uuid(),
|
|
71
|
-
connector: Connector,
|
|
72
|
-
...TriggerNotificationEnrichment,
|
|
73
|
-
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
74
|
-
semanticBracketType: TpSlBracketType.optional()
|
|
75
|
-
});
|
|
76
|
-
const TriggerOrderNotificationParameters = PositionLegParameters.safeExtend({
|
|
77
|
-
type: z.literal("trigger_order"),
|
|
78
|
-
triggerId: z.uuid(),
|
|
79
|
-
positionId: z.uuid(),
|
|
80
|
-
connector: Connector,
|
|
81
|
-
...TriggerNotificationEnrichment
|
|
82
|
-
});
|
|
83
|
-
const DefaultTriggerNotificationParameters = PositionLegParameters.safeExtend({
|
|
84
|
-
type: z.literal("default_trigger"),
|
|
85
|
-
triggerId: z.uuid(),
|
|
86
|
-
connector: Connector,
|
|
87
|
-
...TriggerNotificationEnrichment
|
|
88
|
-
});
|
|
89
|
-
const AttachedTriggerDiscardedNotificationParameters = PositionLegParameters.safeExtend({
|
|
90
|
-
type: z.literal("attached_trigger_discarded"),
|
|
91
|
-
positionId: z.uuid(),
|
|
92
|
-
positionKey: z.string().min(1),
|
|
93
|
-
connector: Connector,
|
|
94
|
-
discarded: z.array(z.object({
|
|
95
|
-
bracketType: z.enum([
|
|
96
|
-
"STOP_LOSS",
|
|
97
|
-
"TAKE_PROFIT"
|
|
98
|
-
]),
|
|
99
|
-
metric: NotificationMetric,
|
|
100
|
-
level: z.number().optional(),
|
|
101
|
-
reason: z.enum([
|
|
102
|
-
"TRIGGER_LIMIT",
|
|
103
|
-
"TRAILING_ALREADY_EXISTS"
|
|
104
|
-
])
|
|
105
|
-
})).min(1),
|
|
106
|
-
activeTriggerLimit: z.number().int().positive()
|
|
107
|
-
});
|
|
108
|
-
const AutoRebalanceLeg = z.object({
|
|
109
|
-
id: z.string().min(1),
|
|
110
|
-
symbol: z.string().min(1),
|
|
111
|
-
side: Side
|
|
112
|
-
});
|
|
113
|
-
const AutoRebalanceAnchor = {
|
|
114
|
-
configId: z.uuid(),
|
|
115
|
-
positionId: z.uuid(),
|
|
116
|
-
positionKey: z.string().min(1),
|
|
117
|
-
connector: Connector,
|
|
118
|
-
weightSource: z.enum([
|
|
119
|
-
"INITIAL_WEIGHT",
|
|
120
|
-
"LIVE_BETA"
|
|
121
|
-
])
|
|
122
|
-
};
|
|
123
|
-
const AutoRebalanceRunLegs = z.array(AutoRebalanceLeg.safeExtend({
|
|
124
|
-
currentWeight: z.number(),
|
|
125
|
-
targetWeight: z.number()
|
|
126
|
-
}));
|
|
127
|
-
const AutoRebalanceExecutedNotificationParameters = z.object({
|
|
128
|
-
type: z.literal("auto_rebalance_executed"),
|
|
129
|
-
...AutoRebalanceAnchor,
|
|
130
|
-
legs: AutoRebalanceRunLegs,
|
|
131
|
-
driftPct: z.number(),
|
|
132
|
-
notionalUsd: z.number()
|
|
133
|
-
});
|
|
134
|
-
const AutoRebalanceFailedNotificationParameters = z.object({
|
|
135
|
-
type: z.literal("auto_rebalance_failed"),
|
|
136
|
-
...AutoRebalanceAnchor,
|
|
137
|
-
legs: AutoRebalanceRunLegs,
|
|
138
|
-
driftPct: z.number(),
|
|
139
|
-
reason: z.string().max(255)
|
|
140
|
-
});
|
|
141
|
-
const AutoRebalancePausedNotificationParameters = z.object({
|
|
142
|
-
type: z.literal("auto_rebalance_paused"),
|
|
143
|
-
...AutoRebalanceAnchor,
|
|
144
|
-
legs: z.array(AutoRebalanceLeg),
|
|
145
|
-
pausedReason: z.enum([
|
|
146
|
-
"POSITION_CHANGED",
|
|
147
|
-
"REPEATED_FAILURES",
|
|
148
|
-
"INVALID_LIVE_BETA_EXPOSURE"
|
|
149
|
-
])
|
|
150
|
-
});
|
|
151
|
-
const TriggerCancelledMisScaledNotificationParameters = z.object({
|
|
152
|
-
type: z.literal("trigger_cancelled_mis_scaled"),
|
|
153
|
-
triggerId: z.uuid(),
|
|
154
|
-
positionKey: z.string().min(1),
|
|
155
|
-
storedBps: z.number(),
|
|
156
|
-
readingMarginPct: z.number()
|
|
157
|
-
});
|
|
158
|
-
const TriggerTWAPNotificationAnchor = PositionLegParameters.safeExtend({
|
|
159
|
-
triggerId: z.uuid(),
|
|
160
|
-
positionId: z.uuid(),
|
|
161
|
-
connector: Connector
|
|
162
|
-
});
|
|
163
|
-
const TriggerTWAPStartedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
164
|
-
type: z.literal("trigger_twap_started"),
|
|
165
|
-
scheduleId: z.uuid()
|
|
166
|
-
});
|
|
167
|
-
const TriggerTWAPSkippedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
168
|
-
type: z.literal("trigger_twap_skipped"),
|
|
169
|
-
reason: z.string().min(1).max(255)
|
|
170
|
-
});
|
|
171
|
-
const TriggerTWAPFailedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
172
|
-
type: z.literal("trigger_twap_failed"),
|
|
173
|
-
scheduleId: z.uuid().optional(),
|
|
174
|
-
reason: z.string().min(1).max(255)
|
|
175
|
-
});
|
|
176
|
-
const TriggerTWAPPositionChangedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
177
|
-
type: z.literal("trigger_twap_position_changed"),
|
|
178
|
-
scheduleId: z.uuid(),
|
|
179
|
-
reason: z.string().min(1).max(255)
|
|
180
|
-
});
|
|
181
|
-
const CopyPlacedNotificationParameters = z.object({
|
|
182
|
-
type: z.literal("copy_placed"),
|
|
183
|
-
subscriptionId: z.uuid(),
|
|
184
|
-
activityId: z.uuid(),
|
|
185
|
-
resource: z.object({
|
|
186
|
-
kind: z.literal("POSITION"),
|
|
187
|
-
id: z.uuid()
|
|
188
|
-
}),
|
|
189
|
-
leaderTradeAccountId: z.uuid()
|
|
190
|
-
});
|
|
191
|
-
const CopyFailedNotificationParameters = z.object({
|
|
192
|
-
type: z.literal("copy_failed"),
|
|
193
|
-
subscriptionId: z.uuid(),
|
|
194
|
-
activityId: z.uuid(),
|
|
195
|
-
reason: z.string().max(255)
|
|
196
|
-
});
|
|
197
|
-
const CopySubscriptionStoppedNotificationParameters = z.object({
|
|
198
|
-
type: z.literal("copy_subscription_stopped"),
|
|
199
|
-
subscriptionId: z.uuid(),
|
|
200
|
-
reason: z.enum([
|
|
201
|
-
"REPEATED_FAILURES",
|
|
202
|
-
"MANUAL_TRADE",
|
|
203
|
-
"EXTERNAL_POSITION_DETECTED",
|
|
204
|
-
"LEADER_EXTERNAL_ACTIVITY"
|
|
205
|
-
])
|
|
206
|
-
});
|
|
207
|
-
const CopyLeverageNotAppliedNotificationParameters = z.object({
|
|
208
|
-
type: z.literal("copy_leverage_not_applied"),
|
|
209
|
-
subscriptionId: z.uuid(),
|
|
210
|
-
activityId: z.uuid()
|
|
211
|
-
});
|
|
212
|
-
const PositionLiquidationNotificationParameters = z.object({
|
|
213
|
-
type: z.literal("position_liquidation"),
|
|
214
|
-
positionId: z.uuid(),
|
|
215
|
-
tradeAccountId: z.uuid(),
|
|
216
|
-
connector: Connector,
|
|
217
|
-
exchangeFillId: z.string().min(1),
|
|
218
|
-
occurredAt: z.number().int().nonnegative(),
|
|
219
|
-
leg: TriggerNotificationLeg,
|
|
220
|
-
quantity: UnsignedDecimalString,
|
|
221
|
-
price: UnsignedDecimalString,
|
|
222
|
-
outcome: z.enum([
|
|
223
|
-
"CLOSED",
|
|
224
|
-
"REDUCED"
|
|
225
|
-
])
|
|
226
|
-
});
|
|
227
|
-
const NotificationParameters = z.discriminatedUnion("type", [
|
|
228
|
-
PositionLiquidationNotificationParameters,
|
|
229
|
-
TakeProfitNotificationParameters,
|
|
230
|
-
StopLossNotificationParameters,
|
|
231
|
-
TriggerOrderNotificationParameters,
|
|
232
|
-
DefaultTriggerNotificationParameters,
|
|
233
|
-
AttachedTriggerDiscardedNotificationParameters,
|
|
234
|
-
AutoRebalanceExecutedNotificationParameters,
|
|
235
|
-
AutoRebalanceFailedNotificationParameters,
|
|
236
|
-
AutoRebalancePausedNotificationParameters,
|
|
237
|
-
TriggerTWAPStartedNotificationParameters,
|
|
238
|
-
TriggerTWAPSkippedNotificationParameters,
|
|
239
|
-
TriggerTWAPFailedNotificationParameters,
|
|
240
|
-
TriggerTWAPPositionChangedNotificationParameters,
|
|
241
|
-
TriggerCancelledMisScaledNotificationParameters,
|
|
242
|
-
CopyPlacedNotificationParameters,
|
|
243
|
-
CopyFailedNotificationParameters,
|
|
244
|
-
CopySubscriptionStoppedNotificationParameters,
|
|
245
|
-
CopyLeverageNotAppliedNotificationParameters
|
|
246
|
-
]);
|
|
247
|
-
const Notification = z.object({
|
|
248
|
-
/**
|
|
249
|
-
* Notification UUID
|
|
250
|
-
*/
|
|
251
|
-
id: z.uuid(),
|
|
252
|
-
/**
|
|
253
|
-
* What kind of notification this is
|
|
254
|
-
*/
|
|
255
|
-
category: NotificationCategory,
|
|
256
|
-
/**
|
|
257
|
-
* Category-specific display payload
|
|
258
|
-
*/
|
|
259
|
-
parameters: NotificationParameters,
|
|
260
|
-
/**
|
|
261
|
-
* Whether the user has read it
|
|
262
|
-
*/
|
|
263
|
-
isRead: z.boolean(),
|
|
264
|
-
/**
|
|
265
|
-
* Created at timestamp
|
|
266
|
-
*/
|
|
267
|
-
createdAt: z.string(),
|
|
268
|
-
/**
|
|
269
|
-
* Updated at timestamp
|
|
270
|
-
*/
|
|
271
|
-
updatedAt: z.string()
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
export { Notification, NotificationCategory, NotificationMetric, NotificationParameters };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const MarkNotificationsReadPayload = z.union([
|
|
4
|
-
z.strictObject({
|
|
5
|
-
id: z.uuid()
|
|
6
|
-
}),
|
|
7
|
-
z.strictObject({
|
|
8
|
-
timestamp: z.coerce.number().int().positive()
|
|
9
|
-
})
|
|
10
|
-
]);
|
|
11
|
-
const MarkNotificationUnreadPayload = z.strictObject({
|
|
12
|
-
id: z.uuid()
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export { MarkNotificationUnreadPayload, MarkNotificationsReadPayload };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const NotificationListParams = z.object({
|
|
4
|
-
/**
|
|
5
|
-
* The maximum number of notifications to retrieve (newest first).
|
|
6
|
-
* Matches the V2 engine: max and default are both 100.
|
|
7
|
-
*/
|
|
8
|
-
limit: z.coerce.number().int().positive().max(100).optional().default(100),
|
|
9
|
-
/**
|
|
10
|
-
* Only return notifications created at or after this date.
|
|
11
|
-
*/
|
|
12
|
-
startDate: z.coerce.date().optional(),
|
|
13
|
-
/**
|
|
14
|
-
* Only return notifications created at or before this date.
|
|
15
|
-
*/
|
|
16
|
-
endDate: z.coerce.date().optional(),
|
|
17
|
-
/**
|
|
18
|
-
* Filter by read state: `all` (default), only `read`, or only `unread`.
|
|
19
|
-
*/
|
|
20
|
-
scope: z.enum([
|
|
21
|
-
"all",
|
|
22
|
-
"read",
|
|
23
|
-
"unread"
|
|
24
|
-
]).optional().default("all")
|
|
25
|
-
}).refine((data) => !data.startDate || !data.endDate || data.startDate < data.endDate, {
|
|
26
|
-
message: "startDate must be before endDate"
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export { NotificationListParams };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Notification } from './entities';
|
|
3
|
-
|
|
4
|
-
const NotificationListResponse = z.object({
|
|
5
|
-
notifications: z.array(Notification)
|
|
6
|
-
});
|
|
7
|
-
const MarkNotificationsReadResponse = z.object({
|
|
8
|
-
/**
|
|
9
|
-
* How many notifications were flipped from unread to read.
|
|
10
|
-
*/
|
|
11
|
-
updated: z.number().int()
|
|
12
|
-
});
|
|
13
|
-
const MarkNotificationUnreadResponse = z.object({
|
|
14
|
-
/**
|
|
15
|
-
* How many notifications were flipped from read to unread.
|
|
16
|
-
*/
|
|
17
|
-
updated: z.number().int()
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { MarkNotificationUnreadResponse, MarkNotificationsReadResponse, NotificationListResponse };
|
package/dist/order/entities.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { UnsignedDecimalString, Side } from '../common/schema';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
import { InstrumentId } from '../instrument';
|
|
5
|
-
|
|
6
|
-
const OrderStatus = z.enum([
|
|
7
|
-
"PENDING",
|
|
8
|
-
"PARTIAL",
|
|
9
|
-
"FILLED",
|
|
10
|
-
"CANCELLED",
|
|
11
|
-
"REJECTED"
|
|
12
|
-
]);
|
|
13
|
-
const BaseOrder = z.object({
|
|
14
|
-
/**
|
|
15
|
-
* Order UUID
|
|
16
|
-
*/
|
|
17
|
-
id: z.uuid(),
|
|
18
|
-
/**
|
|
19
|
-
* Connector
|
|
20
|
-
*/
|
|
21
|
-
connector: Connector,
|
|
22
|
-
/**
|
|
23
|
-
* Order status
|
|
24
|
-
*/
|
|
25
|
-
status: OrderStatus,
|
|
26
|
-
/**
|
|
27
|
-
* Error message
|
|
28
|
-
*/
|
|
29
|
-
error: z.string().optional(),
|
|
30
|
-
/**
|
|
31
|
-
* Venue-specific error code for the failure, when the venue provided one
|
|
32
|
-
*/
|
|
33
|
-
errorCode: z.string().optional(),
|
|
34
|
-
/**
|
|
35
|
-
* Created at timestamp
|
|
36
|
-
*/
|
|
37
|
-
createdAt: z.string(),
|
|
38
|
-
/**
|
|
39
|
-
* Updated at timestamp
|
|
40
|
-
*/
|
|
41
|
-
updatedAt: z.string()
|
|
42
|
-
});
|
|
43
|
-
const MarketOrder = BaseOrder.extend({
|
|
44
|
-
/**
|
|
45
|
-
* Order type
|
|
46
|
-
*/
|
|
47
|
-
type: z.literal("MARKET"),
|
|
48
|
-
/**
|
|
49
|
-
* Instrument ID
|
|
50
|
-
*/
|
|
51
|
-
symbol: InstrumentId,
|
|
52
|
-
/**
|
|
53
|
-
* Side
|
|
54
|
-
*/
|
|
55
|
-
side: Side,
|
|
56
|
-
/**
|
|
57
|
-
* Reduce only flag
|
|
58
|
-
*/
|
|
59
|
-
reduceOnly: z.boolean(),
|
|
60
|
-
/**
|
|
61
|
-
* Contract quantity to trade
|
|
62
|
-
*/
|
|
63
|
-
quantity: UnsignedDecimalString,
|
|
64
|
-
/**
|
|
65
|
-
* Price
|
|
66
|
-
*/
|
|
67
|
-
price: UnsignedDecimalString,
|
|
68
|
-
/**
|
|
69
|
-
* Filled contract quantity
|
|
70
|
-
*/
|
|
71
|
-
filledQuantity: UnsignedDecimalString,
|
|
72
|
-
/**
|
|
73
|
-
* Filled price
|
|
74
|
-
*/
|
|
75
|
-
filledPrice: UnsignedDecimalString.optional()
|
|
76
|
-
});
|
|
77
|
-
const Order = z.discriminatedUnion("type", [
|
|
78
|
-
BaseOrder.extend(MarketOrder.shape)
|
|
79
|
-
]);
|
|
80
|
-
|
|
81
|
-
export { MarketOrder, Order, OrderStatus };
|
package/dist/order/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './entities';
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const NullableNumber = z.number().nullable();
|
|
4
|
-
const PortfolioCashflowAmounts = z.object({
|
|
5
|
-
grossPnl: z.number(),
|
|
6
|
-
tradeFees: z.number(),
|
|
7
|
-
pearFees: z.number(),
|
|
8
|
-
netCashflow: z.number(),
|
|
9
|
-
funding: z.number(),
|
|
10
|
-
netCashflowWithFunding: z.number(),
|
|
11
|
-
undeterminedQuantityByAsset: z.record(z.string(), z.number())
|
|
12
|
-
});
|
|
13
|
-
const PortfolioCashflowSeriesPoint = PortfolioCashflowAmounts.extend({
|
|
14
|
-
periodStart: z.string(),
|
|
15
|
-
periodEnd: z.string()
|
|
16
|
-
});
|
|
17
|
-
const PortfolioCashflowIntervals = z.object({
|
|
18
|
-
oneDay: z.array(PortfolioCashflowSeriesPoint),
|
|
19
|
-
oneWeek: z.array(PortfolioCashflowSeriesPoint),
|
|
20
|
-
oneMonth: z.array(PortfolioCashflowSeriesPoint),
|
|
21
|
-
oneYear: z.array(PortfolioCashflowSeriesPoint),
|
|
22
|
-
all: z.array(PortfolioCashflowSeriesPoint)
|
|
23
|
-
});
|
|
24
|
-
const PortfolioVolumeAmounts = z.object({
|
|
25
|
-
total: z.number()
|
|
26
|
-
});
|
|
27
|
-
const PortfolioVolumeSeriesPoint = z.object({
|
|
28
|
-
periodStart: z.string(),
|
|
29
|
-
periodEnd: z.string(),
|
|
30
|
-
volume: z.number()
|
|
31
|
-
});
|
|
32
|
-
const PortfolioVolumeIntervals = z.object({
|
|
33
|
-
oneDay: z.array(PortfolioVolumeSeriesPoint),
|
|
34
|
-
oneWeek: z.array(PortfolioVolumeSeriesPoint),
|
|
35
|
-
oneMonth: z.array(PortfolioVolumeSeriesPoint),
|
|
36
|
-
oneYear: z.array(PortfolioVolumeSeriesPoint),
|
|
37
|
-
all: z.array(PortfolioVolumeSeriesPoint)
|
|
38
|
-
});
|
|
39
|
-
const PortfolioClosedPositionStats = z.object({
|
|
40
|
-
totalPositions: z.number(),
|
|
41
|
-
wins: z.number(),
|
|
42
|
-
losses: z.number(),
|
|
43
|
-
hitRate: NullableNumber,
|
|
44
|
-
profitFactor: NullableNumber,
|
|
45
|
-
avgWinSize: NullableNumber,
|
|
46
|
-
avgLossSize: NullableNumber,
|
|
47
|
-
netPnl: z.number(),
|
|
48
|
-
positionPnls: z.array(z.number()),
|
|
49
|
-
positionReturns: z.array(z.number())
|
|
50
|
-
});
|
|
51
|
-
const PortfolioPairBreakdown = z.object({
|
|
52
|
-
key: z.string(),
|
|
53
|
-
longAssets: z.array(z.string()),
|
|
54
|
-
shortAssets: z.array(z.string()),
|
|
55
|
-
positions: z.number(),
|
|
56
|
-
wins: z.number(),
|
|
57
|
-
losses: z.number(),
|
|
58
|
-
hitRate: NullableNumber,
|
|
59
|
-
profitFactor: NullableNumber,
|
|
60
|
-
expectancy: z.number(),
|
|
61
|
-
grossPnl: z.number(),
|
|
62
|
-
tradeFees: z.number(),
|
|
63
|
-
pearFees: z.number(),
|
|
64
|
-
netPnl: z.number(),
|
|
65
|
-
// Signed share of closed-position net PnL; null when the closed book is zero.
|
|
66
|
-
bookPercent: NullableNumber
|
|
67
|
-
});
|
|
68
|
-
const PortfolioOpenSnapshot = z.object({
|
|
69
|
-
openInterest: z.number(),
|
|
70
|
-
unrealizedPnl: z.number()
|
|
71
|
-
});
|
|
72
|
-
const PortfolioAnalyticsConfig = z.object({
|
|
73
|
-
startDate: z.string(),
|
|
74
|
-
endDate: z.string()
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export { NullableNumber, PortfolioAnalyticsConfig, PortfolioCashflowAmounts, PortfolioCashflowIntervals, PortfolioCashflowSeriesPoint, PortfolioClosedPositionStats, PortfolioOpenSnapshot, PortfolioPairBreakdown, PortfolioVolumeAmounts, PortfolioVolumeIntervals, PortfolioVolumeSeriesPoint };
|
package/dist/portfolio/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const PortfolioSource = z.enum([
|
|
4
|
-
"all",
|
|
5
|
-
"pear"
|
|
6
|
-
]);
|
|
7
|
-
const PortfolioQuery = z.object({
|
|
8
|
-
startDate: z.string().optional().describe("Inclusive portfolio range start."),
|
|
9
|
-
endDate: z.string().optional().describe("Exclusive portfolio range end."),
|
|
10
|
-
// "pear" excludes external imported fills from volume calculations.
|
|
11
|
-
source: PortfolioSource.optional().default("all")
|
|
12
|
-
});
|
|
13
|
-
const PortfolioAnalyticsInterval = z.enum([
|
|
14
|
-
"1d",
|
|
15
|
-
"1w",
|
|
16
|
-
"1m",
|
|
17
|
-
"1y",
|
|
18
|
-
"all"
|
|
19
|
-
]);
|
|
20
|
-
const PortfolioAnalyticsQuery = z.object({
|
|
21
|
-
startDate: z.string().optional().describe("Inclusive analytics range start."),
|
|
22
|
-
endDate: z.string().optional().describe("Exclusive analytics range end."),
|
|
23
|
-
interval: PortfolioAnalyticsInterval.optional(),
|
|
24
|
-
includeSeries: z.union([
|
|
25
|
-
z.boolean(),
|
|
26
|
-
z.enum([
|
|
27
|
-
"false",
|
|
28
|
-
"true"
|
|
29
|
-
]).transform((value) => value === "true")
|
|
30
|
-
]).optional(),
|
|
31
|
-
source: PortfolioSource.optional().default("all")
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export { PortfolioAnalyticsInterval, PortfolioAnalyticsQuery, PortfolioQuery, PortfolioSource };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PortfolioOpenSnapshot, PortfolioClosedPositionStats, PortfolioVolumeAmounts, PortfolioVolumeIntervals, PortfolioCashflowAmounts, PortfolioCashflowIntervals, PortfolioAnalyticsConfig, PortfolioVolumeSeriesPoint, PortfolioPairBreakdown, PortfolioCashflowSeriesPoint } from './entities';
|
|
3
|
-
|
|
4
|
-
const PortfolioResponse = z.object({
|
|
5
|
-
/** Historical accounting or the current open snapshot still uses provisional fills. */
|
|
6
|
-
hasProvisionalFills: z.boolean(),
|
|
7
|
-
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
8
|
-
fundingSynced: z.boolean(),
|
|
9
|
-
intervals: PortfolioCashflowIntervals.optional()
|
|
10
|
-
}),
|
|
11
|
-
closedPositionStats: PortfolioClosedPositionStats,
|
|
12
|
-
openSnapshot: PortfolioOpenSnapshot,
|
|
13
|
-
volume: PortfolioVolumeAmounts.extend({
|
|
14
|
-
intervals: PortfolioVolumeIntervals.optional()
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
const PortfolioAnalyticsResponse = z.object({
|
|
18
|
-
config: PortfolioAnalyticsConfig,
|
|
19
|
-
/** Historical accounting or the current open snapshot still uses provisional fills. */
|
|
20
|
-
hasProvisionalFills: z.boolean(),
|
|
21
|
-
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
22
|
-
fundingSynced: z.boolean(),
|
|
23
|
-
series: z.array(PortfolioCashflowSeriesPoint).optional()
|
|
24
|
-
}),
|
|
25
|
-
closedPositionStats: PortfolioClosedPositionStats,
|
|
26
|
-
pairBreakdown: z.array(PortfolioPairBreakdown),
|
|
27
|
-
openSnapshot: PortfolioOpenSnapshot,
|
|
28
|
-
volume: PortfolioVolumeAmounts.extend({
|
|
29
|
-
series: z.array(PortfolioVolumeSeriesPoint).optional()
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export { PortfolioAnalyticsResponse, PortfolioResponse };
|