@0xmonaco/types 1.0.70 → 1.0.73
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/index.d.ts +4 -2
- package/dist/auth/responses.d.ts +3 -1
- package/dist/buildercodes/index.d.ts +7 -3
- package/dist/buildercodes/index.js +1 -1
- package/dist/buildercodes/responses.d.ts +59 -2
- package/dist/buildercodes/responses.js +38 -2
- package/dist/copy-trading/index.d.ts +52 -4
- package/dist/copy-trading/index.js +1 -1
- package/dist/copy-trading/responses.d.ts +43 -0
- package/dist/copy-trading/responses.js +49 -0
- package/dist/delegated-agents/index.d.ts +2 -0
- package/dist/fees/index.d.ts +3 -0
- package/dist/fees/responses.js +4 -4
- package/dist/trading/responses.d.ts +18 -6
- package/dist/validation/copy-trading.d.ts +11 -0
- package/dist/validation/copy-trading.js +15 -0
- package/dist/websocket/events/position-events.d.ts +14 -10
- package/dist/websocket/events/twap-order-events.d.ts +7 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +5 -0
- package/dist/wire/schema.d.ts +755 -35
- package/package.json +2 -2
package/dist/auth/index.d.ts
CHANGED
|
@@ -77,8 +77,10 @@ export interface AuthAPI extends BaseAPI {
|
|
|
77
77
|
*/
|
|
78
78
|
verifySignature(address: string, signature: string, nonce: string, clientId: string, session: SessionCredentials, referralCode?: string): Promise<AuthState>;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
* active session key (set via {@link setSessionKeypair}).
|
|
80
|
+
* Refreshes the current session's expiry. The request is signed with the
|
|
81
|
+
* active session key (set via {@link setSessionKeypair}). For a delegated
|
|
82
|
+
* session, the returned expiry is capped by the active delegation and may
|
|
83
|
+
* move earlier if the owner shortened that delegation.
|
|
82
84
|
* @returns Promise resolving to the new expiry
|
|
83
85
|
*/
|
|
84
86
|
refreshSession(): Promise<SessionRefreshResponse>;
|
package/dist/auth/responses.d.ts
CHANGED
|
@@ -78,7 +78,9 @@ export interface SessionCredentials {
|
|
|
78
78
|
privateKey: string;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* Response to a session refresh request
|
|
81
|
+
* Response to a session refresh request with the resulting expiry. For a
|
|
82
|
+
* delegated session, this remains capped by the active delegation and may move earlier
|
|
83
|
+
* if the owner shortened that delegation.
|
|
82
84
|
*/
|
|
83
85
|
export interface SessionRefreshResponse {
|
|
84
86
|
/** Unix timestamp when the session expires after refresh */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* per-trade revenue share.
|
|
6
6
|
*/
|
|
7
7
|
import type { BaseAPI } from "../api";
|
|
8
|
-
import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse } from "./responses";
|
|
8
|
+
import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, ListBuilderFeeChangesParams, ListBuilderFeeChangesResponse, SetBuilderFeeParams, SetBuilderFeeResponse } from "./responses";
|
|
9
9
|
/**
|
|
10
10
|
* BuilderCodes payout API interface.
|
|
11
11
|
*
|
|
@@ -18,6 +18,10 @@ import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, Ge
|
|
|
18
18
|
export interface BuildercodesAPI extends BaseAPI {
|
|
19
19
|
/** Read this authenticated frontend's enrollment, payout address, and live budget. */
|
|
20
20
|
getConfig(): Promise<GetBuildercodesConfigResponse>;
|
|
21
|
+
/** Set this frontend's stored builder fee in basis points. */
|
|
22
|
+
setBuilderFee(params: SetBuilderFeeParams): Promise<SetBuilderFeeResponse>;
|
|
23
|
+
/** List this frontend's builder-fee audit log, newest first. */
|
|
24
|
+
listBuilderFeeChanges(params?: ListBuilderFeeChangesParams): Promise<ListBuilderFeeChangesResponse>;
|
|
21
25
|
/** List this authenticated frontend's per-trade BuilderCodes credits, optionally of one payout `kind`. */
|
|
22
26
|
listPayouts(params?: ListBuildercodePayoutsParams): Promise<ListBuildercodePayoutsResponse>;
|
|
23
27
|
/** Summarize this authenticated frontend's BuilderCodes credits by token, and by token and payout kind. */
|
|
@@ -67,5 +71,5 @@ export interface BuildercodesAPI extends BaseAPI {
|
|
|
67
71
|
*/
|
|
68
72
|
claimBuildercodeRewards(params: ClaimBuildercodeRewardsParams): Promise<ClaimBuildercodeRewardsResponse>;
|
|
69
73
|
}
|
|
70
|
-
export type { BuildercodePayout, BuildercodePayoutKind, BuildercodePayoutTokenKindTotal, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, } from "./responses";
|
|
71
|
-
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
|
|
74
|
+
export type { BuildercodePayout, BuildercodePayoutKind, BuildercodePayoutTokenKindTotal, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, BuilderFeeActorType, BuilderFeeChange, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, ListBuilderFeeChangesParams, ListBuilderFeeChangesResponse, SetBuilderFeeParams, SetBuilderFeeResponse, } from "./responses";
|
|
75
|
+
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, BuilderFeeActorTypeSchema, BuilderFeeChangeSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, ListBuilderFeeChangesParamsSchema, ListBuilderFeeChangesResponseSchema, SetBuilderFeeParamsSchema, SetBuilderFeeResponseSchema, } from "./responses";
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Types for the BuilderCodes API: reading and claiming an enrolled frontend's
|
|
5
5
|
* per-trade revenue share.
|
|
6
6
|
*/
|
|
7
|
-
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
|
|
7
|
+
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, BuilderFeeActorTypeSchema, BuilderFeeChangeSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, ListBuilderFeeChangesParamsSchema, ListBuilderFeeChangesResponseSchema, SetBuilderFeeParamsSchema, SetBuilderFeeResponseSchema, } from "./responses";
|
|
@@ -12,11 +12,62 @@ export declare const GetBuildercodesConfigResponseSchema: z.ZodObject<{
|
|
|
12
12
|
payoutAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
13
|
buildercodesEnabled: z.ZodBoolean;
|
|
14
14
|
buildercodesBudgetBps: z.ZodNumber;
|
|
15
|
+
builderFeeEnabled: z.ZodBoolean;
|
|
16
|
+
builderFeeBps: z.ZodNumber;
|
|
17
|
+
builderFeeCapBps: z.ZodNumber;
|
|
18
|
+
changesRemaining: z.ZodNumber;
|
|
19
|
+
nextChangeAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
/** Schema for changing this frontend's builder fee. */
|
|
22
|
+
export declare const SetBuilderFeeParamsSchema: z.ZodObject<{
|
|
23
|
+
bps: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
/** Schema returned after setting this frontend's builder fee. */
|
|
26
|
+
export declare const SetBuilderFeeResponseSchema: z.ZodObject<{
|
|
27
|
+
builderFeeBps: z.ZodNumber;
|
|
28
|
+
previousBuilderFeeBps: z.ZodNumber;
|
|
29
|
+
changesRemaining: z.ZodNumber;
|
|
30
|
+
nextChangeAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/** Builder-fee change actor exposed by the audit log. */
|
|
33
|
+
export declare const BuilderFeeActorTypeSchema: z.ZodEnum<{
|
|
34
|
+
BUILDER: "BUILDER";
|
|
35
|
+
ADMIN: "ADMIN";
|
|
36
|
+
}>;
|
|
37
|
+
/** One builder-fee audit-log entry. */
|
|
38
|
+
export declare const BuilderFeeChangeSchema: z.ZodObject<{
|
|
39
|
+
actorType: z.ZodEnum<{
|
|
40
|
+
BUILDER: "BUILDER";
|
|
41
|
+
ADMIN: "ADMIN";
|
|
42
|
+
}>;
|
|
43
|
+
actor: z.ZodString;
|
|
44
|
+
oldBps: z.ZodNumber;
|
|
45
|
+
newBps: z.ZodNumber;
|
|
46
|
+
createdAt: z.ZodString;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/** Cursor pagination accepted by the builder-fee change log. */
|
|
49
|
+
export declare const ListBuilderFeeChangesParamsSchema: z.ZodObject<{
|
|
50
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
/** Schema for one page of builder-fee changes, newest first. */
|
|
54
|
+
export declare const ListBuilderFeeChangesResponseSchema: z.ZodObject<{
|
|
55
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
56
|
+
actorType: z.ZodEnum<{
|
|
57
|
+
BUILDER: "BUILDER";
|
|
58
|
+
ADMIN: "ADMIN";
|
|
59
|
+
}>;
|
|
60
|
+
actor: z.ZodString;
|
|
61
|
+
oldBps: z.ZodNumber;
|
|
62
|
+
newBps: z.ZodNumber;
|
|
63
|
+
createdAt: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
nextPageToken: z.ZodString;
|
|
15
66
|
}, z.core.$strip>;
|
|
16
67
|
/**
|
|
17
68
|
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
|
|
18
|
-
* frontend
|
|
19
|
-
*
|
|
69
|
+
* active frontend-revenue-share category; `BUILDER_FEE` is reserved and is not
|
|
70
|
+
* currently emitted.
|
|
20
71
|
*/
|
|
21
72
|
export declare const BuildercodePayoutKindSchema: z.ZodEnum<{
|
|
22
73
|
REVENUE_SHARE: "REVENUE_SHARE";
|
|
@@ -127,6 +178,12 @@ export declare const ClaimBuildercodeRewardsResponseSchema: z.ZodObject<{
|
|
|
127
178
|
export type ClaimBuildercodeRewardsParams = z.infer<typeof ClaimBuildercodeRewardsParamsSchema>;
|
|
128
179
|
export type ClaimBuildercodeRewardsResponse = z.infer<typeof ClaimBuildercodeRewardsResponseSchema>;
|
|
129
180
|
export type GetBuildercodesConfigResponse = z.infer<typeof GetBuildercodesConfigResponseSchema>;
|
|
181
|
+
export type SetBuilderFeeParams = z.infer<typeof SetBuilderFeeParamsSchema>;
|
|
182
|
+
export type SetBuilderFeeResponse = z.infer<typeof SetBuilderFeeResponseSchema>;
|
|
183
|
+
export type BuilderFeeActorType = z.infer<typeof BuilderFeeActorTypeSchema>;
|
|
184
|
+
export type BuilderFeeChange = z.infer<typeof BuilderFeeChangeSchema>;
|
|
185
|
+
export type ListBuilderFeeChangesParams = z.infer<typeof ListBuilderFeeChangesParamsSchema>;
|
|
186
|
+
export type ListBuilderFeeChangesResponse = z.infer<typeof ListBuilderFeeChangesResponseSchema>;
|
|
130
187
|
export type ListBuildercodePayoutsParams = z.infer<typeof ListBuildercodePayoutsParamsSchema>;
|
|
131
188
|
export type BuildercodePayoutKind = z.infer<typeof BuildercodePayoutKindSchema>;
|
|
132
189
|
export type BuildercodePayout = z.infer<typeof BuildercodePayoutSchema>;
|
|
@@ -16,11 +16,47 @@ export const GetBuildercodesConfigResponseSchema = z.object({
|
|
|
16
16
|
payoutAddress: z.string().nullable().optional(),
|
|
17
17
|
buildercodesEnabled: z.boolean(),
|
|
18
18
|
buildercodesBudgetBps: z.number().int().min(0).max(10_000),
|
|
19
|
+
builderFeeEnabled: z.boolean(),
|
|
20
|
+
builderFeeBps: z.number().int().min(0).max(100),
|
|
21
|
+
builderFeeCapBps: z.number().int().min(0).max(100),
|
|
22
|
+
changesRemaining: z.number().int().min(0).max(2),
|
|
23
|
+
nextChangeAllowedAt: z.string().nullable().optional(),
|
|
24
|
+
});
|
|
25
|
+
/** Schema for changing this frontend's builder fee. */
|
|
26
|
+
export const SetBuilderFeeParamsSchema = z.object({
|
|
27
|
+
bps: z.number().int().min(0).max(100),
|
|
28
|
+
});
|
|
29
|
+
/** Schema returned after setting this frontend's builder fee. */
|
|
30
|
+
export const SetBuilderFeeResponseSchema = z.object({
|
|
31
|
+
builderFeeBps: z.number().int().min(0).max(100),
|
|
32
|
+
previousBuilderFeeBps: z.number().int().min(0).max(100),
|
|
33
|
+
changesRemaining: z.number().int().min(0).max(2),
|
|
34
|
+
nextChangeAllowedAt: z.string().nullable().optional(),
|
|
35
|
+
});
|
|
36
|
+
/** Builder-fee change actor exposed by the audit log. */
|
|
37
|
+
export const BuilderFeeActorTypeSchema = z.enum(["BUILDER", "ADMIN"]);
|
|
38
|
+
/** One builder-fee audit-log entry. */
|
|
39
|
+
export const BuilderFeeChangeSchema = z.object({
|
|
40
|
+
actorType: BuilderFeeActorTypeSchema,
|
|
41
|
+
actor: z.string(),
|
|
42
|
+
oldBps: z.number().int().min(0).max(100),
|
|
43
|
+
newBps: z.number().int().min(0).max(100),
|
|
44
|
+
createdAt: z.string(),
|
|
45
|
+
});
|
|
46
|
+
/** Cursor pagination accepted by the builder-fee change log. */
|
|
47
|
+
export const ListBuilderFeeChangesParamsSchema = z.object({
|
|
48
|
+
pageSize: z.number().int().min(1).max(100).optional(),
|
|
49
|
+
pageToken: z.string().optional(),
|
|
50
|
+
});
|
|
51
|
+
/** Schema for one page of builder-fee changes, newest first. */
|
|
52
|
+
export const ListBuilderFeeChangesResponseSchema = z.object({
|
|
53
|
+
changes: z.array(BuilderFeeChangeSchema),
|
|
54
|
+
nextPageToken: z.string(),
|
|
19
55
|
});
|
|
20
56
|
/**
|
|
21
57
|
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` is the
|
|
22
|
-
* frontend
|
|
23
|
-
*
|
|
58
|
+
* active frontend-revenue-share category; `BUILDER_FEE` is reserved and is not
|
|
59
|
+
* currently emitted.
|
|
24
60
|
*/
|
|
25
61
|
export const BuildercodePayoutKindSchema = z.enum(["REVENUE_SHARE", "BUILDER_FEE"]);
|
|
26
62
|
/** Pagination and filter accepted by the per-trade payout history endpoint. */
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* into it. Leaders are addressed by their custom TraderCode handle.
|
|
7
7
|
*/
|
|
8
8
|
import type { BaseAPI } from "../api";
|
|
9
|
-
import type { ListLeadTraderClosedTradesParams, ListLeadTradersParams, ListMyFollowersParams, ListMyFollowsParams, PreviewFollowParams, UpsertFollowParams, UpsertLeadTraderParams } from "../validation/copy-trading";
|
|
10
|
-
import type { GetFollowResponse, GetLeadTraderResponse, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse } from "./responses";
|
|
9
|
+
import type { AddFollowPositionMarginParams, ListLeadTraderClosedTradesParams, ListLeadTradersParams, ListMyFollowersParams, ListMyFollowsParams, PreviewFollowParams, UpsertFollowParams, UpsertLeadTraderParams } from "../validation/copy-trading";
|
|
10
|
+
import type { AddFollowPositionMarginResponse, CloseAllCopyPositionsResponse, CloseFollowPositionsResponse, GetFollowResponse, GetLeadTraderResponse, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse } from "./responses";
|
|
11
11
|
/**
|
|
12
12
|
* Copy trading API.
|
|
13
13
|
*
|
|
@@ -69,6 +69,54 @@ export interface CopyTradingAPI extends BaseAPI {
|
|
|
69
69
|
* cannot stop a follow (403).
|
|
70
70
|
*/
|
|
71
71
|
stopFollow(followId: string): Promise<StopFollowResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Close every position in one of your follows' copy accounts at market
|
|
74
|
+
* (reduce-only, immediate-or-cancel) and cancel the resting orders and
|
|
75
|
+
* conditional orders (TP/SL) on its copy risk buckets, keeping the follow:
|
|
76
|
+
* the leader's next trades keep mirroring. `stopFollow` is the
|
|
77
|
+
* close-and-stop path. Proceeds stay in the copy account. Not a flatten
|
|
78
|
+
* guarantee: a thin or halted market can leave part of a position open
|
|
79
|
+
* (`positionsNotClosed`), and a leader trade after the close opens copies
|
|
80
|
+
* again. Never gated by copy trading being off or an operations block; only
|
|
81
|
+
* a delegated agent session is refused (403). Both close methods share a
|
|
82
|
+
* small per-account rate limit (about one per second, burst 5; 429 with
|
|
83
|
+
* Retry-After). 404 for a follow that is not yours; 409 for a stopped
|
|
84
|
+
* follow or one whose stop is in progress; 400 when the close was refused;
|
|
85
|
+
* 503 when it cannot run right now. The response is sent once the batch is
|
|
86
|
+
* durably logged; fills arrive on the order, position and copy channels.
|
|
87
|
+
*/
|
|
88
|
+
closeFollowPositions(followId: string): Promise<CloseFollowPositionsResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Close the copy positions of every live follow of yours, as
|
|
91
|
+
* `closeFollowPositions` does for one, keeping the follows. Follows whose
|
|
92
|
+
* stop is in progress are listed in `stoppingFollowIds`; a follow whose
|
|
93
|
+
* close could not run is listed in `failedFollows` with a fixed reason
|
|
94
|
+
* while the others still close.
|
|
95
|
+
*/
|
|
96
|
+
closeAllCopyPositions(): Promise<CloseAllCopyPositionsResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Add margin to one of your copy positions: moves `amount` (quote units)
|
|
99
|
+
* from the follow's copy account into the margin of its isolated copy
|
|
100
|
+
* position on `tradingPairId`. The position's margin rises by exactly
|
|
101
|
+
* `amount` and the copy account's remaining collateral falls by the same;
|
|
102
|
+
* your margin account is never touched. It lowers the position's leverage
|
|
103
|
+
* and moves its liquidation price away, and opens no exposure, so it works
|
|
104
|
+
* while copy trading is switched off and on a `CLOSE_ONLY` follow. There
|
|
105
|
+
* is no margin reduction: a follow exits by being stopped.
|
|
106
|
+
*
|
|
107
|
+
* Master account sessions only (a delegated agent or a sub-account gets
|
|
108
|
+
* 403); 404 for a follow that is not yours; 409 while the follow is
|
|
109
|
+
* stopping or once it is stopped, or `COPY_TRADING_UNAVAILABLE` when copy
|
|
110
|
+
* trading is not available on the platform; 400 `COPY_TRADING_REJECTED`
|
|
111
|
+
* when the engine refuses (no isolated copy position on the pair, the
|
|
112
|
+
* position or the margin account is being liquidated, the position has
|
|
113
|
+
* lost more than its margin, more than the copy account can put in); 429
|
|
114
|
+
* over the movement budget withdrawals and collateral transfers share.
|
|
115
|
+
*
|
|
116
|
+
* Not idempotent: a retry after a timeout whose first attempt landed adds
|
|
117
|
+
* the amount twice, so read the follow before retrying.
|
|
118
|
+
*/
|
|
119
|
+
addFollowPositionMargin(params: AddFollowPositionMarginParams): Promise<AddFollowPositionMarginResponse>;
|
|
72
120
|
/** List your follows, newest first. Cursor paged, up to 1000 per page. */
|
|
73
121
|
listMyFollows(params?: ListMyFollowsParams): Promise<ListMyFollowsResponse>;
|
|
74
122
|
/**
|
|
@@ -91,5 +139,5 @@ export interface CopyTradingAPI extends BaseAPI {
|
|
|
91
139
|
*/
|
|
92
140
|
previewFollow(params: PreviewFollowParams): Promise<PreviewFollowResponse>;
|
|
93
141
|
}
|
|
94
|
-
export type { ClosedTrade, ClosedTradeAction, CopySkip, Follow, Follower, GetFollowResponse, GetLeadTraderResponse, LeadTraderFollowSummary, LeadTraderListing, LeadTraderOpenPosition, LeadTraderProfile, LeadTraderRef, LeadTraderSort, LeadTraderStats, LeadTraderStatsWindow, LeadTraderStatus, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse, } from "./responses";
|
|
95
|
-
export { ClosedTradeSchema, CopySkipSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
142
|
+
export type { AddFollowPositionMarginResponse, CloseAllCopyPositionsResponse, ClosedTrade, ClosedTradeAction, CloseFollowPositionsResponse, CopySkip, Follow, FollowCloseFailure, Follower, GetFollowResponse, GetLeadTraderResponse, LeadTraderFollowSummary, LeadTraderListing, LeadTraderOpenPosition, LeadTraderProfile, LeadTraderRef, LeadTraderSort, LeadTraderStats, LeadTraderStatsWindow, LeadTraderStatus, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse, } from "./responses";
|
|
143
|
+
export { AddFollowPositionMarginResponseSchema, CloseAllCopyPositionsResponseSchema, ClosedTradeSchema, CloseFollowPositionsResponseSchema, CopySkipSchema, FollowCloseFailureSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* bucket in their margin account) and every fill the leader makes is mirrored
|
|
6
6
|
* into it. Leaders are addressed by their custom TraderCode handle.
|
|
7
7
|
*/
|
|
8
|
-
export { ClosedTradeSchema, CopySkipSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
8
|
+
export { AddFollowPositionMarginResponseSchema, CloseAllCopyPositionsResponseSchema, ClosedTradeSchema, CloseFollowPositionsResponseSchema, CopySkipSchema, FollowCloseFailureSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
@@ -349,6 +349,45 @@ export declare const PreviewFollowResponseSchema: z.ZodObject<{
|
|
|
349
349
|
export declare const StopFollowResponseSchema: z.ZodObject<{
|
|
350
350
|
followId: z.ZodString;
|
|
351
351
|
}, z.core.$strip>;
|
|
352
|
+
/**
|
|
353
|
+
* One follow's copy positions closing: a batch acknowledgement, sent once the
|
|
354
|
+
* batch is durably logged. The closes are reduce-only and immediate-or-cancel;
|
|
355
|
+
* each one's fills arrive on the order, position and copy channels. Not a
|
|
356
|
+
* flatten guarantee: `positionsNotClosed` counts what a thin or halted market
|
|
357
|
+
* left open.
|
|
358
|
+
*/
|
|
359
|
+
export declare const CloseFollowPositionsResponseSchema: z.ZodObject<{
|
|
360
|
+
followId: z.ZodString;
|
|
361
|
+
closeOrdersPlaced: z.ZodNumber;
|
|
362
|
+
positionsNotClosed: z.ZodNumber;
|
|
363
|
+
}, z.core.$strip>;
|
|
364
|
+
/** A follow whose close could not run. */
|
|
365
|
+
export declare const FollowCloseFailureSchema: z.ZodObject<{
|
|
366
|
+
followId: z.ZodString;
|
|
367
|
+
reason: z.ZodString;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
/** Result of closing all your copy positions. */
|
|
370
|
+
export declare const CloseAllCopyPositionsResponseSchema: z.ZodObject<{
|
|
371
|
+
follows: z.ZodArray<z.ZodObject<{
|
|
372
|
+
followId: z.ZodString;
|
|
373
|
+
closeOrdersPlaced: z.ZodNumber;
|
|
374
|
+
positionsNotClosed: z.ZodNumber;
|
|
375
|
+
}, z.core.$strip>>;
|
|
376
|
+
stoppingFollowIds: z.ZodArray<z.ZodString>;
|
|
377
|
+
failedFollows: z.ZodArray<z.ZodObject<{
|
|
378
|
+
followId: z.ZodString;
|
|
379
|
+
reason: z.ZodString;
|
|
380
|
+
}, z.core.$strip>>;
|
|
381
|
+
}, z.core.$strip>;
|
|
382
|
+
/** Result of adding margin to one of your copy positions. */
|
|
383
|
+
export declare const AddFollowPositionMarginResponseSchema: z.ZodObject<{
|
|
384
|
+
followId: z.ZodString;
|
|
385
|
+
tradingPairId: z.ZodString;
|
|
386
|
+
riskBucketId: z.ZodString;
|
|
387
|
+
positionId: z.ZodString;
|
|
388
|
+
positionMargin: z.ZodString;
|
|
389
|
+
copyAccountAvailable: z.ZodString;
|
|
390
|
+
}, z.core.$strip>;
|
|
352
391
|
export type LeadTraderRef = z.infer<typeof LeadTraderRefSchema>;
|
|
353
392
|
export type LeadTraderProfile = z.infer<typeof LeadTraderProfileSchema>;
|
|
354
393
|
export type LeadTraderFollowSummary = z.infer<typeof LeadTraderFollowSummarySchema>;
|
|
@@ -370,4 +409,8 @@ export type GetFollowResponse = z.infer<typeof GetFollowResponseSchema>;
|
|
|
370
409
|
export type ListFollowLeaderPositionsResponse = z.infer<typeof ListFollowLeaderPositionsResponseSchema>;
|
|
371
410
|
export type UpsertFollowResponse = z.infer<typeof UpsertFollowResponseSchema>;
|
|
372
411
|
export type StopFollowResponse = z.infer<typeof StopFollowResponseSchema>;
|
|
412
|
+
export type CloseFollowPositionsResponse = z.infer<typeof CloseFollowPositionsResponseSchema>;
|
|
413
|
+
export type FollowCloseFailure = z.infer<typeof FollowCloseFailureSchema>;
|
|
414
|
+
export type CloseAllCopyPositionsResponse = z.infer<typeof CloseAllCopyPositionsResponseSchema>;
|
|
373
415
|
export type PreviewFollowResponse = z.infer<typeof PreviewFollowResponseSchema>;
|
|
416
|
+
export type AddFollowPositionMarginResponse = z.infer<typeof AddFollowPositionMarginResponseSchema>;
|
|
@@ -266,3 +266,52 @@ export const StopFollowResponseSchema = z.object({
|
|
|
266
266
|
/** The stopped follow's id. */
|
|
267
267
|
followId: z.string(),
|
|
268
268
|
});
|
|
269
|
+
/**
|
|
270
|
+
* One follow's copy positions closing: a batch acknowledgement, sent once the
|
|
271
|
+
* batch is durably logged. The closes are reduce-only and immediate-or-cancel;
|
|
272
|
+
* each one's fills arrive on the order, position and copy channels. Not a
|
|
273
|
+
* flatten guarantee: `positionsNotClosed` counts what a thin or halted market
|
|
274
|
+
* left open.
|
|
275
|
+
*/
|
|
276
|
+
export const CloseFollowPositionsResponseSchema = z.object({
|
|
277
|
+
/** The follow's id. */
|
|
278
|
+
followId: z.string(),
|
|
279
|
+
/** Close orders placed (each may fill in part). */
|
|
280
|
+
closeOrdersPlaced: z.number(),
|
|
281
|
+
/** Copy positions still open after the batch (for example a thin or halted market). */
|
|
282
|
+
positionsNotClosed: z.number(),
|
|
283
|
+
});
|
|
284
|
+
/** A follow whose close could not run. */
|
|
285
|
+
export const FollowCloseFailureSchema = z.object({
|
|
286
|
+
/** The follow's id. */
|
|
287
|
+
followId: z.string(),
|
|
288
|
+
/** Why the close could not run, as a fixed sentence; retry the close. */
|
|
289
|
+
reason: z.string(),
|
|
290
|
+
});
|
|
291
|
+
/** Result of closing all your copy positions. */
|
|
292
|
+
export const CloseAllCopyPositionsResponseSchema = z.object({
|
|
293
|
+
/**
|
|
294
|
+
* Every live follow whose stop is not in progress and whose close ran,
|
|
295
|
+
* including one with nothing to close (0 orders placed, 0 positions not closed).
|
|
296
|
+
*/
|
|
297
|
+
follows: z.array(CloseFollowPositionsResponseSchema),
|
|
298
|
+
/** Follows whose stop is in progress: their stop closes their positions. */
|
|
299
|
+
stoppingFollowIds: z.array(z.string()),
|
|
300
|
+
/** Follows whose close could not run; the other follows still closed. */
|
|
301
|
+
failedFollows: z.array(FollowCloseFailureSchema),
|
|
302
|
+
});
|
|
303
|
+
/** Result of adding margin to one of your copy positions. */
|
|
304
|
+
export const AddFollowPositionMarginResponseSchema = z.object({
|
|
305
|
+
/** The follow's id. */
|
|
306
|
+
followId: z.string(),
|
|
307
|
+
/** Trading pair of the copy position. */
|
|
308
|
+
tradingPairId: z.string(),
|
|
309
|
+
/** The copy position's isolated risk bucket. */
|
|
310
|
+
riskBucketId: z.string(),
|
|
311
|
+
/** The copy position's id. */
|
|
312
|
+
positionId: z.string(),
|
|
313
|
+
/** The copy position's margin after the add, in quote units. */
|
|
314
|
+
positionMargin: z.string(),
|
|
315
|
+
/** What the copy account can still put into this position after the add, in quote units. */
|
|
316
|
+
copyAccountAvailable: z.string(),
|
|
317
|
+
});
|
|
@@ -4,6 +4,7 @@ export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_OR
|
|
|
4
4
|
export interface UpsertDelegatedAgentRequest {
|
|
5
5
|
agentAddress: string;
|
|
6
6
|
name?: string;
|
|
7
|
+
/** Delegation expiry (ISO 8601); ends reads, trading, and session refresh. */
|
|
7
8
|
expiresAt?: string;
|
|
8
9
|
/** Required. An empty list permits no actions. */
|
|
9
10
|
allowedActions: DelegatedAgentAction[];
|
|
@@ -61,6 +62,7 @@ export interface CreateDelegatedSessionRequest {
|
|
|
61
62
|
sessionPublicKey: string;
|
|
62
63
|
}
|
|
63
64
|
export interface CreateDelegatedSessionResponse {
|
|
65
|
+
/** Unix seconds; bounded by delegation expiry. Revocation may end access sooner. */
|
|
64
66
|
expiresAt: number;
|
|
65
67
|
delegationId: string;
|
|
66
68
|
ownerUserId: string;
|
package/dist/fees/index.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ export interface FeesAPI extends BaseAPI {
|
|
|
41
41
|
* spot/perp breakdown), the volume still needed to reach the next tier, and the
|
|
42
42
|
* requested pair's six-row fee schedule (threshold plus maker/taker bps).
|
|
43
43
|
*
|
|
44
|
+
* The tier and volumes are wallet-wide: the caller's wallet total across every
|
|
45
|
+
* application it trades through, so they read the same from any application.
|
|
46
|
+
*
|
|
44
47
|
* @param params - Parameters for the lookup
|
|
45
48
|
* @param params.tradingPairId - Trading pair whose fee schedule to return
|
|
46
49
|
* @returns Promise resolving to the caller's tier and the pair's schedule
|
package/dist/fees/responses.js
CHANGED
|
@@ -126,13 +126,13 @@ export const FeeTierScheduleRowSchema = z.object({
|
|
|
126
126
|
* Zod schema for the "my fee tier" response
|
|
127
127
|
*/
|
|
128
128
|
export const GetMyFeeTierResponseSchema = z.object({
|
|
129
|
-
/** Caller's resolved tier (1–6) from stored weighted 14-day volume */
|
|
129
|
+
/** Caller's resolved tier (1–6) from their wallet's stored weighted 14-day volume */
|
|
130
130
|
currentTierLevel: z.number().int(),
|
|
131
|
-
/** Caller's weighted 14-day volume (perp + 2.5× spot) */
|
|
131
|
+
/** Caller's weighted 14-day volume (perp + 2.5× spot), summed across every application the wallet trades through */
|
|
132
132
|
weightedVolume14d: z.string(),
|
|
133
|
-
/** Caller's rolling 14-day spot volume */
|
|
133
|
+
/** Caller's rolling 14-day spot volume, summed across every application the wallet trades through */
|
|
134
134
|
spotVolume14d: z.string(),
|
|
135
|
-
/** Caller's rolling 14-day perp volume */
|
|
135
|
+
/** Caller's rolling 14-day perp volume, summed across every application the wallet trades through */
|
|
136
136
|
perpVolume14d: z.string(),
|
|
137
137
|
/** Additional weighted volume needed to reach the next tier; absent at tier 6 */
|
|
138
138
|
volumeToNextTier: z.string().nullable().optional(),
|
|
@@ -159,7 +159,7 @@ export interface ReplaceOrderResponse {
|
|
|
159
159
|
status: "SUCCESS" | "FAILED";
|
|
160
160
|
/** Operation message */
|
|
161
161
|
message: string;
|
|
162
|
-
/**
|
|
162
|
+
/** The replacement's price and total quantity (see {@link UpdatedFields}) */
|
|
163
163
|
updatedFields: UpdatedFields;
|
|
164
164
|
/** Original order identifier that was replaced */
|
|
165
165
|
originalOrderId?: string;
|
|
@@ -167,12 +167,19 @@ export interface ReplaceOrderResponse {
|
|
|
167
167
|
matchResult?: MatchResult;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* The replacement's price and quantity, as the replace operation placed them
|
|
171
171
|
*/
|
|
172
172
|
export interface UpdatedFields {
|
|
173
|
-
/**
|
|
173
|
+
/** The replacement's price: the requested price, or the original order's when omitted */
|
|
174
174
|
price?: string;
|
|
175
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* The replacement's TOTAL quantity, not its resting size: the requested
|
|
177
|
+
* quantity, or the original order's total when omitted. A 100-lot with 60
|
|
178
|
+
* filled reports "100" and rests 40; read the order's `remainingQuantity`
|
|
179
|
+
* for the resting size. For a margin reduce-only replacement it is the close
|
|
180
|
+
* size placed (the requested quantity, or the original's remaining quantity
|
|
181
|
+
* when omitted).
|
|
182
|
+
*/
|
|
176
183
|
quantity?: string;
|
|
177
184
|
}
|
|
178
185
|
/**
|
|
@@ -336,7 +343,7 @@ export interface BatchReplaceResult {
|
|
|
336
343
|
originalOrderId: string;
|
|
337
344
|
/** New order identifier (if successful) */
|
|
338
345
|
newOrderId?: string;
|
|
339
|
-
/**
|
|
346
|
+
/** The replacement's price and total quantity, if successful (see {@link UpdatedFields}) */
|
|
340
347
|
updatedFields?: UpdatedFields;
|
|
341
348
|
/** Match result information if the new order was processed */
|
|
342
349
|
matchResult?: MatchResult;
|
|
@@ -435,7 +442,12 @@ export interface BatchReplaceOrderParams {
|
|
|
435
442
|
orderId: string;
|
|
436
443
|
/** New order price (optional) */
|
|
437
444
|
price?: string;
|
|
438
|
-
/**
|
|
445
|
+
/**
|
|
446
|
+
* New TOTAL order quantity (optional): the replacement rests this total
|
|
447
|
+
* minus the already-filled amount, so it must exceed the filled amount.
|
|
448
|
+
* Omitted, the order keeps its total. A margin reduce-only quantity is a
|
|
449
|
+
* close size, placed as given.
|
|
450
|
+
*/
|
|
439
451
|
quantity?: string;
|
|
440
452
|
/** For sub-accounts: use master's balance (optional) */
|
|
441
453
|
useMasterBalance?: boolean;
|
|
@@ -70,6 +70,16 @@ export declare const PreviewFollowSchema: z.ZodObject<{
|
|
|
70
70
|
allocation: z.ZodString;
|
|
71
71
|
tradingPairIds: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
72
72
|
}, z.core.$strict>;
|
|
73
|
+
/**
|
|
74
|
+
* Params for adding margin to one of your copy positions: `amount` moves from
|
|
75
|
+
* the follow's copy account into the margin of its isolated copy position on
|
|
76
|
+
* `tradingPairId`. The follow id is sent in the path, the rest in the body.
|
|
77
|
+
*/
|
|
78
|
+
export declare const AddFollowPositionMarginSchema: z.ZodObject<{
|
|
79
|
+
followId: z.ZodUUID;
|
|
80
|
+
tradingPairId: z.ZodUUID;
|
|
81
|
+
amount: z.ZodString;
|
|
82
|
+
}, z.core.$strict>;
|
|
73
83
|
/** Params for the public leaderboard. */
|
|
74
84
|
export declare const ListLeadTradersSchema: z.ZodObject<{
|
|
75
85
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
@@ -107,6 +117,7 @@ export declare const ListMyFollowersSchema: z.ZodObject<{
|
|
|
107
117
|
export type UpsertLeadTraderParams = z.input<typeof UpsertLeadTraderSchema>;
|
|
108
118
|
export type UpsertFollowParams = z.input<typeof UpsertFollowSchema>;
|
|
109
119
|
export type PreviewFollowParams = z.input<typeof PreviewFollowSchema>;
|
|
120
|
+
export type AddFollowPositionMarginParams = z.input<typeof AddFollowPositionMarginSchema>;
|
|
110
121
|
export type ListLeadTradersParams = z.input<typeof ListLeadTradersSchema>;
|
|
111
122
|
export type ListLeadTraderClosedTradesParams = z.input<typeof ListLeadTraderClosedTradesSchema>;
|
|
112
123
|
export type ListMyFollowsParams = z.input<typeof ListMyFollowsSchema>;
|
|
@@ -123,6 +123,21 @@ export const PreviewFollowSchema = z
|
|
|
123
123
|
})
|
|
124
124
|
.strict()
|
|
125
125
|
.superRefine((params, ctx) => termRules(params, ctx));
|
|
126
|
+
/**
|
|
127
|
+
* Params for adding margin to one of your copy positions: `amount` moves from
|
|
128
|
+
* the follow's copy account into the margin of its isolated copy position on
|
|
129
|
+
* `tradingPairId`. The follow id is sent in the path, the rest in the body.
|
|
130
|
+
*/
|
|
131
|
+
export const AddFollowPositionMarginSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
/** The follow's id. */
|
|
134
|
+
followId: UUIDSchema,
|
|
135
|
+
/** Trading pair of the copy position to add margin to. */
|
|
136
|
+
tradingPairId: UUIDSchema,
|
|
137
|
+
/** Margin to add, in quote units, taken from the follow's copy account. */
|
|
138
|
+
amount: PositiveDecimalStringSchema,
|
|
139
|
+
})
|
|
140
|
+
.strict();
|
|
126
141
|
/** Params for the public leaderboard. */
|
|
127
142
|
export const ListLeadTradersSchema = z
|
|
128
143
|
.object({
|
|
@@ -107,7 +107,7 @@ export interface PositionEventData {
|
|
|
107
107
|
/**
|
|
108
108
|
* What triggered the update. Free-form, but the server uses a canonical set:
|
|
109
109
|
* `trade`, `close`, `liquidation`, `adl`, `funding`, `margin_added`,
|
|
110
|
-
* `margin_reduced
|
|
110
|
+
* `margin_reduced`.
|
|
111
111
|
*/
|
|
112
112
|
reason: string;
|
|
113
113
|
/**
|
|
@@ -147,8 +147,8 @@ export interface PositionEventData {
|
|
|
147
147
|
* anything was persisted. Four cases reach it: the frame came from a
|
|
148
148
|
* producer that predates this field; the emit path wrote no row;
|
|
149
149
|
* the path DID write the row but re-reads live risk state after sequencing
|
|
150
|
-
* (funding
|
|
151
|
-
*
|
|
150
|
+
* (`funding`), so the mutation did advance the persisted version; or the
|
|
151
|
+
* frame is a different projection of the row
|
|
152
152
|
* than persistence stores (terminal frames report `size` 0 and
|
|
153
153
|
* `LIQUIDATED`, while the stored row keeps its size and records `CLOSED`).
|
|
154
154
|
* In the last two, a REST read or a fresh snapshot ranks the mutation.
|
|
@@ -172,13 +172,17 @@ export interface PositionEventData {
|
|
|
172
172
|
* mutation — up to the one-hour funding interval.
|
|
173
173
|
*
|
|
174
174
|
* A frame is ranked only when it is a faithful projection of the row
|
|
175
|
-
* persisted at that sequence:
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* the
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
175
|
+
* persisted at that sequence: fills that leave a position OPEN, direct
|
|
176
|
+
* isolated-position margin adds/reductions, and copy-position margin adds.
|
|
177
|
+
* The copy add refreshes the isolated child and its copy-cross siblings at
|
|
178
|
+
* the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop
|
|
179
|
+
* refreshes use `margin_added`/`margin_reduced` but are UNRANKED because
|
|
180
|
+
* those commands write no position rows. Funding re-reads live state after
|
|
181
|
+
* sequencing and is also unranked. TERMINAL frames are unranked because
|
|
182
|
+
* they report `size` 0 and `LIQUIDATED` while the stored row keeps its size
|
|
183
|
+
* and records `CLOSED`. Wallet IN/OUT and plain isolated allocation emit no
|
|
184
|
+
* position frame. Transfer frames use captured post-command state and are
|
|
185
|
+
* released only after durable acknowledgement.
|
|
182
186
|
*/
|
|
183
187
|
version?: number;
|
|
184
188
|
}
|
|
@@ -29,6 +29,13 @@ export type TwapOrderEventReason = "created" | "slice_placed" | "slice_skipped"
|
|
|
29
29
|
*/
|
|
30
30
|
export interface TwapOrderEventData {
|
|
31
31
|
twapOrderId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Opaque same-parent reconciliation revision. Compare only updates for this
|
|
34
|
+
* `twapOrderId`: accept an update when its version is greater than or equal
|
|
35
|
+
* to the stored version, ignore lower versions, and expect gaps. A snapshot
|
|
36
|
+
* wins ties. Absent on legacy updates whose revision is unknown.
|
|
37
|
+
*/
|
|
38
|
+
version?: number;
|
|
32
39
|
tradingPairId: string;
|
|
33
40
|
side: OrderSide | (string & {});
|
|
34
41
|
tradingMode: TradingMode | (string & {});
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
* hand-written SDK surface. CI regenerates it and fails on a diff, identical to
|
|
11
11
|
* the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
|
|
12
12
|
*/
|
|
13
|
-
export declare const OPERATION_IDS: readonly ["attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "verify_signature"];
|
|
14
14
|
/** Union of every OpenAPI operationId in the spec. */
|
|
15
15
|
export type OperationId = (typeof OPERATION_IDS)[number];
|