@pear-protocol/types 0.0.21 → 1.0.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/admin/client-ids/entities.d.ts +11 -0
- package/dist/admin/client-ids/entities.js +13 -0
- package/dist/admin/client-ids/index.d.ts +4 -0
- package/dist/admin/client-ids/index.js +4 -0
- package/dist/admin/client-ids/payloads.d.ts +14 -0
- package/dist/admin/client-ids/payloads.js +13 -0
- package/dist/admin/client-ids/queries.d.ts +10 -0
- package/dist/admin/client-ids/queries.js +7 -0
- package/dist/admin/client-ids/responses.d.ts +11 -0
- package/dist/admin/client-ids/responses.js +6 -0
- package/dist/auth/api-keys.d.ts +67 -0
- package/dist/auth/api-keys.js +35 -0
- package/dist/auth/entities.d.ts +1 -0
- package/dist/auth/entities.js +1 -1
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/response.d.ts +2 -0
- package/dist/bundle.d.ts +5 -0
- package/dist/bundle.js +5 -0
- package/dist/common/client-id.d.ts +2 -0
- package/dist/common/client-id.js +5 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/instrument/queries.d.ts +2 -2
- package/dist/market/entities.d.ts +66 -0
- package/dist/market/entities.js +42 -0
- package/dist/market/index.d.ts +3 -0
- package/dist/market/index.js +3 -0
- package/dist/market/queries.d.ts +38 -0
- package/dist/market/queries.js +19 -0
- package/dist/market/responses.d.ts +72 -0
- package/dist/market/responses.js +15 -0
- package/dist/portfolio/entities.d.ts +199 -0
- package/dist/portfolio/entities.js +100 -0
- package/dist/portfolio/index.d.ts +3 -0
- package/dist/portfolio/index.js +3 -0
- package/dist/portfolio/queries.d.ts +46 -0
- package/dist/portfolio/queries.js +20 -0
- package/dist/portfolio/responses.d.ts +172 -0
- package/dist/portfolio/responses.js +16 -0
- package/dist/rebalance/payloads.d.ts +1 -0
- package/dist/rebalance/payloads.js +6 -1
- package/dist/schedule/payloads.d.ts +4 -0
- package/dist/schedule/payloads.js +11 -2
- package/dist/tca/entities.d.ts +8 -0
- package/dist/tca/entities.js +6 -0
- package/dist/tca/index.d.ts +3 -0
- package/dist/tca/index.js +3 -0
- package/dist/tca/queries.d.ts +15 -0
- package/dist/tca/queries.js +14 -0
- package/dist/tca/responses.d.ts +353 -0
- package/dist/tca/responses.js +105 -0
- package/dist/trade/payloads.d.ts +8 -0
- package/dist/trade/payloads.js +21 -4
- package/dist/trigger/entities/conditions.d.ts +170 -0
- package/dist/trigger/entities/conditions.js +43 -3
- package/dist/trigger/entities/index.d.ts +369 -0
- package/dist/trigger/index.d.ts +1 -0
- package/dist/trigger/index.js +1 -0
- package/dist/trigger/oracle.d.ts +31 -0
- package/dist/trigger/oracle.js +15 -0
- package/dist/trigger/payloads/conditions.d.ts +50 -0
- package/dist/trigger/payloads/conditions.js +35 -1
- package/dist/trigger/payloads/index.d.ts +90 -0
- package/dist/trigger/payloads/index.js +16 -3
- package/dist/trigger/responses.d.ts +246 -0
- package/dist/triggers/entities.d.ts +34 -0
- package/dist/triggers/entities.js +21 -0
- package/dist/triggers/index.d.ts +3 -0
- package/dist/triggers/index.js +3 -0
- package/dist/triggers/queries.d.ts +8 -0
- package/dist/triggers/queries.js +10 -0
- package/dist/triggers/responses.d.ts +26 -0
- package/dist/triggers/responses.js +9 -0
- package/dist/users/entities.d.ts +1 -0
- package/dist/users/entities.js +1 -1
- package/dist/users/response.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ClientIdEntity: z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
code: z.ZodString;
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
description: z.ZodOptional<z.ZodString>;
|
|
7
|
+
isActive: z.ZodBoolean;
|
|
8
|
+
createdAt: z.ZodString;
|
|
9
|
+
updatedAt: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ClientIdEntity = z.output<typeof ClientIdEntity>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ClientIdEntity = z.object({
|
|
4
|
+
id: z.uuid(),
|
|
5
|
+
code: z.string(),
|
|
6
|
+
label: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
isActive: z.boolean(),
|
|
9
|
+
createdAt: z.string(),
|
|
10
|
+
updatedAt: z.string()
|
|
11
|
+
}).describe("Client ID registry entry");
|
|
12
|
+
|
|
13
|
+
export { ClientIdEntity };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CreateClientIdPayload: z.ZodObject<{
|
|
3
|
+
code: z.ZodString;
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type CreateClientIdPayloadInput = z.input<typeof CreateClientIdPayload>;
|
|
8
|
+
export type CreateClientIdPayload = z.output<typeof CreateClientIdPayload>;
|
|
9
|
+
export declare const UpdateClientIdPayload: z.ZodObject<{
|
|
10
|
+
label: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type UpdateClientIdPayloadInput = z.input<typeof UpdateClientIdPayload>;
|
|
14
|
+
export type UpdateClientIdPayload = z.output<typeof UpdateClientIdPayload>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const CreateClientIdPayload = z.object({
|
|
4
|
+
code: z.string().min(1).max(64).describe("Stable, immutable attribution key"),
|
|
5
|
+
label: z.string().min(1).max(128),
|
|
6
|
+
description: z.string().max(256).optional()
|
|
7
|
+
}).describe("Payload to create a client ID");
|
|
8
|
+
const UpdateClientIdPayload = z.object({
|
|
9
|
+
label: z.string().min(1).max(128).optional(),
|
|
10
|
+
description: z.string().max(256).optional()
|
|
11
|
+
}).describe("Payload to update a client ID label/description");
|
|
12
|
+
|
|
13
|
+
export { CreateClientIdPayload, UpdateClientIdPayload };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ListClientIdsParams: z.ZodObject<{
|
|
3
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
4
|
+
active: "active";
|
|
5
|
+
inactive: "inactive";
|
|
6
|
+
all: "all";
|
|
7
|
+
}>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type ListClientIdsParamsInput = z.input<typeof ListClientIdsParams>;
|
|
10
|
+
export type ListClientIdsParams = z.output<typeof ListClientIdsParams>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ListClientIdsResponse: z.ZodArray<z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
code: z.ZodString;
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
description: z.ZodOptional<z.ZodString>;
|
|
7
|
+
isActive: z.ZodBoolean;
|
|
8
|
+
createdAt: z.ZodString;
|
|
9
|
+
updatedAt: z.ZodString;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
export type ListClientIdsResponse = z.output<typeof ListClientIdsResponse>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ApiKeyScope: z.ZodEnum<{
|
|
3
|
+
read: "read";
|
|
4
|
+
read_write: "read_write";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const CreateApiKeyInput: z.ZodObject<{
|
|
7
|
+
label: z.ZodString;
|
|
8
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
read: "read";
|
|
10
|
+
read_write: "read_write";
|
|
11
|
+
}>>;
|
|
12
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const CreateApiKeyOutput: z.ZodObject<{
|
|
15
|
+
id: z.ZodUUID;
|
|
16
|
+
label: z.ZodString;
|
|
17
|
+
scope: z.ZodEnum<{
|
|
18
|
+
read: "read";
|
|
19
|
+
read_write: "read_write";
|
|
20
|
+
}>;
|
|
21
|
+
key: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const ApiKeySummary: z.ZodObject<{
|
|
24
|
+
id: z.ZodUUID;
|
|
25
|
+
label: z.ZodString;
|
|
26
|
+
scope: z.ZodEnum<{
|
|
27
|
+
read: "read";
|
|
28
|
+
read_write: "read_write";
|
|
29
|
+
}>;
|
|
30
|
+
keyPrefix: z.ZodString;
|
|
31
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
32
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
33
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
34
|
+
createdAt: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const ListApiKeysOutput: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodUUID;
|
|
38
|
+
label: z.ZodString;
|
|
39
|
+
scope: z.ZodEnum<{
|
|
40
|
+
read: "read";
|
|
41
|
+
read_write: "read_write";
|
|
42
|
+
}>;
|
|
43
|
+
keyPrefix: z.ZodString;
|
|
44
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
45
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
46
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
47
|
+
createdAt: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
export declare const ApiKeyMeResponse: z.ZodObject<{
|
|
50
|
+
id: z.ZodUUID;
|
|
51
|
+
role: z.ZodEnum<{
|
|
52
|
+
basic: "basic";
|
|
53
|
+
pro: "pro";
|
|
54
|
+
admin: "admin";
|
|
55
|
+
}>;
|
|
56
|
+
scope: z.ZodEnum<{
|
|
57
|
+
read: "read";
|
|
58
|
+
read_write: "read_write";
|
|
59
|
+
}>;
|
|
60
|
+
authMethod: z.ZodLiteral<"api_key">;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type ApiKeyScope = z.infer<typeof ApiKeyScope>;
|
|
63
|
+
export type CreateApiKeyInput = z.infer<typeof CreateApiKeyInput>;
|
|
64
|
+
export type CreateApiKeyOutput = z.infer<typeof CreateApiKeyOutput>;
|
|
65
|
+
export type ApiKeySummary = z.infer<typeof ApiKeySummary>;
|
|
66
|
+
export type ListApiKeysOutput = z.infer<typeof ListApiKeysOutput>;
|
|
67
|
+
export type ApiKeyMeResponse = z.infer<typeof ApiKeyMeResponse>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ApiKeyScope = z.enum(["read", "read_write"]).describe("API key access scope");
|
|
4
|
+
const CreateApiKeyInput = z.object({
|
|
5
|
+
label: z.string().trim().min(1, "Label is required").max(100).describe("Human label for the key"),
|
|
6
|
+
scope: ApiKeyScope.default("read"),
|
|
7
|
+
/** ISO-8601 datetime; omit for a key that never expires. */
|
|
8
|
+
expiresAt: z.iso.datetime({ offset: true }).optional().describe("Optional expiry (ISO-8601)")
|
|
9
|
+
}).describe("Create a new API key");
|
|
10
|
+
const CreateApiKeyOutput = z.object({
|
|
11
|
+
id: z.uuid(),
|
|
12
|
+
label: z.string(),
|
|
13
|
+
scope: ApiKeyScope,
|
|
14
|
+
/** Raw secret — returned only once, at creation. */
|
|
15
|
+
key: z.string()
|
|
16
|
+
}).describe("Newly created API key (raw secret shown once)");
|
|
17
|
+
const ApiKeySummary = z.object({
|
|
18
|
+
id: z.uuid(),
|
|
19
|
+
label: z.string(),
|
|
20
|
+
scope: ApiKeyScope,
|
|
21
|
+
keyPrefix: z.string(),
|
|
22
|
+
lastUsedAt: z.string().nullable(),
|
|
23
|
+
expiresAt: z.string().nullable(),
|
|
24
|
+
revokedAt: z.string().nullable(),
|
|
25
|
+
createdAt: z.string()
|
|
26
|
+
});
|
|
27
|
+
const ListApiKeysOutput = z.array(ApiKeySummary).describe("All API keys for the user");
|
|
28
|
+
const ApiKeyMeResponse = z.object({
|
|
29
|
+
id: z.uuid().describe("User UUID that owns the API key"),
|
|
30
|
+
role: z.enum(["basic", "pro", "admin"]).describe("User role"),
|
|
31
|
+
scope: ApiKeyScope,
|
|
32
|
+
authMethod: z.literal("api_key")
|
|
33
|
+
}).describe("Identity of the caller authenticated via an API key");
|
|
34
|
+
|
|
35
|
+
export { ApiKeyMeResponse, ApiKeyScope, ApiKeySummary, CreateApiKeyInput, CreateApiKeyOutput, ListApiKeysOutput };
|
package/dist/auth/entities.d.ts
CHANGED
package/dist/auth/entities.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
const LoginMethod = z.enum(["email", "evm_wallet"]).describe("Authentication provider used for the current session");
|
|
4
4
|
const AuthenticatedUser = z.object({
|
|
5
5
|
id: z.uuid().describe("User UUID"),
|
|
6
|
-
role: z.enum(["basic", "pro"]).describe("User role"),
|
|
6
|
+
role: z.enum(["basic", "pro", "admin"]).describe("User role"),
|
|
7
7
|
providerId: z.string().nullable().describe("Provider identifier (wallet address or email)"),
|
|
8
8
|
loginMethod: LoginMethod.describe("Authentication provider used for the current session")
|
|
9
9
|
}).describe("Current authenticated user info");
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.js
CHANGED
package/dist/auth/response.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const LoginResponse: z.ZodObject<{
|
|
|
7
7
|
role: z.ZodEnum<{
|
|
8
8
|
basic: "basic";
|
|
9
9
|
pro: "pro";
|
|
10
|
+
admin: "admin";
|
|
10
11
|
}>;
|
|
11
12
|
providerId: z.ZodNullable<z.ZodString>;
|
|
12
13
|
loginMethod: z.ZodEnum<{
|
|
@@ -41,6 +42,7 @@ export declare const MeResponse: z.ZodObject<{
|
|
|
41
42
|
role: z.ZodEnum<{
|
|
42
43
|
basic: "basic";
|
|
43
44
|
pro: "pro";
|
|
45
|
+
admin: "admin";
|
|
44
46
|
}>;
|
|
45
47
|
providerId: z.ZodNullable<z.ZodString>;
|
|
46
48
|
loginMethod: z.ZodEnum<{
|
package/dist/bundle.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './admin/client-ids';
|
|
1
2
|
export * from './auth';
|
|
2
3
|
export * from './common/trade-legs';
|
|
3
4
|
export * from './connector';
|
|
@@ -7,15 +8,19 @@ export * from './funding';
|
|
|
7
8
|
export * from './instrument';
|
|
8
9
|
export * from './instrument-precision';
|
|
9
10
|
export * from './leverage';
|
|
11
|
+
export * from './market';
|
|
10
12
|
export * from './misc';
|
|
11
13
|
export * from './order';
|
|
14
|
+
export * from './portfolio';
|
|
12
15
|
export * from './position';
|
|
13
16
|
export * from './price';
|
|
14
17
|
export * from './rebalance';
|
|
15
18
|
export * from './schedule';
|
|
16
19
|
export * from './statistics';
|
|
17
20
|
export * from './sync';
|
|
21
|
+
export * from './tca';
|
|
18
22
|
export * from './trade';
|
|
19
23
|
export * from './trade-accounts';
|
|
20
24
|
export * from './trigger';
|
|
25
|
+
export * from './triggers';
|
|
21
26
|
export * from './users';
|
package/dist/bundle.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './admin/client-ids';
|
|
1
2
|
export * from './auth';
|
|
2
3
|
export * from './common/trade-legs';
|
|
3
4
|
export * from './connector';
|
|
@@ -7,15 +8,19 @@ export * from './funding';
|
|
|
7
8
|
export * from './instrument';
|
|
8
9
|
export * from './instrument-precision';
|
|
9
10
|
export * from './leverage';
|
|
11
|
+
export * from './market';
|
|
10
12
|
export * from './misc';
|
|
11
13
|
export * from './order';
|
|
14
|
+
export * from './portfolio';
|
|
12
15
|
export * from './position';
|
|
13
16
|
export * from './price';
|
|
14
17
|
export * from './rebalance';
|
|
15
18
|
export * from './schedule';
|
|
16
19
|
export * from './statistics';
|
|
17
20
|
export * from './sync';
|
|
21
|
+
export * from './tca';
|
|
18
22
|
export * from './trade';
|
|
19
23
|
export * from './trade-accounts';
|
|
20
24
|
export * from './trigger';
|
|
25
|
+
export * from './triggers';
|
|
21
26
|
export * from './users';
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const InstrumentScope: z.ZodEnum<{
|
|
3
|
+
all: "all";
|
|
3
4
|
tradable: "tradable";
|
|
4
5
|
reduce_only: "reduce_only";
|
|
5
6
|
not_tradable: "not_tradable";
|
|
6
|
-
all: "all";
|
|
7
7
|
}>;
|
|
8
8
|
export type InstrumentScope = z.infer<typeof InstrumentScope>;
|
|
9
9
|
export declare const InstrumentListParams: z.ZodObject<{
|
|
@@ -15,10 +15,10 @@ export declare const InstrumentListParams: z.ZodObject<{
|
|
|
15
15
|
lighter: "lighter";
|
|
16
16
|
}>;
|
|
17
17
|
scope: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
all: "all";
|
|
18
19
|
tradable: "tradable";
|
|
19
20
|
reduce_only: "reduce_only";
|
|
20
21
|
not_tradable: "not_tradable";
|
|
21
|
-
all: "all";
|
|
22
22
|
}>>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
export type InstrumentListParamsInput = z.input<typeof InstrumentListParams>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Market: z.ZodObject<{
|
|
3
|
+
connector: z.ZodEnum<{
|
|
4
|
+
hyperliquid: "hyperliquid";
|
|
5
|
+
binance: "binance";
|
|
6
|
+
bybit: "bybit";
|
|
7
|
+
okx: "okx";
|
|
8
|
+
lighter: "lighter";
|
|
9
|
+
}>;
|
|
10
|
+
instrumentId: z.ZodString;
|
|
11
|
+
displaySymbol: z.ZodString;
|
|
12
|
+
base: z.ZodString;
|
|
13
|
+
quote: z.ZodString;
|
|
14
|
+
price: z.ZodString;
|
|
15
|
+
volume24h: z.ZodString;
|
|
16
|
+
change24h: z.ZodString;
|
|
17
|
+
openInterest: z.ZodString;
|
|
18
|
+
fundingRate: z.ZodString;
|
|
19
|
+
tradeability: z.ZodObject<{
|
|
20
|
+
status: z.ZodEnum<{
|
|
21
|
+
tradable: "tradable";
|
|
22
|
+
reduce_only: "reduce_only";
|
|
23
|
+
not_tradable: "not_tradable";
|
|
24
|
+
}>;
|
|
25
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
updatedAt: z.ZodNumber;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type Market = z.output<typeof Market>;
|
|
30
|
+
export declare const BasketMarket: z.ZodObject<{
|
|
31
|
+
connector: z.ZodEnum<{
|
|
32
|
+
hyperliquid: "hyperliquid";
|
|
33
|
+
binance: "binance";
|
|
34
|
+
bybit: "bybit";
|
|
35
|
+
okx: "okx";
|
|
36
|
+
lighter: "lighter";
|
|
37
|
+
}>;
|
|
38
|
+
basketKey: z.ZodString;
|
|
39
|
+
displaySymbol: z.ZodString;
|
|
40
|
+
longInstrumentIds: z.ZodArray<z.ZodString>;
|
|
41
|
+
shortInstrumentIds: z.ZodArray<z.ZodString>;
|
|
42
|
+
price: z.ZodString;
|
|
43
|
+
priceChange24h: z.ZodString;
|
|
44
|
+
weightRatio: z.ZodString;
|
|
45
|
+
weightRatioChange24h: z.ZodString;
|
|
46
|
+
netFunding: z.ZodString;
|
|
47
|
+
volume24h: z.ZodString;
|
|
48
|
+
openInterest: z.ZodString;
|
|
49
|
+
tradeability: z.ZodObject<{
|
|
50
|
+
status: z.ZodEnum<{
|
|
51
|
+
tradable: "tradable";
|
|
52
|
+
reduce_only: "reduce_only";
|
|
53
|
+
not_tradable: "not_tradable";
|
|
54
|
+
}>;
|
|
55
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
updatedAt: z.ZodNumber;
|
|
58
|
+
hasMaterializedStats: z.ZodBoolean;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type BasketMarket = z.output<typeof BasketMarket>;
|
|
61
|
+
export declare const MarketTotals: z.ZodObject<{
|
|
62
|
+
markets: z.ZodNumber;
|
|
63
|
+
volume24h: z.ZodString;
|
|
64
|
+
openInterest: z.ZodString;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type MarketTotals = z.output<typeof MarketTotals>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Connector } from '../connector';
|
|
3
|
+
import { InstrumentTradeability, InstrumentId } from '../instrument';
|
|
4
|
+
|
|
5
|
+
const Market = z.object({
|
|
6
|
+
connector: Connector,
|
|
7
|
+
instrumentId: InstrumentId,
|
|
8
|
+
displaySymbol: z.string(),
|
|
9
|
+
base: z.string(),
|
|
10
|
+
quote: z.string(),
|
|
11
|
+
price: z.string(),
|
|
12
|
+
volume24h: z.string(),
|
|
13
|
+
change24h: z.string(),
|
|
14
|
+
openInterest: z.string(),
|
|
15
|
+
fundingRate: z.string(),
|
|
16
|
+
tradeability: InstrumentTradeability,
|
|
17
|
+
updatedAt: z.number()
|
|
18
|
+
});
|
|
19
|
+
const BasketMarket = z.object({
|
|
20
|
+
connector: Connector,
|
|
21
|
+
basketKey: z.string(),
|
|
22
|
+
displaySymbol: z.string(),
|
|
23
|
+
longInstrumentIds: z.array(InstrumentId),
|
|
24
|
+
shortInstrumentIds: z.array(InstrumentId),
|
|
25
|
+
price: z.string(),
|
|
26
|
+
priceChange24h: z.string(),
|
|
27
|
+
weightRatio: z.string(),
|
|
28
|
+
weightRatioChange24h: z.string(),
|
|
29
|
+
netFunding: z.string(),
|
|
30
|
+
volume24h: z.string(),
|
|
31
|
+
openInterest: z.string(),
|
|
32
|
+
tradeability: InstrumentTradeability,
|
|
33
|
+
updatedAt: z.number(),
|
|
34
|
+
hasMaterializedStats: z.boolean()
|
|
35
|
+
});
|
|
36
|
+
const MarketTotals = z.object({
|
|
37
|
+
markets: z.number(),
|
|
38
|
+
volume24h: z.string(),
|
|
39
|
+
openInterest: z.string()
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { BasketMarket, Market, MarketTotals };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MarketsQueryParams: z.ZodObject<{
|
|
3
|
+
connector: z.ZodEnum<{
|
|
4
|
+
hyperliquid: "hyperliquid";
|
|
5
|
+
binance: "binance";
|
|
6
|
+
bybit: "bybit";
|
|
7
|
+
okx: "okx";
|
|
8
|
+
lighter: "lighter";
|
|
9
|
+
}>;
|
|
10
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
all: "all";
|
|
12
|
+
tradable: "tradable";
|
|
13
|
+
reduce_only: "reduce_only";
|
|
14
|
+
not_tradable: "not_tradable";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type MarketsQueryParamsInput = z.input<typeof MarketsQueryParams>;
|
|
18
|
+
export type MarketsQueryParams = z.output<typeof MarketsQueryParams>;
|
|
19
|
+
export declare const MarketBasketsQueryParams: z.ZodObject<{
|
|
20
|
+
connector: z.ZodEnum<{
|
|
21
|
+
hyperliquid: "hyperliquid";
|
|
22
|
+
binance: "binance";
|
|
23
|
+
bybit: "bybit";
|
|
24
|
+
okx: "okx";
|
|
25
|
+
lighter: "lighter";
|
|
26
|
+
}>;
|
|
27
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
28
|
+
all: "all";
|
|
29
|
+
tradable: "tradable";
|
|
30
|
+
reduce_only: "reduce_only";
|
|
31
|
+
not_tradable: "not_tradable";
|
|
32
|
+
}>>;
|
|
33
|
+
search: z.ZodOptional<z.ZodString>;
|
|
34
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
35
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type MarketBasketsQueryParamsInput = z.input<typeof MarketBasketsQueryParams>;
|
|
38
|
+
export type MarketBasketsQueryParams = z.output<typeof MarketBasketsQueryParams>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Connector } from '../connector';
|
|
3
|
+
import { InstrumentScope } from '../instrument';
|
|
4
|
+
|
|
5
|
+
const MarketsQueryParams = z.object({
|
|
6
|
+
connector: Connector,
|
|
7
|
+
// Markets are connector-scoped so the API can return one exchange's live view
|
|
8
|
+
// without mixing instruments that have different ids, liquidity, or stats feeds.
|
|
9
|
+
scope: InstrumentScope.default("tradable")
|
|
10
|
+
});
|
|
11
|
+
const MarketBasketsQueryParams = z.object({
|
|
12
|
+
connector: Connector,
|
|
13
|
+
scope: InstrumentScope.default("tradable"),
|
|
14
|
+
search: z.string().trim().max(128).optional(),
|
|
15
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(500),
|
|
16
|
+
offset: z.coerce.number().int().min(0).default(0)
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { MarketBasketsQueryParams, MarketsQueryParams };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MarketsResponse: z.ZodObject<{
|
|
3
|
+
markets: z.ZodArray<z.ZodObject<{
|
|
4
|
+
connector: z.ZodEnum<{
|
|
5
|
+
hyperliquid: "hyperliquid";
|
|
6
|
+
binance: "binance";
|
|
7
|
+
bybit: "bybit";
|
|
8
|
+
okx: "okx";
|
|
9
|
+
lighter: "lighter";
|
|
10
|
+
}>;
|
|
11
|
+
instrumentId: z.ZodString;
|
|
12
|
+
displaySymbol: z.ZodString;
|
|
13
|
+
base: z.ZodString;
|
|
14
|
+
quote: z.ZodString;
|
|
15
|
+
price: z.ZodString;
|
|
16
|
+
volume24h: z.ZodString;
|
|
17
|
+
change24h: z.ZodString;
|
|
18
|
+
openInterest: z.ZodString;
|
|
19
|
+
fundingRate: z.ZodString;
|
|
20
|
+
tradeability: z.ZodObject<{
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
tradable: "tradable";
|
|
23
|
+
reduce_only: "reduce_only";
|
|
24
|
+
not_tradable: "not_tradable";
|
|
25
|
+
}>;
|
|
26
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
updatedAt: z.ZodNumber;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
totals: z.ZodObject<{
|
|
31
|
+
markets: z.ZodNumber;
|
|
32
|
+
volume24h: z.ZodString;
|
|
33
|
+
openInterest: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type MarketsResponse = z.output<typeof MarketsResponse>;
|
|
37
|
+
export declare const MarketBasketsResponse: z.ZodObject<{
|
|
38
|
+
limit: z.ZodNumber;
|
|
39
|
+
offset: z.ZodNumber;
|
|
40
|
+
count: z.ZodNumber;
|
|
41
|
+
markets: z.ZodArray<z.ZodObject<{
|
|
42
|
+
connector: z.ZodEnum<{
|
|
43
|
+
hyperliquid: "hyperliquid";
|
|
44
|
+
binance: "binance";
|
|
45
|
+
bybit: "bybit";
|
|
46
|
+
okx: "okx";
|
|
47
|
+
lighter: "lighter";
|
|
48
|
+
}>;
|
|
49
|
+
basketKey: z.ZodString;
|
|
50
|
+
displaySymbol: z.ZodString;
|
|
51
|
+
longInstrumentIds: z.ZodArray<z.ZodString>;
|
|
52
|
+
shortInstrumentIds: z.ZodArray<z.ZodString>;
|
|
53
|
+
price: z.ZodString;
|
|
54
|
+
priceChange24h: z.ZodString;
|
|
55
|
+
weightRatio: z.ZodString;
|
|
56
|
+
weightRatioChange24h: z.ZodString;
|
|
57
|
+
netFunding: z.ZodString;
|
|
58
|
+
volume24h: z.ZodString;
|
|
59
|
+
openInterest: z.ZodString;
|
|
60
|
+
tradeability: z.ZodObject<{
|
|
61
|
+
status: z.ZodEnum<{
|
|
62
|
+
tradable: "tradable";
|
|
63
|
+
reduce_only: "reduce_only";
|
|
64
|
+
not_tradable: "not_tradable";
|
|
65
|
+
}>;
|
|
66
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
updatedAt: z.ZodNumber;
|
|
69
|
+
hasMaterializedStats: z.ZodBoolean;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export type MarketBasketsResponse = z.output<typeof MarketBasketsResponse>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketTotals, Market, BasketMarket } from './entities';
|
|
3
|
+
|
|
4
|
+
const MarketsResponse = z.object({
|
|
5
|
+
markets: z.array(Market),
|
|
6
|
+
totals: MarketTotals
|
|
7
|
+
});
|
|
8
|
+
const MarketBasketsResponse = z.object({
|
|
9
|
+
limit: z.number(),
|
|
10
|
+
offset: z.number(),
|
|
11
|
+
count: z.number(),
|
|
12
|
+
markets: z.array(BasketMarket)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { MarketBasketsResponse, MarketsResponse };
|