@pear-protocol/types 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/entities.d.ts +9 -0
- package/dist/auth/entities.js +8 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/payloads.d.ts +50 -0
- package/dist/auth/payloads.js +39 -0
- package/dist/auth/response.d.ts +55 -0
- package/dist/auth/response.js +21 -0
- package/dist/bundle.d.ts +17 -0
- package/dist/bundle.js +17 -0
- package/dist/common/array.d.ts +10 -0
- package/dist/common/array.js +10 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/refinement.d.ts +20 -0
- package/dist/common/refinement.js +60 -0
- package/dist/common/request.d.ts +11 -0
- package/dist/common/request.js +24 -0
- package/dist/common/response.d.ts +12 -0
- package/dist/common/response.js +28 -0
- package/dist/common/schema.d.ts +8 -0
- package/dist/common/schema.js +10 -0
- package/dist/common/trade-legs.d.ts +34 -0
- package/dist/common/trade-legs.js +30 -0
- package/dist/connector/index.d.ts +8 -0
- package/dist/connector/index.js +5 -0
- package/dist/execution/entities.d.ts +741 -0
- package/dist/execution/entities.js +125 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/queries.d.ts +20 -0
- package/dist/execution/queries.js +14 -0
- package/dist/execution/responses.d.ts +218 -0
- package/dist/execution/responses.js +9 -0
- package/dist/fill/entities.d.ts +25 -0
- package/dist/fill/entities.js +61 -0
- package/dist/fill/index.d.ts +3 -0
- package/dist/fill/index.js +3 -0
- package/dist/fill/queries.d.ts +13 -0
- package/dist/fill/queries.js +11 -0
- package/dist/fill/responses.d.ts +55 -0
- package/dist/fill/responses.js +12 -0
- package/dist/funding/entities.d.ts +11 -0
- package/dist/funding/entities.js +16 -0
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.js +3 -0
- package/dist/funding/queries.d.ts +10 -0
- package/dist/funding/queries.js +8 -0
- package/dist/funding/responses.d.ts +8 -0
- package/dist/funding/responses.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/instrument/entities.d.ts +43 -0
- package/dist/instrument/entities.js +48 -0
- package/dist/instrument/index.d.ts +3 -0
- package/dist/instrument/index.js +3 -0
- package/dist/instrument/queries.d.ts +10 -0
- package/dist/instrument/queries.js +8 -0
- package/dist/instrument/responses.d.ts +37 -0
- package/dist/instrument/responses.js +11 -0
- package/dist/instrument-precision/index.d.ts +18 -0
- package/dist/instrument-precision/index.js +51 -0
- package/dist/misc/index.d.ts +3 -0
- package/dist/misc/index.js +1 -0
- package/dist/order/entities.d.ts +73 -0
- package/dist/order/entities.js +73 -0
- package/dist/order/index.d.ts +1 -0
- package/dist/order/index.js +1 -0
- package/dist/position/entities.d.ts +53 -0
- package/dist/position/entities.js +55 -0
- package/dist/position/index.d.ts +3 -0
- package/dist/position/index.js +3 -0
- package/dist/position/queries.d.ts +16 -0
- package/dist/position/queries.js +28 -0
- package/dist/position/responses.d.ts +28 -0
- package/dist/position/responses.js +8 -0
- package/dist/price/entities.d.ts +8 -0
- package/dist/price/entities.js +7 -0
- package/dist/price/index.d.ts +3 -0
- package/dist/price/index.js +3 -0
- package/dist/price/queries.d.ts +10 -0
- package/dist/price/queries.js +8 -0
- package/dist/price/responses.d.ts +6 -0
- package/dist/price/responses.js +15 -0
- package/dist/schedule/entities.d.ts +380 -0
- package/dist/schedule/entities.js +159 -0
- package/dist/schedule/index.d.ts +4 -0
- package/dist/schedule/index.js +4 -0
- package/dist/schedule/payloads.d.ts +72 -0
- package/dist/schedule/payloads.js +102 -0
- package/dist/schedule/queries.d.ts +18 -0
- package/dist/schedule/queries.js +12 -0
- package/dist/schedule/responses.d.ts +279 -0
- package/dist/schedule/responses.js +10 -0
- package/dist/trade/index.d.ts +2 -0
- package/dist/trade/index.js +2 -0
- package/dist/trade/payloads.d.ts +217 -0
- package/dist/trade/payloads.js +35 -0
- package/dist/trade/responses.d.ts +861 -0
- package/dist/trade/responses.js +9 -0
- package/dist/trade-accounts/entities.d.ts +50 -0
- package/dist/trade-accounts/entities.js +18 -0
- package/dist/trade-accounts/index.d.ts +3 -0
- package/dist/trade-accounts/index.js +3 -0
- package/dist/trade-accounts/payloads.d.ts +137 -0
- package/dist/trade-accounts/payloads.js +84 -0
- package/dist/trade-accounts/response.d.ts +65 -0
- package/dist/trade-accounts/response.js +41 -0
- package/dist/trigger/entities/conditions.d.ts +407 -0
- package/dist/trigger/entities/conditions.js +239 -0
- package/dist/trigger/entities/index.d.ts +1549 -0
- package/dist/trigger/entities/index.js +123 -0
- package/dist/trigger/index.d.ts +6 -0
- package/dist/trigger/index.js +6 -0
- package/dist/trigger/payloads/conditions.d.ts +340 -0
- package/dist/trigger/payloads/conditions.js +109 -0
- package/dist/trigger/payloads/index.d.ts +470 -0
- package/dist/trigger/payloads/index.js +47 -0
- package/dist/trigger/queries.d.ts +18 -0
- package/dist/trigger/queries.js +12 -0
- package/dist/trigger/responses.d.ts +1001 -0
- package/dist/trigger/responses.js +10 -0
- package/dist/users/entities.d.ts +16 -0
- package/dist/users/entities.js +14 -0
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +3 -0
- package/dist/users/payloads.d.ts +5 -0
- package/dist/users/payloads.js +7 -0
- package/dist/users/response.d.ts +23 -0
- package/dist/users/response.js +12 -0
- package/package.json +35 -0
|
@@ -0,0 +1,125 @@
|
|
|
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(["OPEN", "CLOSE", "ADJUST"]);
|
|
9
|
+
const ExecutionOrderType = z.enum(["MARKET"]);
|
|
10
|
+
const ExecutionStatus = z.enum(["IDLE", "ACTIVE", "COMPLETED", "FAILED", "CANCELLED"]);
|
|
11
|
+
const ExecutionLegMode = z.enum(["QUANTITY", "USD"]);
|
|
12
|
+
const ExecutionLeg = z.object({
|
|
13
|
+
/**
|
|
14
|
+
* Instrument ID
|
|
15
|
+
*/
|
|
16
|
+
symbol: InstrumentId,
|
|
17
|
+
/**
|
|
18
|
+
* Side
|
|
19
|
+
*/
|
|
20
|
+
side: Side,
|
|
21
|
+
/**
|
|
22
|
+
* Mode to interpret the amount
|
|
23
|
+
*/
|
|
24
|
+
mode: ExecutionLegMode,
|
|
25
|
+
/**
|
|
26
|
+
* Quantity or USD amount
|
|
27
|
+
*/
|
|
28
|
+
amount: UnsignedDecimalString,
|
|
29
|
+
/**
|
|
30
|
+
* Reduce only flag
|
|
31
|
+
*/
|
|
32
|
+
reduceOnly: z.boolean()
|
|
33
|
+
});
|
|
34
|
+
const BaseExecution = z.object({
|
|
35
|
+
/**
|
|
36
|
+
* Execution UUID
|
|
37
|
+
*/
|
|
38
|
+
id: z.uuid(),
|
|
39
|
+
/**
|
|
40
|
+
* Connector
|
|
41
|
+
*/
|
|
42
|
+
connector: Connector,
|
|
43
|
+
/**
|
|
44
|
+
* Intent
|
|
45
|
+
*/
|
|
46
|
+
intent: ExecutionIntent,
|
|
47
|
+
/**
|
|
48
|
+
* Order type
|
|
49
|
+
*/
|
|
50
|
+
orderType: ExecutionOrderType,
|
|
51
|
+
/**
|
|
52
|
+
* Status
|
|
53
|
+
*/
|
|
54
|
+
status: ExecutionStatus,
|
|
55
|
+
/**
|
|
56
|
+
* Error message
|
|
57
|
+
*/
|
|
58
|
+
error: z.string().optional(),
|
|
59
|
+
/**
|
|
60
|
+
* Created at timestamp
|
|
61
|
+
*/
|
|
62
|
+
createdAt: z.string(),
|
|
63
|
+
/**
|
|
64
|
+
* Updated at timestamp
|
|
65
|
+
*/
|
|
66
|
+
updatedAt: z.string(),
|
|
67
|
+
/**
|
|
68
|
+
* Orders
|
|
69
|
+
*/
|
|
70
|
+
orders: z.array(Order).optional()
|
|
71
|
+
});
|
|
72
|
+
const MarketOpenExecution = BaseExecution.extend({
|
|
73
|
+
/**
|
|
74
|
+
* Intent
|
|
75
|
+
*/
|
|
76
|
+
intent: z.literal("OPEN"),
|
|
77
|
+
/**
|
|
78
|
+
* Order type
|
|
79
|
+
*/
|
|
80
|
+
orderType: z.literal("MARKET"),
|
|
81
|
+
/**
|
|
82
|
+
* Requested legs
|
|
83
|
+
*/
|
|
84
|
+
legs: z.tuple([ExecutionLeg]).rest(ExecutionLeg)
|
|
85
|
+
});
|
|
86
|
+
const MarketAdjustExecution = BaseExecution.extend({
|
|
87
|
+
/**
|
|
88
|
+
* Intent
|
|
89
|
+
*/
|
|
90
|
+
intent: z.literal("ADJUST"),
|
|
91
|
+
/**
|
|
92
|
+
* Order type
|
|
93
|
+
*/
|
|
94
|
+
orderType: z.literal("MARKET"),
|
|
95
|
+
/**
|
|
96
|
+
* Position
|
|
97
|
+
*/
|
|
98
|
+
position: Position.pick({ id: true, exposure: true }),
|
|
99
|
+
/**
|
|
100
|
+
* Requested legs
|
|
101
|
+
*/
|
|
102
|
+
legs: z.tuple([ExecutionLeg]).rest(ExecutionLeg)
|
|
103
|
+
});
|
|
104
|
+
const MarketCloseExecution = BaseExecution.extend({
|
|
105
|
+
/**
|
|
106
|
+
* Intent
|
|
107
|
+
*/
|
|
108
|
+
intent: z.literal("CLOSE"),
|
|
109
|
+
/**
|
|
110
|
+
* Order type
|
|
111
|
+
*/
|
|
112
|
+
orderType: z.literal("MARKET"),
|
|
113
|
+
/**
|
|
114
|
+
* Position
|
|
115
|
+
*/
|
|
116
|
+
position: Position.pick({ id: true, exposure: true })
|
|
117
|
+
});
|
|
118
|
+
const MarketExecution = z.discriminatedUnion("intent", [
|
|
119
|
+
MarketOpenExecution,
|
|
120
|
+
MarketAdjustExecution,
|
|
121
|
+
MarketCloseExecution
|
|
122
|
+
]);
|
|
123
|
+
const Execution = z.discriminatedUnion("orderType", [MarketExecution]);
|
|
124
|
+
|
|
125
|
+
export { BaseExecution, Execution, ExecutionIntent, ExecutionLegMode, ExecutionOrderType, ExecutionStatus, MarketAdjustExecution, MarketCloseExecution, MarketExecution, MarketOpenExecution };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ExecutionListParams: z.ZodObject<{
|
|
3
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
|
|
4
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
5
|
+
connector: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
hyperliquid: "hyperliquid";
|
|
7
|
+
binanceusdm: "binanceusdm";
|
|
8
|
+
bybit: "bybit";
|
|
9
|
+
okx: "okx";
|
|
10
|
+
}>>;
|
|
11
|
+
status: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[] | (("CANCELLED" | "ACTIVE" | "COMPLETED")[] & any[]) | undefined, ("CANCELLED" | "ACTIVE" | "COMPLETED")[]>, z.ZodArray<z.ZodEnum<{
|
|
12
|
+
CANCELLED: "CANCELLED";
|
|
13
|
+
ACTIVE: "ACTIVE";
|
|
14
|
+
COMPLETED: "COMPLETED";
|
|
15
|
+
}>>>>;
|
|
16
|
+
includeSchedule: z.ZodDefault<z.ZodOptional<z.ZodCoercedBoolean<boolean>>>;
|
|
17
|
+
includeTriggers: z.ZodDefault<z.ZodOptional<z.ZodCoercedBoolean<boolean>>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ExecutionListParamsInput = z.input<typeof ExecutionListParams>;
|
|
20
|
+
export type ExecutionListParams = z.output<typeof ExecutionListParams>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { normalizeArray, CursorFindParams } from '../common';
|
|
3
|
+
import { Connector } from '../connector';
|
|
4
|
+
|
|
5
|
+
const StatusEnum = z.enum(["ACTIVE", "COMPLETED", "CANCELLED"]);
|
|
6
|
+
const StatusArray = z.preprocess((arg) => normalizeArray(arg), z.array(StatusEnum));
|
|
7
|
+
const ExecutionListParams = CursorFindParams.extend({
|
|
8
|
+
connector: Connector.optional(),
|
|
9
|
+
status: StatusArray.optional(),
|
|
10
|
+
includeSchedule: z.coerce.boolean().optional().default(false),
|
|
11
|
+
includeTriggers: z.coerce.boolean().optional().default(false)
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { ExecutionListParams };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ExecutionListResponse: z.ZodObject<{
|
|
3
|
+
limit: z.ZodNumber;
|
|
4
|
+
nextCursor: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
5
|
+
executions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
id: z.ZodUUID;
|
|
7
|
+
connector: z.ZodEnum<{
|
|
8
|
+
hyperliquid: "hyperliquid";
|
|
9
|
+
binanceusdm: "binanceusdm";
|
|
10
|
+
bybit: "bybit";
|
|
11
|
+
okx: "okx";
|
|
12
|
+
}>;
|
|
13
|
+
status: z.ZodEnum<{
|
|
14
|
+
CANCELLED: "CANCELLED";
|
|
15
|
+
IDLE: "IDLE";
|
|
16
|
+
ACTIVE: "ACTIVE";
|
|
17
|
+
COMPLETED: "COMPLETED";
|
|
18
|
+
FAILED: "FAILED";
|
|
19
|
+
}>;
|
|
20
|
+
error: z.ZodOptional<z.ZodString>;
|
|
21
|
+
createdAt: z.ZodString;
|
|
22
|
+
updatedAt: z.ZodString;
|
|
23
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
id: z.ZodUUID;
|
|
25
|
+
connector: z.ZodEnum<{
|
|
26
|
+
hyperliquid: "hyperliquid";
|
|
27
|
+
binanceusdm: "binanceusdm";
|
|
28
|
+
bybit: "bybit";
|
|
29
|
+
okx: "okx";
|
|
30
|
+
}>;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
PENDING: "PENDING";
|
|
33
|
+
PARTIAL: "PARTIAL";
|
|
34
|
+
FILLED: "FILLED";
|
|
35
|
+
CANCELLED: "CANCELLED";
|
|
36
|
+
REJECTED: "REJECTED";
|
|
37
|
+
}>;
|
|
38
|
+
error: z.ZodOptional<z.ZodString>;
|
|
39
|
+
createdAt: z.ZodString;
|
|
40
|
+
updatedAt: z.ZodString;
|
|
41
|
+
type: z.ZodLiteral<"MARKET">;
|
|
42
|
+
symbol: z.ZodString;
|
|
43
|
+
side: z.ZodEnum<{
|
|
44
|
+
BUY: "BUY";
|
|
45
|
+
SELL: "SELL";
|
|
46
|
+
}>;
|
|
47
|
+
reduceOnly: z.ZodBoolean;
|
|
48
|
+
leverage: z.ZodInt;
|
|
49
|
+
quantity: z.ZodString;
|
|
50
|
+
price: z.ZodString;
|
|
51
|
+
filledQuantity: z.ZodString;
|
|
52
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>], "type">>>;
|
|
54
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
55
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
56
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
57
|
+
symbol: z.ZodString;
|
|
58
|
+
side: z.ZodEnum<{
|
|
59
|
+
BUY: "BUY";
|
|
60
|
+
SELL: "SELL";
|
|
61
|
+
}>;
|
|
62
|
+
mode: z.ZodEnum<{
|
|
63
|
+
QUANTITY: "QUANTITY";
|
|
64
|
+
USD: "USD";
|
|
65
|
+
}>;
|
|
66
|
+
amount: z.ZodString;
|
|
67
|
+
reduceOnly: z.ZodBoolean;
|
|
68
|
+
}, z.core.$strip>], z.ZodObject<{
|
|
69
|
+
symbol: z.ZodString;
|
|
70
|
+
side: z.ZodEnum<{
|
|
71
|
+
BUY: "BUY";
|
|
72
|
+
SELL: "SELL";
|
|
73
|
+
}>;
|
|
74
|
+
mode: z.ZodEnum<{
|
|
75
|
+
QUANTITY: "QUANTITY";
|
|
76
|
+
USD: "USD";
|
|
77
|
+
}>;
|
|
78
|
+
amount: z.ZodString;
|
|
79
|
+
reduceOnly: z.ZodBoolean;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
id: z.ZodUUID;
|
|
83
|
+
connector: z.ZodEnum<{
|
|
84
|
+
hyperliquid: "hyperliquid";
|
|
85
|
+
binanceusdm: "binanceusdm";
|
|
86
|
+
bybit: "bybit";
|
|
87
|
+
okx: "okx";
|
|
88
|
+
}>;
|
|
89
|
+
status: z.ZodEnum<{
|
|
90
|
+
CANCELLED: "CANCELLED";
|
|
91
|
+
IDLE: "IDLE";
|
|
92
|
+
ACTIVE: "ACTIVE";
|
|
93
|
+
COMPLETED: "COMPLETED";
|
|
94
|
+
FAILED: "FAILED";
|
|
95
|
+
}>;
|
|
96
|
+
error: z.ZodOptional<z.ZodString>;
|
|
97
|
+
createdAt: z.ZodString;
|
|
98
|
+
updatedAt: z.ZodString;
|
|
99
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
id: z.ZodUUID;
|
|
101
|
+
connector: z.ZodEnum<{
|
|
102
|
+
hyperliquid: "hyperliquid";
|
|
103
|
+
binanceusdm: "binanceusdm";
|
|
104
|
+
bybit: "bybit";
|
|
105
|
+
okx: "okx";
|
|
106
|
+
}>;
|
|
107
|
+
status: z.ZodEnum<{
|
|
108
|
+
PENDING: "PENDING";
|
|
109
|
+
PARTIAL: "PARTIAL";
|
|
110
|
+
FILLED: "FILLED";
|
|
111
|
+
CANCELLED: "CANCELLED";
|
|
112
|
+
REJECTED: "REJECTED";
|
|
113
|
+
}>;
|
|
114
|
+
error: z.ZodOptional<z.ZodString>;
|
|
115
|
+
createdAt: z.ZodString;
|
|
116
|
+
updatedAt: z.ZodString;
|
|
117
|
+
type: z.ZodLiteral<"MARKET">;
|
|
118
|
+
symbol: z.ZodString;
|
|
119
|
+
side: z.ZodEnum<{
|
|
120
|
+
BUY: "BUY";
|
|
121
|
+
SELL: "SELL";
|
|
122
|
+
}>;
|
|
123
|
+
reduceOnly: z.ZodBoolean;
|
|
124
|
+
leverage: z.ZodInt;
|
|
125
|
+
quantity: z.ZodString;
|
|
126
|
+
price: z.ZodString;
|
|
127
|
+
filledQuantity: z.ZodString;
|
|
128
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$strip>], "type">>>;
|
|
130
|
+
intent: z.ZodLiteral<"ADJUST">;
|
|
131
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
132
|
+
position: z.ZodObject<{
|
|
133
|
+
id: z.ZodUUID;
|
|
134
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
137
|
+
symbol: z.ZodString;
|
|
138
|
+
side: z.ZodEnum<{
|
|
139
|
+
BUY: "BUY";
|
|
140
|
+
SELL: "SELL";
|
|
141
|
+
}>;
|
|
142
|
+
mode: z.ZodEnum<{
|
|
143
|
+
QUANTITY: "QUANTITY";
|
|
144
|
+
USD: "USD";
|
|
145
|
+
}>;
|
|
146
|
+
amount: z.ZodString;
|
|
147
|
+
reduceOnly: z.ZodBoolean;
|
|
148
|
+
}, z.core.$strip>], z.ZodObject<{
|
|
149
|
+
symbol: z.ZodString;
|
|
150
|
+
side: z.ZodEnum<{
|
|
151
|
+
BUY: "BUY";
|
|
152
|
+
SELL: "SELL";
|
|
153
|
+
}>;
|
|
154
|
+
mode: z.ZodEnum<{
|
|
155
|
+
QUANTITY: "QUANTITY";
|
|
156
|
+
USD: "USD";
|
|
157
|
+
}>;
|
|
158
|
+
amount: z.ZodString;
|
|
159
|
+
reduceOnly: z.ZodBoolean;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
id: z.ZodUUID;
|
|
163
|
+
connector: z.ZodEnum<{
|
|
164
|
+
hyperliquid: "hyperliquid";
|
|
165
|
+
binanceusdm: "binanceusdm";
|
|
166
|
+
bybit: "bybit";
|
|
167
|
+
okx: "okx";
|
|
168
|
+
}>;
|
|
169
|
+
status: z.ZodEnum<{
|
|
170
|
+
CANCELLED: "CANCELLED";
|
|
171
|
+
IDLE: "IDLE";
|
|
172
|
+
ACTIVE: "ACTIVE";
|
|
173
|
+
COMPLETED: "COMPLETED";
|
|
174
|
+
FAILED: "FAILED";
|
|
175
|
+
}>;
|
|
176
|
+
error: z.ZodOptional<z.ZodString>;
|
|
177
|
+
createdAt: z.ZodString;
|
|
178
|
+
updatedAt: z.ZodString;
|
|
179
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
180
|
+
id: z.ZodUUID;
|
|
181
|
+
connector: z.ZodEnum<{
|
|
182
|
+
hyperliquid: "hyperliquid";
|
|
183
|
+
binanceusdm: "binanceusdm";
|
|
184
|
+
bybit: "bybit";
|
|
185
|
+
okx: "okx";
|
|
186
|
+
}>;
|
|
187
|
+
status: z.ZodEnum<{
|
|
188
|
+
PENDING: "PENDING";
|
|
189
|
+
PARTIAL: "PARTIAL";
|
|
190
|
+
FILLED: "FILLED";
|
|
191
|
+
CANCELLED: "CANCELLED";
|
|
192
|
+
REJECTED: "REJECTED";
|
|
193
|
+
}>;
|
|
194
|
+
error: z.ZodOptional<z.ZodString>;
|
|
195
|
+
createdAt: z.ZodString;
|
|
196
|
+
updatedAt: z.ZodString;
|
|
197
|
+
type: z.ZodLiteral<"MARKET">;
|
|
198
|
+
symbol: z.ZodString;
|
|
199
|
+
side: z.ZodEnum<{
|
|
200
|
+
BUY: "BUY";
|
|
201
|
+
SELL: "SELL";
|
|
202
|
+
}>;
|
|
203
|
+
reduceOnly: z.ZodBoolean;
|
|
204
|
+
leverage: z.ZodInt;
|
|
205
|
+
quantity: z.ZodString;
|
|
206
|
+
price: z.ZodString;
|
|
207
|
+
filledQuantity: z.ZodString;
|
|
208
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strip>], "type">>>;
|
|
210
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
211
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
212
|
+
position: z.ZodObject<{
|
|
213
|
+
id: z.ZodUUID;
|
|
214
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
}, z.core.$strip>], "intent">], "orderType">>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
export type ExecutionListResponse = z.output<typeof ExecutionListResponse>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Fill: z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
5
|
+
tradeAccountId: z.ZodUUID;
|
|
6
|
+
symbol: z.ZodString;
|
|
7
|
+
positionId: z.ZodUUID;
|
|
8
|
+
connector: z.ZodEnum<{
|
|
9
|
+
hyperliquid: "hyperliquid";
|
|
10
|
+
binanceusdm: "binanceusdm";
|
|
11
|
+
bybit: "bybit";
|
|
12
|
+
okx: "okx";
|
|
13
|
+
}>;
|
|
14
|
+
side: z.ZodEnum<{
|
|
15
|
+
BUY: "BUY";
|
|
16
|
+
SELL: "SELL";
|
|
17
|
+
}>;
|
|
18
|
+
reduceOnly: z.ZodBoolean;
|
|
19
|
+
quantity: z.ZodString;
|
|
20
|
+
price: z.ZodString;
|
|
21
|
+
usd: z.ZodString;
|
|
22
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
23
|
+
timestamp: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type Fill = z.output<typeof Fill>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Side } from '../common/schema';
|
|
3
|
+
import { Connector } from '../connector';
|
|
4
|
+
import { InstrumentId } from '../instrument';
|
|
5
|
+
|
|
6
|
+
const Fill = z.object({
|
|
7
|
+
/**
|
|
8
|
+
* Fill UUID
|
|
9
|
+
*/
|
|
10
|
+
id: z.uuid(),
|
|
11
|
+
/**
|
|
12
|
+
* Client order ID
|
|
13
|
+
*/
|
|
14
|
+
cloid: z.uuid().optional(),
|
|
15
|
+
/**
|
|
16
|
+
* Trade account UUID
|
|
17
|
+
*/
|
|
18
|
+
tradeAccountId: z.uuid(),
|
|
19
|
+
/**
|
|
20
|
+
* Instrument ID
|
|
21
|
+
*/
|
|
22
|
+
symbol: InstrumentId,
|
|
23
|
+
/**
|
|
24
|
+
* Position UUID
|
|
25
|
+
*/
|
|
26
|
+
positionId: z.uuid(),
|
|
27
|
+
/**
|
|
28
|
+
* Connector
|
|
29
|
+
*/
|
|
30
|
+
connector: Connector,
|
|
31
|
+
/**
|
|
32
|
+
* Side
|
|
33
|
+
*/
|
|
34
|
+
side: Side,
|
|
35
|
+
/**
|
|
36
|
+
* Reduce only flag
|
|
37
|
+
*/
|
|
38
|
+
reduceOnly: z.boolean(),
|
|
39
|
+
/**
|
|
40
|
+
* Filled quantity
|
|
41
|
+
*/
|
|
42
|
+
quantity: z.string(),
|
|
43
|
+
/**
|
|
44
|
+
* Filled price
|
|
45
|
+
*/
|
|
46
|
+
price: z.string(),
|
|
47
|
+
/**
|
|
48
|
+
* USD value
|
|
49
|
+
*/
|
|
50
|
+
usd: z.string(),
|
|
51
|
+
/**
|
|
52
|
+
* Fee paid
|
|
53
|
+
*/
|
|
54
|
+
fee: z.string().optional(),
|
|
55
|
+
/**
|
|
56
|
+
* Timestamp
|
|
57
|
+
*/
|
|
58
|
+
timestamp: z.string()
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export { Fill };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FillListParams: z.ZodObject<{
|
|
3
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
|
|
4
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
5
|
+
connector: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
hyperliquid: "hyperliquid";
|
|
7
|
+
binanceusdm: "binanceusdm";
|
|
8
|
+
bybit: "bybit";
|
|
9
|
+
okx: "okx";
|
|
10
|
+
}>>;
|
|
11
|
+
orderBy: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"timestamp">, z.ZodLiteral<"-timestamp">]>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type FillListParams = z.output<typeof FillListParams>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CursorFindParams } from '../common';
|
|
3
|
+
import { Connector } from '../connector';
|
|
4
|
+
|
|
5
|
+
const OrderBy = z.union([z.literal("timestamp"), z.literal("-timestamp")]);
|
|
6
|
+
const FillListParams = CursorFindParams.extend({
|
|
7
|
+
connector: Connector.optional(),
|
|
8
|
+
orderBy: OrderBy.default("-timestamp")
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { FillListParams };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FillListResponse: z.ZodObject<{
|
|
3
|
+
limit: z.ZodNumber;
|
|
4
|
+
nextCursor: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
|
|
5
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
6
|
+
id: z.ZodUUID;
|
|
7
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
8
|
+
tradeAccountId: z.ZodUUID;
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
positionId: z.ZodUUID;
|
|
11
|
+
connector: z.ZodEnum<{
|
|
12
|
+
hyperliquid: "hyperliquid";
|
|
13
|
+
binanceusdm: "binanceusdm";
|
|
14
|
+
bybit: "bybit";
|
|
15
|
+
okx: "okx";
|
|
16
|
+
}>;
|
|
17
|
+
side: z.ZodEnum<{
|
|
18
|
+
BUY: "BUY";
|
|
19
|
+
SELL: "SELL";
|
|
20
|
+
}>;
|
|
21
|
+
reduceOnly: z.ZodBoolean;
|
|
22
|
+
quantity: z.ZodString;
|
|
23
|
+
price: z.ZodString;
|
|
24
|
+
usd: z.ZodString;
|
|
25
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
26
|
+
timestamp: z.ZodString;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type FillListResponse = z.output<typeof FillListResponse>;
|
|
30
|
+
export declare const PositionFillListResponse: z.ZodObject<{
|
|
31
|
+
fills: z.ZodArray<z.ZodObject<{
|
|
32
|
+
id: z.ZodUUID;
|
|
33
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
34
|
+
tradeAccountId: z.ZodUUID;
|
|
35
|
+
symbol: z.ZodString;
|
|
36
|
+
positionId: z.ZodUUID;
|
|
37
|
+
connector: z.ZodEnum<{
|
|
38
|
+
hyperliquid: "hyperliquid";
|
|
39
|
+
binanceusdm: "binanceusdm";
|
|
40
|
+
bybit: "bybit";
|
|
41
|
+
okx: "okx";
|
|
42
|
+
}>;
|
|
43
|
+
side: z.ZodEnum<{
|
|
44
|
+
BUY: "BUY";
|
|
45
|
+
SELL: "SELL";
|
|
46
|
+
}>;
|
|
47
|
+
reduceOnly: z.ZodBoolean;
|
|
48
|
+
quantity: z.ZodString;
|
|
49
|
+
price: z.ZodString;
|
|
50
|
+
usd: z.ZodString;
|
|
51
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
52
|
+
timestamp: z.ZodString;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type PositionFillListResponse = z.output<typeof PositionFillListResponse>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CursorResponse } from '../common';
|
|
3
|
+
import { Fill } from './entities';
|
|
4
|
+
|
|
5
|
+
const FillListResponse = CursorResponse.extend({
|
|
6
|
+
fills: z.array(Fill)
|
|
7
|
+
});
|
|
8
|
+
const PositionFillListResponse = z.object({
|
|
9
|
+
fills: z.array(Fill)
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { FillListResponse, PositionFillListResponse };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FundingInfo: z.ZodObject<{
|
|
3
|
+
r: z.ZodString;
|
|
4
|
+
nft: z.ZodNumber;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type FundingInfo = z.output<typeof FundingInfo>;
|
|
7
|
+
export declare const InstrumentFundingMap: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
8
|
+
r: z.ZodString;
|
|
9
|
+
nft: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
export type InstrumentFundingMap = z.output<typeof InstrumentFundingMap>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FundingQueryParams: z.ZodObject<{
|
|
3
|
+
connector: z.ZodEnum<{
|
|
4
|
+
hyperliquid: "hyperliquid";
|
|
5
|
+
binanceusdm: "binanceusdm";
|
|
6
|
+
bybit: "bybit";
|
|
7
|
+
okx: "okx";
|
|
8
|
+
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type FundingQueryParams = z.output<typeof FundingQueryParams>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FundingResponse: z.ZodObject<{
|
|
3
|
+
funding: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4
|
+
r: z.ZodString;
|
|
5
|
+
nft: z.ZodNumber;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type FundingResponse = z.output<typeof FundingResponse>;
|
package/dist/index.d.ts
ADDED