@pear-protocol/types 0.0.16 → 0.0.18
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/auth/entities.d.ts +10 -1
- package/dist/auth/entities.js +4 -2
- package/dist/auth/response.d.ts +13 -12
- package/dist/auth/response.js +6 -2
- package/dist/bundle.d.ts +1 -0
- package/dist/bundle.js +1 -0
- package/dist/common/address.d.ts +3 -0
- package/dist/common/address.js +5 -0
- package/dist/common/hex-string.d.ts +3 -0
- package/dist/common/hex-string.js +5 -0
- package/dist/common/refinement.d.ts +1 -0
- package/dist/common/refinement.js +9 -1
- package/dist/common/request.js +1 -1
- package/dist/common/schema.d.ts +1 -1
- package/dist/common/schema.js +1 -1
- package/dist/execution/entities.d.ts +6 -6
- package/dist/execution/responses.d.ts +2 -2
- package/dist/fill/entities.d.ts +20 -2
- package/dist/fill/entities.js +30 -5
- package/dist/fill/queries.d.ts +1 -0
- package/dist/fill/queries.js +3 -3
- package/dist/fill/responses.d.ts +46 -4
- package/dist/fill/responses.js +12 -1
- package/dist/instrument/responses.d.ts +4 -0
- package/dist/instrument/responses.js +5 -2
- package/dist/misc/index.d.ts +1 -1
- package/dist/position/entities.d.ts +5 -5
- package/dist/position/responses.d.ts +32 -2
- package/dist/position/responses.js +13 -1
- package/dist/schedule/entities.d.ts +82 -16
- package/dist/schedule/entities.js +5 -5
- package/dist/schedule/payloads.d.ts +4 -4
- package/dist/schedule/payloads.js +7 -7
- package/dist/schedule/responses.d.ts +66 -14
- package/dist/statistics/entities.d.ts +10 -3
- package/dist/statistics/entities.js +9 -3
- package/dist/statistics/queries.d.ts +26 -3
- package/dist/statistics/queries.js +11 -2
- package/dist/statistics/responses.d.ts +12 -3
- package/dist/statistics/responses.js +7 -4
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/payloads.d.ts +279 -0
- package/dist/sync/payloads.js +78 -0
- package/dist/sync/responses.d.ts +10 -0
- package/dist/sync/responses.js +11 -0
- package/dist/trade/payloads.d.ts +14 -4
- package/dist/trade/responses.d.ts +8 -8
- package/dist/trade-accounts/payloads.d.ts +13 -13
- package/dist/trade-accounts/payloads.js +7 -5
- package/dist/trigger/entities/index.d.ts +216 -46
- package/dist/trigger/entities/index.js +35 -9
- package/dist/trigger/payloads/index.d.ts +21 -6
- package/dist/trigger/payloads/index.js +24 -7
- package/dist/trigger/responses.d.ts +128 -28
- package/package.json +2 -2
package/dist/auth/entities.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const LoginMethod: z.ZodEnum<{
|
|
3
|
+
email: "email";
|
|
4
|
+
evm_wallet: "evm_wallet";
|
|
5
|
+
}>;
|
|
2
6
|
export declare const AuthenticatedUser: z.ZodObject<{
|
|
3
7
|
id: z.ZodUUID;
|
|
4
8
|
role: z.ZodEnum<{
|
|
5
9
|
basic: "basic";
|
|
6
10
|
pro: "pro";
|
|
7
11
|
}>;
|
|
8
|
-
|
|
12
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
13
|
+
loginMethod: z.ZodEnum<{
|
|
14
|
+
email: "email";
|
|
15
|
+
evm_wallet: "evm_wallet";
|
|
16
|
+
}>;
|
|
9
17
|
}, z.core.$strip>;
|
|
18
|
+
export type LoginMethod = z.infer<typeof LoginMethod>;
|
|
10
19
|
export type AuthenticatedUser = z.infer<typeof AuthenticatedUser>;
|
package/dist/auth/entities.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
const LoginMethod = z.enum(["email", "evm_wallet"]).describe("Authentication provider used for the current session");
|
|
3
4
|
const AuthenticatedUser = z.object({
|
|
4
5
|
id: z.uuid().describe("User UUID"),
|
|
5
6
|
role: z.enum(["basic", "pro"]).describe("User role"),
|
|
6
|
-
|
|
7
|
+
providerId: z.string().nullable().describe("Provider identifier (wallet address or email)"),
|
|
8
|
+
loginMethod: LoginMethod.describe("Authentication provider used for the current session")
|
|
7
9
|
}).describe("Current authenticated user info");
|
|
8
10
|
|
|
9
|
-
export { AuthenticatedUser };
|
|
11
|
+
export { AuthenticatedUser, LoginMethod };
|
package/dist/auth/response.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const LoginResponse: z.ZodObject<{
|
|
3
|
+
accessToken: z.ZodString;
|
|
4
|
+
refreshToken: z.ZodString;
|
|
3
5
|
user: z.ZodObject<{
|
|
4
6
|
id: z.ZodUUID;
|
|
5
7
|
role: z.ZodEnum<{
|
|
6
8
|
basic: "basic";
|
|
7
9
|
pro: "pro";
|
|
8
10
|
}>;
|
|
9
|
-
|
|
11
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
12
|
+
loginMethod: z.ZodEnum<{
|
|
13
|
+
email: "email";
|
|
14
|
+
evm_wallet: "evm_wallet";
|
|
15
|
+
}>;
|
|
10
16
|
}, z.core.$strip>;
|
|
11
17
|
}, z.core.$strip>;
|
|
12
18
|
export declare const RefreshTokenResponse: z.ZodObject<{
|
|
@@ -24,16 +30,7 @@ export declare const ChangePasswordResponse: z.ZodVoid;
|
|
|
24
30
|
export declare const ForgotPasswordResponse: z.ZodVoid;
|
|
25
31
|
export declare const ResetPasswordResponse: z.ZodVoid;
|
|
26
32
|
export declare const LinkEmailResponse: z.ZodVoid;
|
|
27
|
-
export declare const LinkWalletResponse: z.
|
|
28
|
-
user: z.ZodObject<{
|
|
29
|
-
id: z.ZodUUID;
|
|
30
|
-
role: z.ZodEnum<{
|
|
31
|
-
basic: "basic";
|
|
32
|
-
pro: "pro";
|
|
33
|
-
}>;
|
|
34
|
-
address: z.ZodNullable<z.ZodString>;
|
|
35
|
-
}, z.core.$strip>;
|
|
36
|
-
}, z.core.$strip>;
|
|
33
|
+
export declare const LinkWalletResponse: z.ZodVoid;
|
|
37
34
|
export declare const RequestNonceResponse: z.ZodObject<{
|
|
38
35
|
nonce: z.ZodString;
|
|
39
36
|
message: z.ZodString;
|
|
@@ -45,7 +42,11 @@ export declare const MeResponse: z.ZodObject<{
|
|
|
45
42
|
basic: "basic";
|
|
46
43
|
pro: "pro";
|
|
47
44
|
}>;
|
|
48
|
-
|
|
45
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
46
|
+
loginMethod: z.ZodEnum<{
|
|
47
|
+
email: "email";
|
|
48
|
+
evm_wallet: "evm_wallet";
|
|
49
|
+
}>;
|
|
49
50
|
}, z.core.$strip>;
|
|
50
51
|
export type RequestNonceResponse = z.infer<typeof RequestNonceResponse>;
|
|
51
52
|
export type LoginResponse = z.infer<typeof LoginResponse>;
|
package/dist/auth/response.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { AuthenticatedUser } from './entities';
|
|
3
3
|
|
|
4
|
-
const LoginResponse = z.object({
|
|
4
|
+
const LoginResponse = z.object({
|
|
5
|
+
accessToken: z.string().describe("New JWT access token"),
|
|
6
|
+
refreshToken: z.string().describe("New JWT refresh token"),
|
|
7
|
+
user: AuthenticatedUser
|
|
8
|
+
}).describe("Successful login response");
|
|
5
9
|
const RefreshTokenResponse = z.object({
|
|
6
10
|
accessToken: z.string().describe("New JWT access token"),
|
|
7
11
|
refreshToken: z.string().describe("New JWT refresh token"),
|
|
@@ -17,7 +21,7 @@ const ChangePasswordResponse = z.void().describe("Successful password change res
|
|
|
17
21
|
const ForgotPasswordResponse = z.void().describe("Successful password reset request response");
|
|
18
22
|
const ResetPasswordResponse = z.void().describe("Successful password reset response");
|
|
19
23
|
const LinkEmailResponse = z.void().describe("Successful email verification response");
|
|
20
|
-
const LinkWalletResponse = z.
|
|
24
|
+
const LinkWalletResponse = z.void().describe("Successful wallet link response");
|
|
21
25
|
const RequestNonceResponse = z.object({
|
|
22
26
|
nonce: z.string().describe("Nonce to sign with wallet"),
|
|
23
27
|
message: z.string().describe("Domain-bound wallet sign-in message"),
|
package/dist/bundle.d.ts
CHANGED
package/dist/bundle.js
CHANGED
|
@@ -18,3 +18,4 @@ export declare const RefineWeightingSum: <T extends {
|
|
|
18
18
|
export declare const RefineMinimumOneBuyOneSell: <T extends {
|
|
19
19
|
side: "BUY" | "SELL";
|
|
20
20
|
}[]>(basket: T, ctx: z.RefinementCtx) => void;
|
|
21
|
+
export declare const RefineMinimumOneKeyValuePair: <T extends Record<string, unknown>>(data: T, ctx: z.RefinementCtx) => void;
|
|
@@ -56,5 +56,13 @@ const RefineMinimumOneBuyOneSell = (basket, ctx) => {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
const RefineMinimumOneKeyValuePair = (data, ctx) => {
|
|
60
|
+
if (Object.keys(data).length < 1) {
|
|
61
|
+
ctx.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
message: "Empty object is not allowed."
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
59
67
|
|
|
60
|
-
export { RefineMinimumOneBuyOneSell, RefineMinimumOneSymbol, RefineMinimumTwoSymbols, RefineTwoUniqueSymbols, RefineUniqueSymbols, RefineWeightingSum };
|
|
68
|
+
export { RefineMinimumOneBuyOneSell, RefineMinimumOneKeyValuePair, RefineMinimumOneSymbol, RefineMinimumTwoSymbols, RefineTwoUniqueSymbols, RefineUniqueSymbols, RefineWeightingSum };
|
package/dist/common/request.js
CHANGED
|
@@ -4,7 +4,7 @@ const CursorFindParams = z.object({
|
|
|
4
4
|
/**
|
|
5
5
|
* The maximum number of items to retrieve.
|
|
6
6
|
*/
|
|
7
|
-
limit: z.coerce.number().int().positive().max(
|
|
7
|
+
limit: z.coerce.number().int().positive().max(2e3).optional().default(20),
|
|
8
8
|
/**
|
|
9
9
|
* Opaque pagination cursor returned by the API.
|
|
10
10
|
*/
|
package/dist/common/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
export declare const UnsignedDecimalString: z.ZodString;
|
|
3
|
-
export declare const SignedDecimalString: z.ZodString
|
|
3
|
+
export declare const SignedDecimalString: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
4
4
|
export declare const Leverage: z.ZodInt;
|
|
5
5
|
export declare const Side: z.ZodEnum<{
|
|
6
6
|
BUY: "BUY";
|
package/dist/common/schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
|
|
3
3
|
const UnsignedDecimalString = z.string().regex(/^\d+(\.\d+)?$/, "Must be a valid decimal string");
|
|
4
|
-
const SignedDecimalString = z.string().regex(
|
|
4
|
+
const SignedDecimalString = z.string().regex(/^[+-]\d+(\.\d+)?$/, "Must be a valid signed decimal string").transform((val) => val);
|
|
5
5
|
const Leverage = z.int({ message: "Leverage must be an integer" }).positive({ message: "Leverage must be greater than 0" }).max(100, { message: "Leverage must be less than 100" });
|
|
6
6
|
const Side = z.enum(["BUY", "SELL"], {
|
|
7
7
|
message: "Side must be either BUY or SELL"
|
|
@@ -229,7 +229,7 @@ export declare const MarketAdjustExecution: z.ZodObject<{
|
|
|
229
229
|
orderType: z.ZodLiteral<"MARKET">;
|
|
230
230
|
position: z.ZodObject<{
|
|
231
231
|
id: z.ZodUUID;
|
|
232
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
232
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
233
233
|
}, z.core.$strip>;
|
|
234
234
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
235
235
|
symbol: z.ZodString;
|
|
@@ -312,7 +312,7 @@ export declare const MarketCloseExecution: z.ZodObject<{
|
|
|
312
312
|
orderType: z.ZodLiteral<"MARKET">;
|
|
313
313
|
position: z.ZodObject<{
|
|
314
314
|
id: z.ZodUUID;
|
|
315
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
315
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
316
316
|
}, z.core.$strip>;
|
|
317
317
|
}, z.core.$strip>;
|
|
318
318
|
export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -448,7 +448,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
448
448
|
orderType: z.ZodLiteral<"MARKET">;
|
|
449
449
|
position: z.ZodObject<{
|
|
450
450
|
id: z.ZodUUID;
|
|
451
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
451
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
452
452
|
}, z.core.$strip>;
|
|
453
453
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
454
454
|
symbol: z.ZodString;
|
|
@@ -530,7 +530,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
530
530
|
orderType: z.ZodLiteral<"MARKET">;
|
|
531
531
|
position: z.ZodObject<{
|
|
532
532
|
id: z.ZodUUID;
|
|
533
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
533
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
534
534
|
}, z.core.$strip>;
|
|
535
535
|
}, z.core.$strip>], "intent">;
|
|
536
536
|
export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -666,7 +666,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
666
666
|
orderType: z.ZodLiteral<"MARKET">;
|
|
667
667
|
position: z.ZodObject<{
|
|
668
668
|
id: z.ZodUUID;
|
|
669
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
669
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
670
670
|
}, z.core.$strip>;
|
|
671
671
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
672
672
|
symbol: z.ZodString;
|
|
@@ -748,7 +748,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
748
748
|
orderType: z.ZodLiteral<"MARKET">;
|
|
749
749
|
position: z.ZodObject<{
|
|
750
750
|
id: z.ZodUUID;
|
|
751
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
751
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
752
752
|
}, z.core.$strip>;
|
|
753
753
|
}, z.core.$strip>], "intent">], "orderType">;
|
|
754
754
|
export type ExecutionLeg = z.infer<typeof ExecutionLeg>;
|
|
@@ -135,7 +135,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
135
135
|
orderType: z.ZodLiteral<"MARKET">;
|
|
136
136
|
position: z.ZodObject<{
|
|
137
137
|
id: z.ZodUUID;
|
|
138
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
138
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
139
139
|
}, z.core.$strip>;
|
|
140
140
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
141
141
|
symbol: z.ZodString;
|
|
@@ -217,7 +217,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
217
217
|
orderType: z.ZodLiteral<"MARKET">;
|
|
218
218
|
position: z.ZodObject<{
|
|
219
219
|
id: z.ZodUUID;
|
|
220
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
220
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
221
221
|
}, z.core.$strip>;
|
|
222
222
|
}, z.core.$strip>], "intent">], "orderType">>;
|
|
223
223
|
}, z.core.$strip>;
|
package/dist/fill/entities.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const FillStatus: z.ZodEnum<{
|
|
3
|
+
PROVISIONAL: "PROVISIONAL";
|
|
4
|
+
CONFIRMED: "CONFIRMED";
|
|
5
|
+
RECONCILED: "RECONCILED";
|
|
6
|
+
}>;
|
|
7
|
+
export type FillStatus = z.output<typeof FillStatus>;
|
|
2
8
|
export declare const Fill: z.ZodObject<{
|
|
3
9
|
id: z.ZodUUID;
|
|
4
|
-
cloid: z.ZodOptional<z.
|
|
10
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
11
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
status: z.ZodEnum<{
|
|
13
|
+
PROVISIONAL: "PROVISIONAL";
|
|
14
|
+
CONFIRMED: "CONFIRMED";
|
|
15
|
+
RECONCILED: "RECONCILED";
|
|
16
|
+
}>;
|
|
5
17
|
tradeAccountId: z.ZodUUID;
|
|
6
18
|
symbol: z.ZodString;
|
|
7
19
|
positionId: z.ZodUUID;
|
|
@@ -17,10 +29,16 @@ export declare const Fill: z.ZodObject<{
|
|
|
17
29
|
SELL: "SELL";
|
|
18
30
|
}>;
|
|
19
31
|
reduceOnly: z.ZodBoolean;
|
|
32
|
+
isExternal: z.ZodBoolean;
|
|
20
33
|
quantity: z.ZodString;
|
|
21
34
|
price: z.ZodString;
|
|
22
35
|
usd: z.ZodString;
|
|
23
|
-
|
|
36
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
37
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
24
38
|
timestamp: z.ZodString;
|
|
39
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
exchangeFillId: z.ZodString;
|
|
41
|
+
quantity: z.ZodString;
|
|
42
|
+
}, z.core.$strip>>;
|
|
25
43
|
}, z.core.$strip>;
|
|
26
44
|
export type Fill = z.output<typeof Fill>;
|
package/dist/fill/entities.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Side } from '../common/schema';
|
|
|
3
3
|
import { Connector } from '../connector';
|
|
4
4
|
import { InstrumentId } from '../instrument';
|
|
5
5
|
|
|
6
|
+
const FillStatus = z.enum(["PROVISIONAL", "CONFIRMED", "RECONCILED"]);
|
|
6
7
|
const Fill = z.object({
|
|
7
8
|
/**
|
|
8
9
|
* Fill UUID
|
|
@@ -11,7 +12,15 @@ const Fill = z.object({
|
|
|
11
12
|
/**
|
|
12
13
|
* Client order ID
|
|
13
14
|
*/
|
|
14
|
-
cloid: z.
|
|
15
|
+
cloid: z.string().optional(),
|
|
16
|
+
/**
|
|
17
|
+
* Exchange-native fill ID (tradeId / tid / etc)
|
|
18
|
+
*/
|
|
19
|
+
exchangeFillId: z.string().optional(),
|
|
20
|
+
/**
|
|
21
|
+
* Fill lifecycle status
|
|
22
|
+
*/
|
|
23
|
+
status: FillStatus,
|
|
15
24
|
/**
|
|
16
25
|
* Trade account UUID
|
|
17
26
|
*/
|
|
@@ -36,6 +45,10 @@ const Fill = z.object({
|
|
|
36
45
|
* Reduce only flag
|
|
37
46
|
*/
|
|
38
47
|
reduceOnly: z.boolean(),
|
|
48
|
+
/**
|
|
49
|
+
* True when the fill was created from external sync.
|
|
50
|
+
*/
|
|
51
|
+
isExternal: z.boolean(),
|
|
39
52
|
/**
|
|
40
53
|
* Filled quantity
|
|
41
54
|
*/
|
|
@@ -49,13 +62,25 @@ const Fill = z.object({
|
|
|
49
62
|
*/
|
|
50
63
|
usd: z.string(),
|
|
51
64
|
/**
|
|
52
|
-
*
|
|
65
|
+
* Trade fee paid
|
|
66
|
+
*/
|
|
67
|
+
tradeFee: z.string().optional(),
|
|
68
|
+
/**
|
|
69
|
+
* Pear fee paid
|
|
53
70
|
*/
|
|
54
|
-
|
|
71
|
+
pearFee: z.string().optional(),
|
|
55
72
|
/**
|
|
56
73
|
* Timestamp
|
|
57
74
|
*/
|
|
58
|
-
timestamp: z.string()
|
|
75
|
+
timestamp: z.string(),
|
|
76
|
+
/**
|
|
77
|
+
* A fill spanning multiple positions gets a synthetic exchange fill id.
|
|
78
|
+
* This `original` field contains the root exchange fill id and quantity.
|
|
79
|
+
*/
|
|
80
|
+
original: z.object({
|
|
81
|
+
exchangeFillId: z.string(),
|
|
82
|
+
quantity: z.string()
|
|
83
|
+
}).optional()
|
|
59
84
|
});
|
|
60
85
|
|
|
61
|
-
export { Fill };
|
|
86
|
+
export { Fill, FillStatus };
|
package/dist/fill/queries.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const FillOrderBy: z.ZodUnion<readonly [z.ZodLiteral<"timestamp">, z.ZodLiteral<"-timestamp">]>;
|
|
2
3
|
export declare const FillListParams: z.ZodObject<{
|
|
3
4
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
|
|
4
5
|
cursor: z.ZodOptional<z.ZodString>;
|
package/dist/fill/queries.js
CHANGED
|
@@ -2,10 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
import { CursorFindParams } from '../common';
|
|
3
3
|
import { Connector } from '../connector';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const FillOrderBy = z.union([z.literal("timestamp"), z.literal("-timestamp")]);
|
|
6
6
|
const FillListParams = CursorFindParams.extend({
|
|
7
7
|
connector: Connector.optional(),
|
|
8
|
-
orderBy:
|
|
8
|
+
orderBy: FillOrderBy.default("-timestamp")
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
export { FillListParams };
|
|
11
|
+
export { FillListParams, FillOrderBy };
|
package/dist/fill/responses.d.ts
CHANGED
|
@@ -4,7 +4,13 @@ export declare const FillListResponse: z.ZodObject<{
|
|
|
4
4
|
nextCursor: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
5
5
|
fills: z.ZodArray<z.ZodObject<{
|
|
6
6
|
id: z.ZodUUID;
|
|
7
|
-
cloid: z.ZodOptional<z.
|
|
7
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
8
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
PROVISIONAL: "PROVISIONAL";
|
|
11
|
+
CONFIRMED: "CONFIRMED";
|
|
12
|
+
RECONCILED: "RECONCILED";
|
|
13
|
+
}>;
|
|
8
14
|
tradeAccountId: z.ZodUUID;
|
|
9
15
|
symbol: z.ZodString;
|
|
10
16
|
positionId: z.ZodUUID;
|
|
@@ -20,18 +26,30 @@ export declare const FillListResponse: z.ZodObject<{
|
|
|
20
26
|
SELL: "SELL";
|
|
21
27
|
}>;
|
|
22
28
|
reduceOnly: z.ZodBoolean;
|
|
29
|
+
isExternal: z.ZodBoolean;
|
|
23
30
|
quantity: z.ZodString;
|
|
24
31
|
price: z.ZodString;
|
|
25
32
|
usd: z.ZodString;
|
|
26
|
-
|
|
33
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
34
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
27
35
|
timestamp: z.ZodString;
|
|
36
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
exchangeFillId: z.ZodString;
|
|
38
|
+
quantity: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
28
40
|
}, z.core.$strip>>;
|
|
29
41
|
}, z.core.$strip>;
|
|
30
42
|
export type FillListResponse = z.output<typeof FillListResponse>;
|
|
31
43
|
export declare const PositionFillListResponse: z.ZodObject<{
|
|
32
44
|
fills: z.ZodArray<z.ZodObject<{
|
|
33
45
|
id: z.ZodUUID;
|
|
34
|
-
cloid: z.ZodOptional<z.
|
|
46
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
47
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
48
|
+
status: z.ZodEnum<{
|
|
49
|
+
PROVISIONAL: "PROVISIONAL";
|
|
50
|
+
CONFIRMED: "CONFIRMED";
|
|
51
|
+
RECONCILED: "RECONCILED";
|
|
52
|
+
}>;
|
|
35
53
|
tradeAccountId: z.ZodUUID;
|
|
36
54
|
symbol: z.ZodString;
|
|
37
55
|
positionId: z.ZodUUID;
|
|
@@ -47,11 +65,35 @@ export declare const PositionFillListResponse: z.ZodObject<{
|
|
|
47
65
|
SELL: "SELL";
|
|
48
66
|
}>;
|
|
49
67
|
reduceOnly: z.ZodBoolean;
|
|
68
|
+
isExternal: z.ZodBoolean;
|
|
50
69
|
quantity: z.ZodString;
|
|
51
70
|
price: z.ZodString;
|
|
52
71
|
usd: z.ZodString;
|
|
53
|
-
|
|
72
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
73
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
54
74
|
timestamp: z.ZodString;
|
|
75
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
exchangeFillId: z.ZodString;
|
|
77
|
+
quantity: z.ZodString;
|
|
78
|
+
}, z.core.$strip>>;
|
|
55
79
|
}, z.core.$strip>>;
|
|
56
80
|
}, z.core.$strip>;
|
|
57
81
|
export type PositionFillListResponse = z.output<typeof PositionFillListResponse>;
|
|
82
|
+
export declare const ProvisionalFill: z.ZodObject<{
|
|
83
|
+
id: z.ZodUUID;
|
|
84
|
+
positionId: z.ZodUUID;
|
|
85
|
+
symbol: z.ZodString;
|
|
86
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
87
|
+
status: z.ZodLiteral<"PROVISIONAL">;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export declare const ProvisionalFillListResponse: z.ZodObject<{
|
|
90
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
91
|
+
id: z.ZodUUID;
|
|
92
|
+
positionId: z.ZodUUID;
|
|
93
|
+
symbol: z.ZodString;
|
|
94
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
95
|
+
status: z.ZodLiteral<"PROVISIONAL">;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
export type ProvisionalFill = z.output<typeof ProvisionalFill>;
|
|
99
|
+
export type ProvisionalFillListResponse = z.output<typeof ProvisionalFillListResponse>;
|
package/dist/fill/responses.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CursorResponse } from '../common';
|
|
3
|
+
import { InstrumentId } from '../instrument';
|
|
3
4
|
import { Fill } from './entities';
|
|
4
5
|
|
|
5
6
|
const FillListResponse = CursorResponse.extend({
|
|
@@ -8,5 +9,15 @@ const FillListResponse = CursorResponse.extend({
|
|
|
8
9
|
const PositionFillListResponse = z.object({
|
|
9
10
|
fills: z.array(Fill)
|
|
10
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
|
+
});
|
|
11
22
|
|
|
12
|
-
export { FillListResponse, PositionFillListResponse };
|
|
23
|
+
export { FillListResponse, PositionFillListResponse, ProvisionalFill, ProvisionalFillListResponse };
|
|
@@ -36,3 +36,7 @@ export declare const InstrumentListResponse: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export type InstrumentListResponse = z.output<typeof InstrumentListResponse>;
|
|
39
|
+
export declare const InstrumentSymbolToIdMapResponse: z.ZodObject<{
|
|
40
|
+
data: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type InstrumentSymbolToIdMapResponse = z.output<typeof InstrumentSymbolToIdMapResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Instrument } from './entities';
|
|
2
|
+
import { Instrument, InstrumentId } from './entities';
|
|
3
3
|
|
|
4
4
|
const InstrumentListResponse = z.object({
|
|
5
5
|
/**
|
|
@@ -7,5 +7,8 @@ const InstrumentListResponse = z.object({
|
|
|
7
7
|
*/
|
|
8
8
|
instruments: z.array(Instrument)
|
|
9
9
|
});
|
|
10
|
+
const InstrumentSymbolToIdMapResponse = z.object({
|
|
11
|
+
data: z.record(z.string(), InstrumentId)
|
|
12
|
+
});
|
|
10
13
|
|
|
11
|
-
export { InstrumentListResponse };
|
|
14
|
+
export { InstrumentListResponse, InstrumentSymbolToIdMapResponse };
|
package/dist/misc/index.d.ts
CHANGED
|
@@ -13,10 +13,10 @@ export type PositionClosedReason = z.infer<typeof PositionClosedReason>;
|
|
|
13
13
|
/**
|
|
14
14
|
* The exposure of a position in directional units for each asset.
|
|
15
15
|
*
|
|
16
|
-
* @example { '0': '0.002' } means BTC 0.002 LONG
|
|
16
|
+
* @example { '0': '+0.002' } means BTC 0.002 LONG
|
|
17
17
|
* @example { '1': '-0.5' } means ETH 0.5 SHORT
|
|
18
18
|
*/
|
|
19
|
-
export declare const PositionExposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
19
|
+
export declare const PositionExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
20
20
|
export type PositionExposure = z.infer<typeof PositionExposure>;
|
|
21
21
|
/**
|
|
22
22
|
* The initial exposure in directional USD for each asset.
|
|
@@ -24,7 +24,7 @@ export type PositionExposure = z.infer<typeof PositionExposure>;
|
|
|
24
24
|
* @example { '0': 1000 } means BTC 1000 USD LONG
|
|
25
25
|
* @example { '1': -500 } means ETH 500 USD SHORT
|
|
26
26
|
*/
|
|
27
|
-
export declare const PositionInitialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString
|
|
27
|
+
export declare const PositionInitialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
28
28
|
export type PositionInitialExposureUSD = z.infer<typeof PositionInitialExposureUSD>;
|
|
29
29
|
export declare const Position: z.ZodObject<{
|
|
30
30
|
id: z.ZodUUID;
|
|
@@ -45,9 +45,9 @@ export declare const Position: z.ZodObject<{
|
|
|
45
45
|
USER: "USER";
|
|
46
46
|
LIQUIDATED: "LIQUIDATED";
|
|
47
47
|
}>>>;
|
|
48
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
48
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
49
49
|
closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
-
initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString
|
|
50
|
+
initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
51
51
|
createdAt: z.ZodString;
|
|
52
52
|
updatedAt: z.ZodString;
|
|
53
53
|
}, z.core.$strip>;
|
|
@@ -19,11 +19,41 @@ export declare const PositionListResponse: z.ZodObject<{
|
|
|
19
19
|
USER: "USER";
|
|
20
20
|
LIQUIDATED: "LIQUIDATED";
|
|
21
21
|
}>>>;
|
|
22
|
-
exposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
22
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
23
23
|
closedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
-
initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodString
|
|
24
|
+
initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
25
25
|
createdAt: z.ZodString;
|
|
26
26
|
updatedAt: z.ZodString;
|
|
27
27
|
}, z.core.$strip>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
export type PositionListResponse = z.output<typeof PositionListResponse>;
|
|
30
|
+
export declare const OpenPositionLite: z.ZodObject<{
|
|
31
|
+
id: z.ZodUUID;
|
|
32
|
+
createdAt: z.ZodISODateTime;
|
|
33
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
34
|
+
status: z.ZodLiteral<"OPEN">;
|
|
35
|
+
connector: z.ZodEnum<{
|
|
36
|
+
hyperliquid: "hyperliquid";
|
|
37
|
+
binance: "binance";
|
|
38
|
+
bybit: "bybit";
|
|
39
|
+
okx: "okx";
|
|
40
|
+
lighter: "lighter";
|
|
41
|
+
}>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const OpenPositionLiteListResponse: z.ZodObject<{
|
|
44
|
+
positions: z.ZodArray<z.ZodObject<{
|
|
45
|
+
id: z.ZodUUID;
|
|
46
|
+
createdAt: z.ZodISODateTime;
|
|
47
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
48
|
+
status: z.ZodLiteral<"OPEN">;
|
|
49
|
+
connector: z.ZodEnum<{
|
|
50
|
+
hyperliquid: "hyperliquid";
|
|
51
|
+
binance: "binance";
|
|
52
|
+
bybit: "bybit";
|
|
53
|
+
okx: "okx";
|
|
54
|
+
lighter: "lighter";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type OpenPositionLite = z.output<typeof OpenPositionLite>;
|
|
59
|
+
export type OpenPositionLiteListResponse = z.output<typeof OpenPositionLiteListResponse>;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { Connector } from '../connector';
|
|
3
|
+
import { InstrumentId } from '../instrument';
|
|
2
4
|
import { Position } from './entities';
|
|
3
5
|
|
|
4
6
|
const PositionListResponse = z.object({
|
|
5
7
|
positions: z.array(Position)
|
|
6
8
|
});
|
|
9
|
+
const OpenPositionLite = z.object({
|
|
10
|
+
id: z.uuid(),
|
|
11
|
+
createdAt: z.iso.datetime(),
|
|
12
|
+
exposure: z.record(InstrumentId, z.string()),
|
|
13
|
+
status: z.literal("OPEN"),
|
|
14
|
+
connector: Connector
|
|
15
|
+
});
|
|
16
|
+
const OpenPositionLiteListResponse = z.object({
|
|
17
|
+
positions: z.array(OpenPositionLite)
|
|
18
|
+
});
|
|
7
19
|
|
|
8
|
-
export { PositionListResponse };
|
|
20
|
+
export { OpenPositionLite, OpenPositionLiteListResponse, PositionListResponse };
|