@0xmonaco/types 1.0.43 → 1.0.45
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/margin-accounts/index.d.ts +9 -5
- package/dist/portfolio/index.d.ts +29 -0
- package/dist/positions/index.d.ts +12 -0
- package/dist/trading/index.d.ts +5 -1
- package/dist/validation/vault.d.ts +3 -0
- package/dist/validation/vault.js +6 -0
- package/dist/vault/index.d.ts +22 -2
- package/dist/websocket/events/index.d.ts +1 -0
- package/dist/websocket/events/index.js +1 -0
- package/dist/websocket/events/instrument-events.d.ts +79 -0
- package/dist/websocket/events/instrument-events.js +22 -0
- package/dist/wire/schema.d.ts +80 -7
- package/package.json +3 -7
|
@@ -63,11 +63,15 @@ export interface GetAvailableCollateralResponse {
|
|
|
63
63
|
* value, so the two surfaces cannot disagree. Absent when the user has no
|
|
64
64
|
* margin account yet.
|
|
65
65
|
*
|
|
66
|
-
* This is **not** trading headroom
|
|
67
|
-
* not earmarked by risk buckets) as well
|
|
68
|
-
* unrealized gain does not raise it: a
|
|
69
|
-
*
|
|
70
|
-
* `MarginAccountSummary.freeCollateral
|
|
66
|
+
* This is **not** trading headroom for existing cross exposure. It is
|
|
67
|
+
* bounded by allocation (principal not earmarked by risk buckets) as well
|
|
68
|
+
* as by margin requirements, and an unrealized gain does not raise it: a
|
|
69
|
+
* mark-to-market gain is initial margin against existing cross exposure but
|
|
70
|
+
* may not fund an exit. `MarginAccountSummary.freeCollateral` credits that
|
|
71
|
+
* gain in full and remains the trading-margin headroom for existing cross
|
|
72
|
+
* exposure — but a **new** isolated or first-use position allocates
|
|
73
|
+
* principal through the same gate this field measures, so size those from
|
|
74
|
+
* this field.
|
|
71
75
|
*
|
|
72
76
|
* Note the two `margin*` fields answer opposite questions:
|
|
73
77
|
* {@link marginTransferable} is wallet-to-margin capacity, this is the
|
|
@@ -160,6 +160,25 @@ export interface PortfolioMarginTotal {
|
|
|
160
160
|
initialMarginRequired: string;
|
|
161
161
|
maintenanceMarginRequired: string;
|
|
162
162
|
unrealizedPnl: string;
|
|
163
|
+
/**
|
|
164
|
+
* The largest amount that can actually leave the parent margin account — the
|
|
165
|
+
* bound the engine enforces on transfers-out and withdrawals, and therefore
|
|
166
|
+
* also the effective ceiling on funding new isolated or first-use order
|
|
167
|
+
* capacity (allocating collateral to a risk bucket passes through the same
|
|
168
|
+
* principal-gated door).
|
|
169
|
+
*
|
|
170
|
+
* NOT a clamped `parentAvailableCollateral`: that is an equity figure which
|
|
171
|
+
* credits settled realized PnL, accrued funding, and unrealized gains that a
|
|
172
|
+
* transfer-out cannot move. This bound never credits an unrealized gain, and
|
|
173
|
+
* under the default capacity basis it also excludes non-principal balances —
|
|
174
|
+
* `min(deposited principal - bucket allocations, freeCollateral - max(unrealizedPnl, 0))`,
|
|
175
|
+
* floored at zero. Whatever the engine's configured capacity basis, this is
|
|
176
|
+
* the bound its gates actually enforce. Size transfers-out, withdrawals, and
|
|
177
|
+
* new isolated or first-use positions from this field;
|
|
178
|
+
* `parentAvailableCollateral` remains the trading-margin headroom for
|
|
179
|
+
* existing cross exposure.
|
|
180
|
+
*/
|
|
181
|
+
withdrawableCollateral: string;
|
|
163
182
|
}
|
|
164
183
|
export interface PortfolioMarginPositionCounts {
|
|
165
184
|
total: number;
|
|
@@ -174,6 +193,16 @@ export interface PortfolioRiskBucket {
|
|
|
174
193
|
maintenanceMarginRequired: string;
|
|
175
194
|
unrealizedPnl: string;
|
|
176
195
|
positionCount: number;
|
|
196
|
+
/**
|
|
197
|
+
* The largest transfer-out of this risk bucket the engine will actually
|
|
198
|
+
* accept. NOT a clamped `freeCollateral`: capped by the bucket's settled
|
|
199
|
+
* capacity (its allocated collateral, under the default capacity basis),
|
|
200
|
+
* and an unrealized gain never raises it. This is the largest
|
|
201
|
+
* accepted transfer-out, not a promise that every smaller one is accepted —
|
|
202
|
+
* an underwater flat bucket accepts its full close-out while refusing
|
|
203
|
+
* partial withdrawals below it.
|
|
204
|
+
*/
|
|
205
|
+
withdrawableCollateral: string;
|
|
177
206
|
}
|
|
178
207
|
export interface PortfolioMargin {
|
|
179
208
|
asOf: string;
|
|
@@ -89,6 +89,18 @@ export interface Position {
|
|
|
89
89
|
* included. Terminal rows only; absent when unavailable.
|
|
90
90
|
*/
|
|
91
91
|
feesPaid?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Total lifetime trading fees for the position: opening-fill fees plus every
|
|
94
|
+
* reducing execution's fees — decreases, close, and any liquidation penalty.
|
|
95
|
+
* Signed; negative means net rebated, inclusive of the application-fee
|
|
96
|
+
* component. Unlike `feesPaid` (the closing-side reducing-execution portion,
|
|
97
|
+
* which omits opening fills) this is the whole-life figure, on open and
|
|
98
|
+
* terminal rows alike. Null when the opening-fill fees are unavailable —
|
|
99
|
+
* before the position's first PnL sample flushes, after its samples age out
|
|
100
|
+
* of PnL retention, or for positions predating the PnL service — rather than
|
|
101
|
+
* an understated partial.
|
|
102
|
+
*/
|
|
103
|
+
cumFees?: string;
|
|
92
104
|
}
|
|
93
105
|
export interface ListPositionsParams {
|
|
94
106
|
marginAccountId?: string;
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -125,7 +125,11 @@ export interface TradingAPI extends BaseAPI {
|
|
|
125
125
|
* @param orderId - ID of the order to replace
|
|
126
126
|
* @param newOrder - New order parameters
|
|
127
127
|
* @param newOrder.price - New order price as string (optional)
|
|
128
|
-
* @param newOrder.quantity - New
|
|
128
|
+
* @param newOrder.quantity - New TOTAL quantity as string (optional). On a
|
|
129
|
+
* partially filled order the replacement rests `total - filled` and locks
|
|
130
|
+
* collateral for that remainder only (FIX convention: `LeavesQty =
|
|
131
|
+
* OrderQty - CumQty`); must exceed the filled amount. Omitted, the
|
|
132
|
+
* replacement keeps the unfilled remainder.
|
|
129
133
|
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
130
134
|
* @param newOrder.postOnly - Re-states post-only intent for the replacement (nothing is inherited from the original order)
|
|
131
135
|
* @returns Promise resolving to a `ReplaceOrderResponse`
|
|
@@ -48,6 +48,9 @@ export declare const DepositSchema: z.ZodObject<{
|
|
|
48
48
|
spot: "spot";
|
|
49
49
|
margin: "margin";
|
|
50
50
|
}>>;
|
|
51
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
52
|
+
asErc20: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
51
54
|
}, z.core.$strip>;
|
|
52
55
|
/**
|
|
53
56
|
* Withdraw validation schema.
|
package/dist/validation/vault.js
CHANGED
|
@@ -59,6 +59,12 @@ export const DepositSchema = z.object({
|
|
|
59
59
|
autoWait: z.boolean().optional(),
|
|
60
60
|
// Destination ledger: "spot" (default) or "margin" to route into margin collateral.
|
|
61
61
|
target: z.enum(["spot", "margin"]).optional(),
|
|
62
|
+
// asErc20: deposit the wrapped-native asset as its ERC20 (depositERC20) instead of native coin.
|
|
63
|
+
options: z
|
|
64
|
+
.object({
|
|
65
|
+
asErc20: z.boolean().optional(),
|
|
66
|
+
})
|
|
67
|
+
.optional(),
|
|
62
68
|
});
|
|
63
69
|
/**
|
|
64
70
|
* Withdraw validation schema.
|
package/dist/vault/index.d.ts
CHANGED
|
@@ -15,6 +15,21 @@ import type { Balance, TransactionResult, WithdrawalRetryOptions, WithdrawResult
|
|
|
15
15
|
* to spot — funds are never lost.
|
|
16
16
|
*/
|
|
17
17
|
export type DepositTarget = "spot" | "margin";
|
|
18
|
+
/**
|
|
19
|
+
* Options for a deposit.
|
|
20
|
+
*/
|
|
21
|
+
export interface DepositOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Deposit the wrapped-native asset (e.g. WSEI) as its ERC20 instead of in
|
|
24
|
+
* native coin. By default the SDK deposits that asset via the payable
|
|
25
|
+
* `depositNative` (spending native coin, which the vault wraps on entry);
|
|
26
|
+
* set this when the wallet holds the wrapped ERC20 itself — the deposit then
|
|
27
|
+
* goes through the standard `approve` + `depositERC20` path and consumes an
|
|
28
|
+
* ERC20 allowance. Withdrawals still pay out native coin (the vault
|
|
29
|
+
* unwraps). Has no effect on assets that are not the wrapped-native asset.
|
|
30
|
+
*/
|
|
31
|
+
asErc20?: boolean;
|
|
32
|
+
}
|
|
18
33
|
/**
|
|
19
34
|
* Source ledger for an external withdrawal.
|
|
20
35
|
* - `"spot"` (default): withdraw from the spot/main wallet.
|
|
@@ -44,9 +59,11 @@ export interface VaultAPI extends BaseAPI {
|
|
|
44
59
|
* @param target - Destination ledger: `"spot"` (default) or `"margin"` to
|
|
45
60
|
* route the deposit into the parent margin account's collateral. Margin
|
|
46
61
|
* deposits that cannot be routed fall back to spot.
|
|
62
|
+
* @param options - Deposit options; `asErc20` deposits the wrapped-native
|
|
63
|
+
* asset as its ERC20 via `depositERC20` instead of in native coin.
|
|
47
64
|
* @returns Promise resolving to the transaction result
|
|
48
65
|
*/
|
|
49
|
-
deposit(assetId: string, amount: bigint, autoWait?: boolean, target?: DepositTarget): Promise<TransactionResult>;
|
|
66
|
+
deposit(assetId: string, amount: bigint, autoWait?: boolean, target?: DepositTarget, options?: DepositOptions): Promise<TransactionResult>;
|
|
50
67
|
/**
|
|
51
68
|
* Initiates a withdrawal and submits its `executeWithdrawal(...)` calldata
|
|
52
69
|
* on-chain through the connected wallet.
|
|
@@ -99,9 +116,12 @@ export interface VaultAPI extends BaseAPI {
|
|
|
99
116
|
* Checks if a token needs approval for an amount.
|
|
100
117
|
* @param assetId - Asset identifier (UUID) to check
|
|
101
118
|
* @param amount - Amount to check
|
|
119
|
+
* @param options - Deposit options the approval is for; with `asErc20` the
|
|
120
|
+
* wrapped-native asset consumes a real ERC20 allowance, so its allowance
|
|
121
|
+
* is read instead of short-circuiting to false.
|
|
102
122
|
* @returns Promise resolving to whether approval is needed
|
|
103
123
|
*/
|
|
104
|
-
needsApproval(assetId: string, amount: bigint): Promise<boolean>;
|
|
124
|
+
needsApproval(assetId: string, amount: bigint, options?: DepositOptions): Promise<boolean>;
|
|
105
125
|
/**
|
|
106
126
|
* Gets the address of the vault.
|
|
107
127
|
* @returns Promise resolving to the address of the vault
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./account-events";
|
|
2
2
|
export * from "./balance-events";
|
|
3
3
|
export * from "./conditional-order-events";
|
|
4
|
+
export * from "./instrument-events";
|
|
4
5
|
export * from "./liquidation-events";
|
|
5
6
|
export * from "./market-stats-events";
|
|
6
7
|
export * from "./movement-events";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./account-events";
|
|
2
2
|
export * from "./balance-events";
|
|
3
3
|
export * from "./conditional-order-events";
|
|
4
|
+
export * from "./instrument-events";
|
|
4
5
|
export * from "./liquidation-events";
|
|
5
6
|
export * from "./market-stats-events";
|
|
6
7
|
export * from "./movement-events";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instrument WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public `instrument` channel: trading-pair lifecycle and
|
|
5
|
+
* configuration changes — new listings, delistings, halts/unhalts, and edits to
|
|
6
|
+
* tick size, quantity step, order-size bounds, or (for perp markets) leverage
|
|
7
|
+
* and margin-rate bounds.
|
|
8
|
+
*
|
|
9
|
+
* This is a public channel (no authentication). Lag policy is Conflate: a
|
|
10
|
+
* lagging subscriber is fast-forwarded to the latest frame rather than
|
|
11
|
+
* disconnected. Every frame carries the market's FULL current configuration
|
|
12
|
+
* (not just the changed fields), so consume it as a terminal-state snapshot per
|
|
13
|
+
* market and never as an additive delta; `changedFields` names which fields the
|
|
14
|
+
* mutation touched, for callers that want to react selectively.
|
|
15
|
+
*
|
|
16
|
+
* A subscriber receives a subscribe-time snapshot of the current active-pair
|
|
17
|
+
* configuration list (each frame a `Listing` baseline) before the live diffs.
|
|
18
|
+
*
|
|
19
|
+
* Perp-only fields (`maxLeverage`, `initialMarginRate`, `maintenanceMarginRate`)
|
|
20
|
+
* are optional and omitted on the wire for spot markets, which have no leverage
|
|
21
|
+
* or margin parameters. All numeric quantities are decimal strings.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The kind of instrument change a frame reports.
|
|
25
|
+
*
|
|
26
|
+
* - `listing`: a market became tradable (created active, or re-activated).
|
|
27
|
+
* - `delisting`: a market was deactivated (`isActive` toggled false, or created
|
|
28
|
+
* inactive).
|
|
29
|
+
* - `halt` / `unhalt`: trading was halted / resumed. Reserved for a future
|
|
30
|
+
* market-regime producer; not emitted by admin trading-pair mutations.
|
|
31
|
+
* - `config_change`: a non-activation config edit (tick size, step size,
|
|
32
|
+
* order-size bounds, category, or leverage/margin bounds).
|
|
33
|
+
*/
|
|
34
|
+
export type InstrumentChangeKind = "listing" | "delisting" | "halt" | "unhalt" | "config_change";
|
|
35
|
+
/**
|
|
36
|
+
* Full current configuration for a market on the `instrument` channel.
|
|
37
|
+
*/
|
|
38
|
+
export interface InstrumentEventData {
|
|
39
|
+
/** What changed for this market */
|
|
40
|
+
change: InstrumentChangeKind;
|
|
41
|
+
/** Trading pair identifier (UUID) */
|
|
42
|
+
tradingPairId: string;
|
|
43
|
+
/** Market symbol, e.g. "BTC/USDC" */
|
|
44
|
+
symbol: string;
|
|
45
|
+
/** Whether the market is currently active (tradable) */
|
|
46
|
+
isActive: boolean;
|
|
47
|
+
/** Price tick size (decimal string) */
|
|
48
|
+
tickSize: string;
|
|
49
|
+
/** Quantity step size (decimal string) */
|
|
50
|
+
quantityStepSize: string;
|
|
51
|
+
/** Minimum order size (decimal string) */
|
|
52
|
+
minOrderSize: string;
|
|
53
|
+
/** Maximum order size (decimal string) */
|
|
54
|
+
maxOrderSize: string;
|
|
55
|
+
/** Market type, e.g. "spot" or "margin" */
|
|
56
|
+
marketType: string;
|
|
57
|
+
/** Asset-class category, e.g. "crypto", "equities", "commodities" */
|
|
58
|
+
category: string;
|
|
59
|
+
/** Maximum leverage (decimal string). Perp-only; omitted for spot. */
|
|
60
|
+
maxLeverage?: string;
|
|
61
|
+
/** Initial margin rate (decimal string). Perp-only; omitted for spot. */
|
|
62
|
+
initialMarginRate?: string;
|
|
63
|
+
/** Maintenance margin rate (decimal string). Perp-only; omitted for spot. */
|
|
64
|
+
maintenanceMarginRate?: string;
|
|
65
|
+
/** Names of the fields this mutation touched (snake_case wire field names) */
|
|
66
|
+
changedFields: string[];
|
|
67
|
+
/** Timestamp when the configuration was last updated (ISO 8601) */
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Instrument event on the `instrument:<tradingPairId>` channel (or the
|
|
72
|
+
* all-markets `instrument` channel, which streams one event per market).
|
|
73
|
+
*/
|
|
74
|
+
export interface InstrumentEvent {
|
|
75
|
+
/** Trading pair identifier (UUID) */
|
|
76
|
+
tradingPairId: string;
|
|
77
|
+
/** Current market configuration */
|
|
78
|
+
data: InstrumentEventData;
|
|
79
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instrument WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public `instrument` channel: trading-pair lifecycle and
|
|
5
|
+
* configuration changes — new listings, delistings, halts/unhalts, and edits to
|
|
6
|
+
* tick size, quantity step, order-size bounds, or (for perp markets) leverage
|
|
7
|
+
* and margin-rate bounds.
|
|
8
|
+
*
|
|
9
|
+
* This is a public channel (no authentication). Lag policy is Conflate: a
|
|
10
|
+
* lagging subscriber is fast-forwarded to the latest frame rather than
|
|
11
|
+
* disconnected. Every frame carries the market's FULL current configuration
|
|
12
|
+
* (not just the changed fields), so consume it as a terminal-state snapshot per
|
|
13
|
+
* market and never as an additive delta; `changedFields` names which fields the
|
|
14
|
+
* mutation touched, for callers that want to react selectively.
|
|
15
|
+
*
|
|
16
|
+
* A subscriber receives a subscribe-time snapshot of the current active-pair
|
|
17
|
+
* configuration list (each frame a `Listing` baseline) before the live diffs.
|
|
18
|
+
*
|
|
19
|
+
* Perp-only fields (`maxLeverage`, `initialMarginRate`, `maintenanceMarginRate`)
|
|
20
|
+
* are optional and omitted on the wire for spot markets, which have no leverage
|
|
21
|
+
* or margin parameters. All numeric quantities are decimal strings.
|
|
22
|
+
*/
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -2823,7 +2823,7 @@ export interface components {
|
|
|
2823
2823
|
*/
|
|
2824
2824
|
price?: string | null;
|
|
2825
2825
|
/**
|
|
2826
|
-
* @description New quantity (if changing)
|
|
2826
|
+
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder.
|
|
2827
2827
|
* @example 0.7
|
|
2828
2828
|
*/
|
|
2829
2829
|
quantity?: string | null;
|
|
@@ -3760,11 +3760,14 @@ export interface components {
|
|
|
3760
3760
|
* value, so the two surfaces cannot disagree. Absent when the user has no
|
|
3761
3761
|
* margin account yet.
|
|
3762
3762
|
*
|
|
3763
|
-
* This is NOT trading headroom. It is bounded
|
|
3764
|
-
* earmarked by risk buckets) as well as by
|
|
3765
|
-
* unrealized gain does not raise it: a
|
|
3766
|
-
*
|
|
3767
|
-
* `MarginAccountSummary.free_collateral
|
|
3763
|
+
* This is NOT trading headroom for existing cross exposure. It is bounded
|
|
3764
|
+
* by allocation (principal not earmarked by risk buckets) as well as by
|
|
3765
|
+
* margin requirements, and an unrealized gain does not raise it: a
|
|
3766
|
+
* mark-to-market gain is initial margin against existing cross exposure but
|
|
3767
|
+
* may not fund an exit. `MarginAccountSummary.free_collateral` credits that
|
|
3768
|
+
* gain in full and remains the trading-margin headroom for existing cross
|
|
3769
|
+
* exposure — but a NEW isolated or first-use position allocates principal
|
|
3770
|
+
* through the same gate this field measures, so size those from this field.
|
|
3768
3771
|
*
|
|
3769
3772
|
* Note the two `margin_*` fields answer opposite questions:
|
|
3770
3773
|
* `margin_transferable` is wallet-to-margin capacity, this is the amount that
|
|
@@ -4772,6 +4775,19 @@ export interface components {
|
|
|
4772
4775
|
* executions do not account for its whole lifetime.
|
|
4773
4776
|
*/
|
|
4774
4777
|
feesPaid?: string | null;
|
|
4778
|
+
/**
|
|
4779
|
+
* @description Total lifetime trading fees for the position: opening-fill fees (from the
|
|
4780
|
+
* PnL cost-basis engine) plus every reducing execution's fees — decreases,
|
|
4781
|
+
* close, and any liquidation penalty. Signed; negative means net rebated,
|
|
4782
|
+
* inclusive of the application-fee component. Unlike the closing-side
|
|
4783
|
+
* reducing-execution fee field above, which omits opening fills, this is the
|
|
4784
|
+
* whole-life figure, on open and terminal rows alike.
|
|
4785
|
+
* Null when the opening-fill fees are unavailable — before the position's
|
|
4786
|
+
* first PnL sample flushes, after its samples age out of PnL retention, or
|
|
4787
|
+
* for positions predating the PnL service — rather than an understated
|
|
4788
|
+
* partial.
|
|
4789
|
+
*/
|
|
4790
|
+
cumFees?: string | null;
|
|
4775
4791
|
};
|
|
4776
4792
|
GetPositionRiskResponse: {
|
|
4777
4793
|
positionId?: string | null;
|
|
@@ -5844,6 +5860,32 @@ export interface components {
|
|
|
5844
5860
|
initialMarginRequired?: string | null;
|
|
5845
5861
|
maintenanceMarginRequired?: string | null;
|
|
5846
5862
|
unrealizedPnl?: string | null;
|
|
5863
|
+
/**
|
|
5864
|
+
* @description The largest amount that can actually leave the parent margin account —
|
|
5865
|
+
* the bound the engine enforces on transfers-out and withdrawals, and
|
|
5866
|
+
* therefore also the effective ceiling on funding new isolated or
|
|
5867
|
+
* first-use order capacity, because allocating collateral to a risk
|
|
5868
|
+
* bucket passes through the same principal-gated door.
|
|
5869
|
+
*
|
|
5870
|
+
* NOT a clamped `parent_available_collateral`. That field is
|
|
5871
|
+
* `free_collateral`, an equity figure: it credits settled realized PnL,
|
|
5872
|
+
* accrued funding, and mark-to-market gains that a transfer-out cannot
|
|
5873
|
+
* move, so the two can differ without limit. This bound never credits an
|
|
5874
|
+
* unrealized gain. Under the default capacity basis it also excludes
|
|
5875
|
+
* non-principal balances such as banked realized PnL:
|
|
5876
|
+
* `min(deposited principal - bucket allocations,
|
|
5877
|
+
* free_collateral - max(unrealized_pnl, 0))`, floored at zero. Whatever
|
|
5878
|
+
* the engine's configured capacity basis, this is the bound its gates
|
|
5879
|
+
* actually enforce. It agrees with
|
|
5880
|
+
* `MarginAccountSummary.withdrawable_collateral` up to quote-decimal
|
|
5881
|
+
* truncation: this surface truncates toward zero at the quote asset's
|
|
5882
|
+
* precision, while the margin-accounts surface may carry sub-tick tails.
|
|
5883
|
+
*
|
|
5884
|
+
* Size transfers-out, withdrawals, and new isolated/first-use positions
|
|
5885
|
+
* from this field; `parent_available_collateral` remains the trading-margin
|
|
5886
|
+
* headroom for existing cross exposure.
|
|
5887
|
+
*/
|
|
5888
|
+
withdrawableCollateral?: string | null;
|
|
5847
5889
|
};
|
|
5848
5890
|
PortfolioPerformanceDrawdown: {
|
|
5849
5891
|
/** @description Positive transfer-neutral loss magnitude */
|
|
@@ -5883,6 +5925,24 @@ export interface components {
|
|
|
5883
5925
|
maintenanceMarginRequired?: string | null;
|
|
5884
5926
|
unrealizedPnl?: string | null;
|
|
5885
5927
|
positionCount?: string | null;
|
|
5928
|
+
/**
|
|
5929
|
+
* @description The largest transfer-out of this risk bucket the engine will actually
|
|
5930
|
+
* accept — the bound enforced on bucket collateral withdrawals.
|
|
5931
|
+
*
|
|
5932
|
+
* NOT a clamped `free_collateral`: free collateral is equity headroom and
|
|
5933
|
+
* credits realized PnL and mark-to-market gains that a transfer-out cannot
|
|
5934
|
+
* move. This bound is capped by the bucket's settled capacity (its
|
|
5935
|
+
* allocated collateral, under the default capacity basis), and an
|
|
5936
|
+
* unrealized gain never raises it.
|
|
5937
|
+
*
|
|
5938
|
+
* This is the largest accepted transfer-out, NOT a promise that every
|
|
5939
|
+
* smaller one is accepted: an underwater flat bucket accepts its full
|
|
5940
|
+
* close-out while refusing partial withdrawals below it. Agrees with the
|
|
5941
|
+
* risk-bucket rows' `MarginAccountSummary.withdrawable_collateral` up to
|
|
5942
|
+
* quote-decimal truncation (this surface truncates toward zero; that one
|
|
5943
|
+
* may carry sub-tick tails).
|
|
5944
|
+
*/
|
|
5945
|
+
withdrawableCollateral?: string | null;
|
|
5886
5946
|
};
|
|
5887
5947
|
PortfolioSeriesWindow: {
|
|
5888
5948
|
/**
|
|
@@ -6028,6 +6088,19 @@ export interface components {
|
|
|
6028
6088
|
* executions do not account for its whole lifetime.
|
|
6029
6089
|
*/
|
|
6030
6090
|
feesPaid?: string | null;
|
|
6091
|
+
/**
|
|
6092
|
+
* @description Total lifetime trading fees for the position: opening-fill fees (from the
|
|
6093
|
+
* PnL cost-basis engine) plus every reducing execution's fees — decreases,
|
|
6094
|
+
* close, and any liquidation penalty. Signed; negative means net rebated,
|
|
6095
|
+
* inclusive of the application-fee component. Unlike the closing-side
|
|
6096
|
+
* reducing-execution fee field above, which omits opening fills, this is the
|
|
6097
|
+
* whole-life figure, on open and terminal rows alike.
|
|
6098
|
+
* Null when the opening-fill fees are unavailable — before the position's
|
|
6099
|
+
* first PnL sample flushes, after its samples age out of PnL retention, or
|
|
6100
|
+
* for positions predating the PnL service — rather than an understated
|
|
6101
|
+
* partial.
|
|
6102
|
+
*/
|
|
6103
|
+
cumFees?: string | null;
|
|
6031
6104
|
};
|
|
6032
6105
|
PositionHistoryEvent: {
|
|
6033
6106
|
id?: string | null;
|
|
@@ -6284,7 +6357,7 @@ export interface components {
|
|
|
6284
6357
|
*/
|
|
6285
6358
|
price?: string | null;
|
|
6286
6359
|
/**
|
|
6287
|
-
* @description New quantity (if changing)
|
|
6360
|
+
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder.
|
|
6288
6361
|
* @example 0.7
|
|
6289
6362
|
*/
|
|
6290
6363
|
quantity?: string | null;
|
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/Monaco-Research/monaco-sdk.git",
|
|
8
|
-
"directory": "packages/types"
|
|
9
|
-
},
|
|
5
|
+
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
10
6
|
"main": "./dist/index.js",
|
|
11
7
|
"module": "./dist/index.js",
|
|
12
8
|
"types": "./dist/index.d.ts",
|
|
@@ -20,7 +16,7 @@
|
|
|
20
16
|
"lint": "biome lint ."
|
|
21
17
|
},
|
|
22
18
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "1.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.45",
|
|
24
20
|
"zod": "^4.1.12"
|
|
25
21
|
},
|
|
26
22
|
"peerDependencies": {
|