@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,196 +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
|
-
import { Order } from '../order';
|
|
6
|
-
import { Position } from '../position';
|
|
7
|
-
|
|
8
|
-
const ExecutionIntent = z.enum([
|
|
9
|
-
"OPEN",
|
|
10
|
-
"CLOSE",
|
|
11
|
-
"ADJUST",
|
|
12
|
-
"REVERSE"
|
|
13
|
-
]);
|
|
14
|
-
const ExecutionOrderType = z.enum([
|
|
15
|
-
"MARKET"
|
|
16
|
-
]);
|
|
17
|
-
const ExecutionStatus = z.enum([
|
|
18
|
-
"IDLE",
|
|
19
|
-
"ACTIVE",
|
|
20
|
-
"COMPLETED",
|
|
21
|
-
"FAILED",
|
|
22
|
-
"CANCELLED"
|
|
23
|
-
]);
|
|
24
|
-
const ExecutionFulfillment = z.enum([
|
|
25
|
-
"COMPLETE",
|
|
26
|
-
"PARTIAL",
|
|
27
|
-
"NONE",
|
|
28
|
-
"PENDING"
|
|
29
|
-
]);
|
|
30
|
-
const ExecutionLegMode = z.enum([
|
|
31
|
-
"QUANTITY",
|
|
32
|
-
"USD"
|
|
33
|
-
]);
|
|
34
|
-
const ExecutionLeg = z.object({
|
|
35
|
-
/** SYMBOL-MIGRATION switch-to-id: mirrors `symbol` today; becomes required once requests always carry `id`. */
|
|
36
|
-
id: InstrumentId.optional(),
|
|
37
|
-
/**
|
|
38
|
-
* Instrument ID
|
|
39
|
-
*/
|
|
40
|
-
symbol: InstrumentId,
|
|
41
|
-
/**
|
|
42
|
-
* Side
|
|
43
|
-
*/
|
|
44
|
-
side: Side,
|
|
45
|
-
/**
|
|
46
|
-
* Mode to interpret the amount
|
|
47
|
-
*/
|
|
48
|
-
mode: ExecutionLegMode,
|
|
49
|
-
/**
|
|
50
|
-
* Quantity or USD amount
|
|
51
|
-
*/
|
|
52
|
-
amount: UnsignedDecimalString,
|
|
53
|
-
/**
|
|
54
|
-
* Optional worst acceptable execution price; replaces the slippage-derived price when present
|
|
55
|
-
*/
|
|
56
|
-
maxImpactPrice: UnsignedDecimalString.optional(),
|
|
57
|
-
/**
|
|
58
|
-
* Reduce only flag
|
|
59
|
-
*/
|
|
60
|
-
reduceOnly: z.boolean()
|
|
61
|
-
});
|
|
62
|
-
const BaseExecution = z.object({
|
|
63
|
-
/**
|
|
64
|
-
* Execution UUID
|
|
65
|
-
*/
|
|
66
|
-
id: z.uuid(),
|
|
67
|
-
/**
|
|
68
|
-
* Connector
|
|
69
|
-
*/
|
|
70
|
-
connector: Connector,
|
|
71
|
-
/**
|
|
72
|
-
* Intent
|
|
73
|
-
*/
|
|
74
|
-
intent: ExecutionIntent,
|
|
75
|
-
/**
|
|
76
|
-
* Order type
|
|
77
|
-
*/
|
|
78
|
-
orderType: ExecutionOrderType,
|
|
79
|
-
/**
|
|
80
|
-
* Status
|
|
81
|
-
*/
|
|
82
|
-
status: ExecutionStatus,
|
|
83
|
-
/**
|
|
84
|
-
* Error message
|
|
85
|
-
*/
|
|
86
|
-
error: z.string().optional(),
|
|
87
|
-
/**
|
|
88
|
-
* Created at timestamp
|
|
89
|
-
*/
|
|
90
|
-
createdAt: z.string(),
|
|
91
|
-
/**
|
|
92
|
-
* Updated at timestamp
|
|
93
|
-
*/
|
|
94
|
-
updatedAt: z.string(),
|
|
95
|
-
/**
|
|
96
|
-
* Orders
|
|
97
|
-
*/
|
|
98
|
-
orders: z.array(Order).optional(),
|
|
99
|
-
/**
|
|
100
|
-
* Filled-quantity outcome across this execution's orders; absent when the server does not
|
|
101
|
-
* publish it. It never claims venue-side certainty, only what the order rows report filled.
|
|
102
|
-
*/
|
|
103
|
-
fulfillment: ExecutionFulfillment.optional()
|
|
104
|
-
});
|
|
105
|
-
const MarketOpenExecution = BaseExecution.extend({
|
|
106
|
-
/**
|
|
107
|
-
* Intent
|
|
108
|
-
*/
|
|
109
|
-
intent: z.literal("OPEN"),
|
|
110
|
-
/**
|
|
111
|
-
* Order type
|
|
112
|
-
*/
|
|
113
|
-
orderType: z.literal("MARKET"),
|
|
114
|
-
/**
|
|
115
|
-
* Position opened by this execution; absent when the position link was severed (a FAILED
|
|
116
|
-
* execution unlinks its position). Id only: an open carries no exposure snapshot, so read
|
|
117
|
-
* the position itself for its exposure.
|
|
118
|
-
*/
|
|
119
|
-
position: Position.pick({
|
|
120
|
-
id: true
|
|
121
|
-
}).optional(),
|
|
122
|
-
/**
|
|
123
|
-
* Requested legs
|
|
124
|
-
*/
|
|
125
|
-
legs: z.tuple([
|
|
126
|
-
ExecutionLeg
|
|
127
|
-
]).rest(ExecutionLeg)
|
|
128
|
-
});
|
|
129
|
-
const MarketAdjustExecution = BaseExecution.extend({
|
|
130
|
-
/**
|
|
131
|
-
* Intent
|
|
132
|
-
*/
|
|
133
|
-
intent: z.literal("ADJUST"),
|
|
134
|
-
/**
|
|
135
|
-
* Order type
|
|
136
|
-
*/
|
|
137
|
-
orderType: z.literal("MARKET"),
|
|
138
|
-
/**
|
|
139
|
-
* Position; absent when the position link was severed (a FAILED execution unlinks its position)
|
|
140
|
-
*/
|
|
141
|
-
position: Position.pick({
|
|
142
|
-
id: true,
|
|
143
|
-
exposure: true
|
|
144
|
-
}).optional(),
|
|
145
|
-
/**
|
|
146
|
-
* Requested legs
|
|
147
|
-
*/
|
|
148
|
-
legs: z.tuple([
|
|
149
|
-
ExecutionLeg
|
|
150
|
-
]).rest(ExecutionLeg)
|
|
151
|
-
});
|
|
152
|
-
const MarketCloseExecution = BaseExecution.extend({
|
|
153
|
-
/**
|
|
154
|
-
* Intent
|
|
155
|
-
*/
|
|
156
|
-
intent: z.literal("CLOSE"),
|
|
157
|
-
/**
|
|
158
|
-
* Order type
|
|
159
|
-
*/
|
|
160
|
-
orderType: z.literal("MARKET"),
|
|
161
|
-
/**
|
|
162
|
-
* Position; absent when the position link was severed (a FAILED execution unlinks its position)
|
|
163
|
-
*/
|
|
164
|
-
position: Position.pick({
|
|
165
|
-
id: true,
|
|
166
|
-
exposure: true
|
|
167
|
-
}).optional()
|
|
168
|
-
});
|
|
169
|
-
const MarketReverseExecution = BaseExecution.extend({
|
|
170
|
-
/**
|
|
171
|
-
* Intent
|
|
172
|
-
*/
|
|
173
|
-
intent: z.literal("REVERSE"),
|
|
174
|
-
/**
|
|
175
|
-
* Order type
|
|
176
|
-
*/
|
|
177
|
-
orderType: z.literal("MARKET"),
|
|
178
|
-
/**
|
|
179
|
-
* Position; absent when the position link was severed (a FAILED execution unlinks its position)
|
|
180
|
-
*/
|
|
181
|
-
position: Position.pick({
|
|
182
|
-
id: true,
|
|
183
|
-
exposure: true
|
|
184
|
-
}).optional()
|
|
185
|
-
});
|
|
186
|
-
const MarketExecution = z.discriminatedUnion("intent", [
|
|
187
|
-
MarketOpenExecution,
|
|
188
|
-
MarketAdjustExecution,
|
|
189
|
-
MarketCloseExecution,
|
|
190
|
-
MarketReverseExecution
|
|
191
|
-
]);
|
|
192
|
-
const Execution = z.discriminatedUnion("orderType", [
|
|
193
|
-
MarketExecution
|
|
194
|
-
]);
|
|
195
|
-
|
|
196
|
-
export { BaseExecution, Execution, ExecutionFulfillment, ExecutionIntent, ExecutionLegMode, ExecutionOrderType, ExecutionStatus, MarketAdjustExecution, MarketCloseExecution, MarketExecution, MarketOpenExecution, MarketReverseExecution };
|
package/dist/execution/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { normalizeArray, CursorFindParams } from '../common';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
|
|
5
|
-
const StatusEnum = z.enum([
|
|
6
|
-
"ACTIVE",
|
|
7
|
-
"COMPLETED",
|
|
8
|
-
"CANCELLED"
|
|
9
|
-
]);
|
|
10
|
-
const StatusArray = z.preprocess((arg) => normalizeArray(arg), z.array(StatusEnum));
|
|
11
|
-
const ExecutionListParams = CursorFindParams.extend({
|
|
12
|
-
connector: Connector.optional(),
|
|
13
|
-
status: StatusArray.optional(),
|
|
14
|
-
includeSchedule: z.coerce.boolean().optional().default(false),
|
|
15
|
-
includeTriggers: z.coerce.boolean().optional().default(false)
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { ExecutionListParams };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CursorResponse } from '../common';
|
|
3
|
-
import { Execution } from './entities';
|
|
4
|
-
|
|
5
|
-
const ExecutionListResponse = CursorResponse.extend({
|
|
6
|
-
executions: z.array(Execution)
|
|
7
|
-
});
|
|
8
|
-
const GetExecutionResponse = z.object({
|
|
9
|
-
execution: Execution
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export { ExecutionListResponse, GetExecutionResponse };
|
package/dist/fee/entities.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Connector } from '../connector';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
const MAX_FEE_BPS = 10;
|
|
7
|
-
const FeeOverrideScope = z.enum([
|
|
8
|
-
"user",
|
|
9
|
-
"client_id"
|
|
10
|
-
]);
|
|
11
|
-
const FeeDiscountScope = z.enum([
|
|
12
|
-
"user",
|
|
13
|
-
"client_id",
|
|
14
|
-
"connector",
|
|
15
|
-
"all"
|
|
16
|
-
]);
|
|
17
|
-
const FeeConnector = z.enum(Connector.options);
|
|
18
|
-
const FeeRole = z.enum([
|
|
19
|
-
"basic",
|
|
20
|
-
"pro",
|
|
21
|
-
"vault"
|
|
22
|
-
]);
|
|
23
|
-
const FeeBps = z.string().regex(/^\d{1,2}(\.\d)?$/, "Fee bps must be a decimal with at most one decimal place").refine((value) => Number(value) <= MAX_FEE_BPS, `Fee bps must not exceed ${MAX_FEE_BPS}`);
|
|
24
|
-
const DiscountRate = z.string().regex(/^(0(\.\d{1,4})?|1(\.0{1,4})?)$/, 'Discount rate must be a fraction from 0 to 1, e.g. "0.2" for 20% off');
|
|
25
|
-
const ORDERED_VALIDITY_WINDOW_MESSAGE = "endsAt must be later than startsAt";
|
|
26
|
-
function hasOrderedValidityWindow(window) {
|
|
27
|
-
if (!window.startsAt || !window.endsAt) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
return new Date(window.startsAt).getTime() < new Date(window.endsAt).getTime();
|
|
31
|
-
}
|
|
32
|
-
__name(hasOrderedValidityWindow, "hasOrderedValidityWindow");
|
|
33
|
-
|
|
34
|
-
export { DiscountRate, FeeBps, FeeConnector, FeeDiscountScope, FeeOverrideScope, FeeRole, MAX_FEE_BPS, ORDERED_VALIDITY_WINDOW_MESSAGE, hasOrderedValidityWindow };
|
package/dist/fee/index.js
DELETED
package/dist/fee/queries.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ClientIdCode } from '../common/client-id';
|
|
3
|
-
import { FeeConnector } from './entities';
|
|
4
|
-
|
|
5
|
-
const QuoteFeeParams = z.object({
|
|
6
|
-
clientId: ClientIdCode
|
|
7
|
-
});
|
|
8
|
-
const GetFeeRecipientParams = z.object({
|
|
9
|
-
connector: FeeConnector
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export { GetFeeRecipientParams, QuoteFeeParams };
|
package/dist/fee/responses.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { DiscountRate, FeeDiscountScope, FeeBps, FeeOverrideScope } from './entities';
|
|
3
|
-
|
|
4
|
-
const AppliedFeeDiscount = z.object({
|
|
5
|
-
scope: FeeDiscountScope,
|
|
6
|
-
rate: DiscountRate
|
|
7
|
-
}).describe("A discount applied to the quoted fee");
|
|
8
|
-
const FeeResponse = z.object({
|
|
9
|
-
// Connector-native fee recipient; absent means the order names none, so it carries no fee
|
|
10
|
-
feeRecipient: z.string().optional(),
|
|
11
|
-
// The (role, connector) rate the quote started from
|
|
12
|
-
baseBps: FeeBps,
|
|
13
|
-
// The rate that replaced the base; absent when no override matched
|
|
14
|
-
overrideBps: FeeBps.optional(),
|
|
15
|
-
// Which scope that override came from
|
|
16
|
-
overrideScope: FeeOverrideScope.optional(),
|
|
17
|
-
// Every discount taken off the amount. Rates add up rather than compound, and the total is
|
|
18
|
-
// capped at 100%, so a deep stack floors the fee at zero.
|
|
19
|
-
discounts: z.array(AppliedFeeDiscount),
|
|
20
|
-
// What the trade actually pays. Always a multiple of 0.1 bps: resolution rounds up to that step
|
|
21
|
-
// so a discounted fee cannot shrink to nothing.
|
|
22
|
-
finalBps: FeeBps
|
|
23
|
-
}).describe("Resolved trading fee and connector fee recipient for the caller's trade account");
|
|
24
|
-
const FeeRecipientResponse = z.object({
|
|
25
|
-
// Connector-native recipient identifier (Hyperliquid builder address, Lighter integrator account index)
|
|
26
|
-
recipient: z.string().optional()
|
|
27
|
-
}).describe("Connector-native fee recipient to approve for the caller's role");
|
|
28
|
-
|
|
29
|
-
export { AppliedFeeDiscount, FeeRecipientResponse, FeeResponse };
|
package/dist/fill/entities.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Side } from '../common/schema';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
import { InstrumentId } from '../instrument';
|
|
5
|
-
|
|
6
|
-
const FillStatus = z.enum([
|
|
7
|
-
"PROVISIONAL",
|
|
8
|
-
"CONFIRMED",
|
|
9
|
-
"RECONCILED"
|
|
10
|
-
]);
|
|
11
|
-
const Fill = z.object({
|
|
12
|
-
/**
|
|
13
|
-
* Fill UUID
|
|
14
|
-
*/
|
|
15
|
-
id: z.uuid(),
|
|
16
|
-
/** Client order ID (abbreviated as cloid) */
|
|
17
|
-
cloid: z.string().optional(),
|
|
18
|
-
/** Exchange-native fill ID (tradeId / tid / etc) */
|
|
19
|
-
exchangeFillId: z.string().optional(),
|
|
20
|
-
/**
|
|
21
|
-
* Fill lifecycle status
|
|
22
|
-
*/
|
|
23
|
-
status: FillStatus,
|
|
24
|
-
/**
|
|
25
|
-
* Trade account UUID
|
|
26
|
-
*/
|
|
27
|
-
tradeAccountId: z.uuid(),
|
|
28
|
-
/**
|
|
29
|
-
* Instrument ID
|
|
30
|
-
*/
|
|
31
|
-
symbol: InstrumentId,
|
|
32
|
-
/**
|
|
33
|
-
* Position UUID
|
|
34
|
-
*/
|
|
35
|
-
positionId: z.uuid(),
|
|
36
|
-
/**
|
|
37
|
-
* Connector
|
|
38
|
-
*/
|
|
39
|
-
connector: Connector,
|
|
40
|
-
/**
|
|
41
|
-
* Side
|
|
42
|
-
*/
|
|
43
|
-
side: Side,
|
|
44
|
-
/**
|
|
45
|
-
* Reduce only flag
|
|
46
|
-
*/
|
|
47
|
-
reduceOnly: z.boolean(),
|
|
48
|
-
/** True when the fill was created from external sync. */
|
|
49
|
-
isExternal: z.boolean(),
|
|
50
|
-
/**
|
|
51
|
-
* True when the fill is a synthetic bridge fill (gap/gone reconstruction).
|
|
52
|
-
* Unpriceable gone-close synthetics carry "0" price/usd and should be displayed distinctly.
|
|
53
|
-
*/
|
|
54
|
-
synthetic: z.boolean(),
|
|
55
|
-
quantity: z.string(),
|
|
56
|
-
/** Filled price — "0" on an unpriceable gone-close synthetic (no price guessing). */
|
|
57
|
-
price: z.string(),
|
|
58
|
-
/** USD value — "0" on an unpriceable gone-close synthetic (cannot compute without price). */
|
|
59
|
-
usd: z.string(),
|
|
60
|
-
/**
|
|
61
|
-
* Trade fee paid
|
|
62
|
-
*/
|
|
63
|
-
tradeFee: z.string().optional(),
|
|
64
|
-
/**
|
|
65
|
-
* Pear fee paid
|
|
66
|
-
*/
|
|
67
|
-
pearFee: z.string().optional(),
|
|
68
|
-
/**
|
|
69
|
-
* Timestamp
|
|
70
|
-
*/
|
|
71
|
-
timestamp: z.string(),
|
|
72
|
-
/**
|
|
73
|
-
* A fill spanning multiple positions gets a synthetic exchange fill id.
|
|
74
|
-
* This `original` field contains the root exchange fill id and quantity.
|
|
75
|
-
*/
|
|
76
|
-
original: z.object({
|
|
77
|
-
exchangeFillId: z.string(),
|
|
78
|
-
quantity: z.string()
|
|
79
|
-
}).optional()
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export { Fill, FillStatus };
|
package/dist/fill/index.js
DELETED
package/dist/fill/queries.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CursorFindParams } from '../common';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
|
|
5
|
-
const FillOrderBy = z.union([
|
|
6
|
-
z.literal("timestamp"),
|
|
7
|
-
z.literal("-timestamp")
|
|
8
|
-
]);
|
|
9
|
-
const FillListParams = CursorFindParams.extend({
|
|
10
|
-
connector: Connector.optional(),
|
|
11
|
-
orderBy: FillOrderBy.default("-timestamp")
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { FillListParams, FillOrderBy };
|
package/dist/fill/responses.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CursorResponse } from '../common';
|
|
3
|
-
import { InstrumentId } from '../instrument';
|
|
4
|
-
import { Fill } from './entities';
|
|
5
|
-
|
|
6
|
-
const FillListResponse = CursorResponse.extend({
|
|
7
|
-
fills: z.array(Fill)
|
|
8
|
-
});
|
|
9
|
-
const PositionFillListResponse = z.object({
|
|
10
|
-
fills: z.array(Fill)
|
|
11
|
-
});
|
|
12
|
-
const ProvisionalFill = z.object({
|
|
13
|
-
id: z.uuid(),
|
|
14
|
-
positionId: z.uuid(),
|
|
15
|
-
symbol: InstrumentId,
|
|
16
|
-
cloid: z.string().optional(),
|
|
17
|
-
status: z.literal("PROVISIONAL")
|
|
18
|
-
});
|
|
19
|
-
const ProvisionalFillListResponse = z.object({
|
|
20
|
-
fills: z.array(ProvisionalFill)
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { FillListResponse, PositionFillListResponse, ProvisionalFill, ProvisionalFillListResponse };
|
package/dist/funding/entities.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { InstrumentId } from '../instrument';
|
|
3
|
-
|
|
4
|
-
const FundingInfo = z.object({
|
|
5
|
-
/**
|
|
6
|
-
* Funding rate
|
|
7
|
-
*/
|
|
8
|
-
r: z.string(),
|
|
9
|
-
/**
|
|
10
|
-
* Next funding time in milliseconds
|
|
11
|
-
*/
|
|
12
|
-
nft: z.number()
|
|
13
|
-
});
|
|
14
|
-
const InstrumentFundingMap = z.record(InstrumentId, FundingInfo);
|
|
15
|
-
|
|
16
|
-
export { FundingInfo, InstrumentFundingMap };
|
package/dist/funding/index.js
DELETED
package/dist/funding/queries.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Connector } from '../connector';
|
|
3
|
-
import { InstrumentPrecision } from '../instrument-precision';
|
|
4
|
-
|
|
5
|
-
const InstrumentId = z.string().trim().min(1, "Instrument ID is required").max(64, "Instrument ID must be at most 64 characters").regex(/^[^\s][^\s]*$/, "Instrument ID contains invalid characters");
|
|
6
|
-
const InstrumentType = z.enum([
|
|
7
|
-
"spot",
|
|
8
|
-
"perp",
|
|
9
|
-
"hip3"
|
|
10
|
-
]);
|
|
11
|
-
const InstrumentMarginMode = z.enum([
|
|
12
|
-
"isolated",
|
|
13
|
-
"cross",
|
|
14
|
-
"any"
|
|
15
|
-
]);
|
|
16
|
-
const InstrumentTradeabilityStatus = z.enum([
|
|
17
|
-
"tradable",
|
|
18
|
-
"reduce_only",
|
|
19
|
-
"not_tradable"
|
|
20
|
-
]);
|
|
21
|
-
const InstrumentTradeabilityReason = z.string().nullable();
|
|
22
|
-
const InstrumentTradeability = z.object({
|
|
23
|
-
status: InstrumentTradeabilityStatus,
|
|
24
|
-
reason: InstrumentTradeabilityReason
|
|
25
|
-
});
|
|
26
|
-
const Instrument = z.object({
|
|
27
|
-
/**
|
|
28
|
-
* Exchange specific instrument identifier
|
|
29
|
-
* @example (dexIndex + assetIndex) on Hyperliquid
|
|
30
|
-
* @example "BTCUSDT" on Binance
|
|
31
|
-
*/
|
|
32
|
-
id: InstrumentId,
|
|
33
|
-
/**
|
|
34
|
-
* The base asset of the instrument.
|
|
35
|
-
* @example "BTC"
|
|
36
|
-
*/
|
|
37
|
-
base: z.string(),
|
|
38
|
-
/**
|
|
39
|
-
* The quote asset of the instrument.
|
|
40
|
-
* @example "USDT"
|
|
41
|
-
*/
|
|
42
|
-
quote: z.string(),
|
|
43
|
-
/**
|
|
44
|
-
* The connector of the instrument.
|
|
45
|
-
* @example "hyperliquid"
|
|
46
|
-
* @example "binance"
|
|
47
|
-
*/
|
|
48
|
-
connector: Connector,
|
|
49
|
-
/**
|
|
50
|
-
* The type of the instrument.
|
|
51
|
-
* @example "spot"
|
|
52
|
-
* @example "perp"
|
|
53
|
-
* @example "hip3"
|
|
54
|
-
*/
|
|
55
|
-
type: InstrumentType,
|
|
56
|
-
/**
|
|
57
|
-
* The maximum leverage of the instrument.
|
|
58
|
-
* @example 1
|
|
59
|
-
*/
|
|
60
|
-
leverage: z.int().min(1),
|
|
61
|
-
/**
|
|
62
|
-
* The margin modes this market offers, not the mode selected for an account.
|
|
63
|
-
* `isolated` and `cross` mean the venue permits only that mode; `any` means the user chooses.
|
|
64
|
-
*/
|
|
65
|
-
marginMode: InstrumentMarginMode,
|
|
66
|
-
/**
|
|
67
|
-
* The precision of the instrument.
|
|
68
|
-
*/
|
|
69
|
-
precision: InstrumentPrecision,
|
|
70
|
-
/**
|
|
71
|
-
* Whether this instrument can be traded normally.
|
|
72
|
-
*/
|
|
73
|
-
tradeability: InstrumentTradeability
|
|
74
|
-
});
|
|
75
|
-
const InstrumentLite = z.object({
|
|
76
|
-
/**
|
|
77
|
-
* Exchange specific instrument identifier
|
|
78
|
-
* @example (dexIndex + assetIndex) on Hyperliquid
|
|
79
|
-
* @example "BTCUSDT" on Binance
|
|
80
|
-
*/
|
|
81
|
-
id: InstrumentId,
|
|
82
|
-
/**
|
|
83
|
-
* The base asset of the instrument.
|
|
84
|
-
* @example "BTC"
|
|
85
|
-
*/
|
|
86
|
-
base: z.string(),
|
|
87
|
-
/**
|
|
88
|
-
* The margin modes this market offers, not the mode selected for an account.
|
|
89
|
-
* `isolated` and `cross` mean the venue permits only that mode; `any` means the user chooses.
|
|
90
|
-
*/
|
|
91
|
-
marginMode: InstrumentMarginMode,
|
|
92
|
-
/**
|
|
93
|
-
* Minimal precision — only the contract size the syncer needs for BASE-unit normalization.
|
|
94
|
-
*/
|
|
95
|
-
precision: z.object({
|
|
96
|
-
quantity: z.object({
|
|
97
|
-
contractSize: z.number()
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
export { Instrument, InstrumentId, InstrumentLite, InstrumentMarginMode, InstrumentTradeability, InstrumentTradeabilityReason, InstrumentTradeabilityStatus, InstrumentType };
|
package/dist/instrument/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Connector } from '../connector';
|
|
3
|
-
|
|
4
|
-
const InstrumentScope = z.enum([
|
|
5
|
-
"tradable",
|
|
6
|
-
"reduce_only",
|
|
7
|
-
"not_tradable",
|
|
8
|
-
"all"
|
|
9
|
-
]);
|
|
10
|
-
const InstrumentListParams = z.object({
|
|
11
|
-
connector: Connector,
|
|
12
|
-
scope: InstrumentScope.default("all")
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export { InstrumentListParams, InstrumentScope };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Instrument, InstrumentId, InstrumentLite } from './entities';
|
|
3
|
-
|
|
4
|
-
const InstrumentListResponse = z.object({
|
|
5
|
-
/**
|
|
6
|
-
* The list of instruments.
|
|
7
|
-
*/
|
|
8
|
-
instruments: z.array(Instrument)
|
|
9
|
-
});
|
|
10
|
-
const InstrumentSymbolToIdMapResponse = z.object({
|
|
11
|
-
data: z.record(z.string(), InstrumentId)
|
|
12
|
-
});
|
|
13
|
-
const InstrumentListLiteResponse = z.object({
|
|
14
|
-
/**
|
|
15
|
-
* The list of instruments, trimmed to the lightweight consumer fields.
|
|
16
|
-
*/
|
|
17
|
-
instruments: z.array(InstrumentLite)
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { InstrumentListLiteResponse, InstrumentListResponse, InstrumentSymbolToIdMapResponse };
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
* The venue's minimum order quantity for market (IOC) orders, in contracts, when it has one.
|
|
23
|
-
* @example 10 on Binance ALLUSDT, where one step is 1.
|
|
24
|
-
*/
|
|
25
|
-
min: z.number().transform((val) => val === null ? void 0 : val).optional().nullable()
|
|
26
|
-
}),
|
|
27
|
-
price: z.object({
|
|
28
|
-
/**
|
|
29
|
-
* The maximum number of decimals.
|
|
30
|
-
* @example 4 for a 0.0001 tick size.
|
|
31
|
-
*/
|
|
32
|
-
decimals: z.int(),
|
|
33
|
-
/**
|
|
34
|
-
* The smallest increment.
|
|
35
|
-
* @example 0.01 for a 2 decimal precision.
|
|
36
|
-
*/
|
|
37
|
-
tick: z.number().transform((val) => val === null ? void 0 : val).optional().nullable(),
|
|
38
|
-
/**
|
|
39
|
-
* The number of significant figures.
|
|
40
|
-
* @example 5 on Hyperliquid V2.
|
|
41
|
-
*/
|
|
42
|
-
sigFigs: z.int().transform((val) => val === null ? void 0 : val).optional().nullable()
|
|
43
|
-
}),
|
|
44
|
-
notional: z.object({
|
|
45
|
-
/**
|
|
46
|
-
* The minimum notional amount in USD.
|
|
47
|
-
*/
|
|
48
|
-
min: z.number().transform((val) => val === null ? void 0 : val).optional().nullable(),
|
|
49
|
-
/**
|
|
50
|
-
* The maximum notional amount in USD.
|
|
51
|
-
*/
|
|
52
|
-
max: z.number().transform((val) => val === null ? void 0 : val).optional().nullable()
|
|
53
|
-
}).optional()
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export { InstrumentPrecision };
|