@0xmonaco/types 1.0.44 → 1.0.46
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/positions/index.d.ts +12 -0
- package/dist/trading/index.d.ts +10 -2
- package/dist/trading/responses.d.ts +45 -0
- 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/operations.d.ts +1 -1
- package/dist/wire/operations.js +1 -0
- package/dist/wire/schema.d.ts +184 -0
- package/package.json +2 -2
|
@@ -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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { BaseAPI } from "../api/index";
|
|
7
7
|
import type { MarginMode } from "../margin-accounts";
|
|
8
8
|
import type { Order, OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
9
|
-
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder } from "./responses";
|
|
9
|
+
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder } from "./responses";
|
|
10
10
|
/**
|
|
11
11
|
* Trading API interface.
|
|
12
12
|
* Provides methods for placing and managing orders.
|
|
@@ -208,6 +208,14 @@ export interface TradingAPI extends BaseAPI {
|
|
|
208
208
|
* own TWAP orders.
|
|
209
209
|
*/
|
|
210
210
|
getTwapOrder(twapOrderId: string): Promise<TwapOrder>;
|
|
211
|
+
/**
|
|
212
|
+
* Gets the post-execution TCA report for a TERMINAL (COMPLETED or
|
|
213
|
+
* CANCELLED) TWAP parent: realized average price vs the arrival price and
|
|
214
|
+
* the window-TWAP benchmark over the active window. Positive bps =
|
|
215
|
+
* execution beat the reference. Benchmark fields are absent when no price
|
|
216
|
+
* series covered the window sufficiently.
|
|
217
|
+
*/
|
|
218
|
+
getTwapOrderTca(twapOrderId: string): Promise<GetTwapOrderTcaResponse>;
|
|
211
219
|
/**
|
|
212
220
|
* Lists TWAP parent orders for the authenticated user with pagination and
|
|
213
221
|
* optional state / trading pair filters.
|
|
@@ -216,4 +224,4 @@ export interface TradingAPI extends BaseAPI {
|
|
|
216
224
|
}
|
|
217
225
|
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, TimeInForce, TradingMode, TwapOrderState, } from "./orders";
|
|
218
226
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
219
|
-
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder, UpdatedFields, } from "./responses";
|
|
227
|
+
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder, UpdatedFields, } from "./responses";
|
|
@@ -620,6 +620,51 @@ export interface TwapOrder {
|
|
|
620
620
|
/** Completion timestamp (ISO 8601) */
|
|
621
621
|
completedAt?: string;
|
|
622
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Post-execution TCA (transaction cost analysis) report for a TERMINAL
|
|
625
|
+
* (COMPLETED or CANCELLED) TWAP parent.
|
|
626
|
+
*
|
|
627
|
+
* The measurement window is the parent's ACTIVE window — start to the
|
|
628
|
+
* terminal time (never the planned end: a cancelled parent stopped trading
|
|
629
|
+
* at cancellation). Benchmark inputs are computed once, server-side, when
|
|
630
|
+
* the terminal row is projected; the basis-point metrics are derived per
|
|
631
|
+
* read. Sign convention: POSITIVE bps means execution BEAT the reference —
|
|
632
|
+
* a BUY that paid less, a SELL that received more. Benchmark fields are null
|
|
633
|
+
* when no price series covered the window sufficiently (an honest null, not
|
|
634
|
+
* an approximation) and when nothing executed.
|
|
635
|
+
*/
|
|
636
|
+
export interface GetTwapOrderTcaResponse {
|
|
637
|
+
/** TWAP parent order UUID */
|
|
638
|
+
twapOrderId: string;
|
|
639
|
+
/** Trading pair the parent executed on — a report is self-describing */
|
|
640
|
+
tradingPairId: string;
|
|
641
|
+
/** Terminal state the report covers: COMPLETED or CANCELLED */
|
|
642
|
+
state: TwapOrderState;
|
|
643
|
+
/** Parent side (fixes the sign convention) */
|
|
644
|
+
side: OrderSide;
|
|
645
|
+
/** Parent order quantity (decimal string) */
|
|
646
|
+
totalQuantity: string;
|
|
647
|
+
/** Active-window start (ISO 8601, UTC) */
|
|
648
|
+
windowStartAt: string;
|
|
649
|
+
/** Terminal time — completion or cancellation (ISO 8601, UTC) */
|
|
650
|
+
windowTerminalAt: string;
|
|
651
|
+
/** Quantity filled over the window (decimal string) */
|
|
652
|
+
executedQuantity: string;
|
|
653
|
+
/** Unfilled remainder: totalQuantity - executedQuantity, floored at zero */
|
|
654
|
+
shortfallQuantity: string;
|
|
655
|
+
/** Volume-weighted realized price (executedNotional / executedQuantity); absent when nothing executed */
|
|
656
|
+
realizedAvgPrice?: string;
|
|
657
|
+
/** Reference price at (or immediately before) the window start; absent when history could not cover the window */
|
|
658
|
+
arrivalPrice?: string;
|
|
659
|
+
/** Average reference price over the active window; absent when history could not cover the window */
|
|
660
|
+
benchmarkTwapPrice?: string;
|
|
661
|
+
/** Price series both benchmark values came from: risk_mark_1m or ohlcv_1m_close; absent when no series qualified */
|
|
662
|
+
benchmarkSource?: string;
|
|
663
|
+
/** Signed bps vs arrival; positive = beat it; absent when realized or arrival is absent */
|
|
664
|
+
slippageVsArrivalBps?: string;
|
|
665
|
+
/** Signed bps vs the window-TWAP benchmark; positive = beat it; absent when realized or benchmark is absent */
|
|
666
|
+
performanceVsBenchmarkBps?: string;
|
|
667
|
+
}
|
|
623
668
|
/**
|
|
624
669
|
* Query parameters for listing TWAP parent orders.
|
|
625
670
|
*/
|
|
@@ -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
|
+
*/
|
|
@@ -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", "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_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_sub_account_limits", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "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_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "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", "verify_signature"];
|
|
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", "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_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_sub_account_limits", "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_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "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", "verify_signature"];
|
|
14
14
|
/** Union of every OpenAPI operationId in the spec. */
|
|
15
15
|
export type OperationId = (typeof OPERATION_IDS)[number];
|
package/dist/wire/operations.js
CHANGED
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1652,6 +1652,37 @@ export interface paths {
|
|
|
1652
1652
|
patch?: never;
|
|
1653
1653
|
trace?: never;
|
|
1654
1654
|
};
|
|
1655
|
+
"/api/v1/orders/twap/{twapOrderId}/tca": {
|
|
1656
|
+
parameters: {
|
|
1657
|
+
query?: never;
|
|
1658
|
+
header?: never;
|
|
1659
|
+
path?: never;
|
|
1660
|
+
cookie?: never;
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* Get TWAP order TCA report
|
|
1664
|
+
* @description Get TWAP execution quality (TCA) report.
|
|
1665
|
+
*
|
|
1666
|
+
* Post-execution transaction cost analysis for a TERMINAL (COMPLETED or
|
|
1667
|
+
* CANCELLED) TWAP parent: the realized average price measured against the
|
|
1668
|
+
* arrival price and the interval-TWAP benchmark over the parent's ACTIVE
|
|
1669
|
+
* window (start to terminal time). Benchmark inputs are computed once by
|
|
1670
|
+
* the persistor when the terminal row is projected, from per-minute mark
|
|
1671
|
+
* history where the pair is marked, falling back to 1m candle closes;
|
|
1672
|
+
* when neither series covers the window sufficiently the benchmark fields
|
|
1673
|
+
* are null rather than approximate. Sign convention: positive bps means
|
|
1674
|
+
* execution BEAT the reference. Users can only access their own TWAP
|
|
1675
|
+
* orders; a non-terminal parent is a 400.
|
|
1676
|
+
*/
|
|
1677
|
+
get: operations["get_twap_order_tca"];
|
|
1678
|
+
put?: never;
|
|
1679
|
+
post?: never;
|
|
1680
|
+
delete?: never;
|
|
1681
|
+
options?: never;
|
|
1682
|
+
head?: never;
|
|
1683
|
+
patch?: never;
|
|
1684
|
+
trace?: never;
|
|
1685
|
+
};
|
|
1655
1686
|
"/api/v1/orders/{orderId}": {
|
|
1656
1687
|
parameters: {
|
|
1657
1688
|
query?: never;
|
|
@@ -4775,6 +4806,19 @@ export interface components {
|
|
|
4775
4806
|
* executions do not account for its whole lifetime.
|
|
4776
4807
|
*/
|
|
4777
4808
|
feesPaid?: string | null;
|
|
4809
|
+
/**
|
|
4810
|
+
* @description Total lifetime trading fees for the position: opening-fill fees (from the
|
|
4811
|
+
* PnL cost-basis engine) plus every reducing execution's fees — decreases,
|
|
4812
|
+
* close, and any liquidation penalty. Signed; negative means net rebated,
|
|
4813
|
+
* inclusive of the application-fee component. Unlike the closing-side
|
|
4814
|
+
* reducing-execution fee field above, which omits opening fills, this is the
|
|
4815
|
+
* whole-life figure, on open and terminal rows alike.
|
|
4816
|
+
* Null when the opening-fill fees are unavailable — before the position's
|
|
4817
|
+
* first PnL sample flushes, after its samples age out of PnL retention, or
|
|
4818
|
+
* for positions predating the PnL service — rather than an understated
|
|
4819
|
+
* partial.
|
|
4820
|
+
*/
|
|
4821
|
+
cumFees?: string | null;
|
|
4778
4822
|
};
|
|
4779
4823
|
GetPositionRiskResponse: {
|
|
4780
4824
|
positionId?: string | null;
|
|
@@ -4971,6 +5015,83 @@ export interface components {
|
|
|
4971
5015
|
GetTradingPairResponse: {
|
|
4972
5016
|
tradingPair?: components["schemas"]["TradingPairData"];
|
|
4973
5017
|
};
|
|
5018
|
+
GetTwapOrderTcaResponse: {
|
|
5019
|
+
/**
|
|
5020
|
+
* Format: uuid
|
|
5021
|
+
* @description TWAP parent order UUID
|
|
5022
|
+
*/
|
|
5023
|
+
twapOrderId?: string | null;
|
|
5024
|
+
/**
|
|
5025
|
+
* @description Terminal state the report covers: COMPLETED or CANCELLED
|
|
5026
|
+
* @example COMPLETED
|
|
5027
|
+
*/
|
|
5028
|
+
state?: string | null;
|
|
5029
|
+
/**
|
|
5030
|
+
* @description Parent side: BUY or SELL (fixes the sign convention)
|
|
5031
|
+
* @example BUY
|
|
5032
|
+
*/
|
|
5033
|
+
side?: string | null;
|
|
5034
|
+
/**
|
|
5035
|
+
* @description Active-window start (UTC, RFC 3339) — the measurement window's left edge
|
|
5036
|
+
* @example 2026-08-25T10:00:00Z
|
|
5037
|
+
*/
|
|
5038
|
+
windowStartAt?: string | null;
|
|
5039
|
+
/**
|
|
5040
|
+
* @description Terminal time (completion or cancellation; UTC) — the measurement window's right edge. Never the planned end: a cancelled parent stopped trading here.
|
|
5041
|
+
* @example 2026-08-25T11:00:00Z
|
|
5042
|
+
*/
|
|
5043
|
+
windowTerminalAt?: string | null;
|
|
5044
|
+
/**
|
|
5045
|
+
* @description Quantity filled over the window, as decimal string
|
|
5046
|
+
* @example 118.4
|
|
5047
|
+
*/
|
|
5048
|
+
executedQuantity?: string | null;
|
|
5049
|
+
/**
|
|
5050
|
+
* @description Unfilled remainder (totalQuantity - executedQuantity, floored at zero)
|
|
5051
|
+
* @example 1.6
|
|
5052
|
+
*/
|
|
5053
|
+
shortfallQuantity?: string | null;
|
|
5054
|
+
/**
|
|
5055
|
+
* @description Volume-weighted realized price (executedNotional / executedQuantity), GROSS of fees — the price the fills traded at, not the net cost after taker fees or maker rebates. Compared against price benchmarks, so fees are deliberately excluded. Null when nothing executed.
|
|
5056
|
+
* @example 2001.35
|
|
5057
|
+
*/
|
|
5058
|
+
realizedAvgPrice?: string | null;
|
|
5059
|
+
/**
|
|
5060
|
+
* @description Reference price at (or immediately before) the window start, from benchmarkSource. Null when price history could not cover the window.
|
|
5061
|
+
* @example 2000.00
|
|
5062
|
+
*/
|
|
5063
|
+
arrivalPrice?: string | null;
|
|
5064
|
+
/**
|
|
5065
|
+
* @description Average reference price over the active window, from benchmarkSource. Null when price history could not cover the window.
|
|
5066
|
+
* @example 2002.10
|
|
5067
|
+
*/
|
|
5068
|
+
benchmarkTwapPrice?: string | null;
|
|
5069
|
+
/**
|
|
5070
|
+
* @description Price series both benchmark values came from: risk_mark_1m (marked pairs) or ohlcv_1m_close (spot fallback). Null when no series qualified.
|
|
5071
|
+
* @example risk_mark_1m
|
|
5072
|
+
*/
|
|
5073
|
+
benchmarkSource?: string | null;
|
|
5074
|
+
/**
|
|
5075
|
+
* @description Signed basis points vs the arrival price; POSITIVE means execution beat it (BUY: bought below arrival; SELL: sold above). Null when realized or arrival is null.
|
|
5076
|
+
* @example -6.75
|
|
5077
|
+
*/
|
|
5078
|
+
slippageVsArrivalBps?: string | null;
|
|
5079
|
+
/**
|
|
5080
|
+
* @description Signed basis points vs the window-TWAP benchmark; POSITIVE means execution beat the benchmark. Null when realized or benchmark is null.
|
|
5081
|
+
* @example 3.75
|
|
5082
|
+
*/
|
|
5083
|
+
performanceVsBenchmarkBps?: string | null;
|
|
5084
|
+
/**
|
|
5085
|
+
* Format: uuid
|
|
5086
|
+
* @description Trading pair the parent executed on. Present so a report is self-describing: prices and bps are meaningless without the instrument, and a dashboard should not need a second lookup to label them.
|
|
5087
|
+
*/
|
|
5088
|
+
tradingPairId?: string | null;
|
|
5089
|
+
/**
|
|
5090
|
+
* @description Parent order quantity, as decimal string. With executedQuantity and shortfallQuantity this closes the fill-rate arithmetic without a second lookup.
|
|
5091
|
+
* @example 120
|
|
5092
|
+
*/
|
|
5093
|
+
totalQuantity?: string | null;
|
|
5094
|
+
};
|
|
4974
5095
|
GetUserTradesResponse: {
|
|
4975
5096
|
trades?: components["schemas"]["UserTrade"][] | null;
|
|
4976
5097
|
/**
|
|
@@ -6075,6 +6196,19 @@ export interface components {
|
|
|
6075
6196
|
* executions do not account for its whole lifetime.
|
|
6076
6197
|
*/
|
|
6077
6198
|
feesPaid?: string | null;
|
|
6199
|
+
/**
|
|
6200
|
+
* @description Total lifetime trading fees for the position: opening-fill fees (from the
|
|
6201
|
+
* PnL cost-basis engine) plus every reducing execution's fees — decreases,
|
|
6202
|
+
* close, and any liquidation penalty. Signed; negative means net rebated,
|
|
6203
|
+
* inclusive of the application-fee component. Unlike the closing-side
|
|
6204
|
+
* reducing-execution fee field above, which omits opening fills, this is the
|
|
6205
|
+
* whole-life figure, on open and terminal rows alike.
|
|
6206
|
+
* Null when the opening-fill fees are unavailable — before the position's
|
|
6207
|
+
* first PnL sample flushes, after its samples age out of PnL retention, or
|
|
6208
|
+
* for positions predating the PnL service — rather than an understated
|
|
6209
|
+
* partial.
|
|
6210
|
+
*/
|
|
6211
|
+
cumFees?: string | null;
|
|
6078
6212
|
};
|
|
6079
6213
|
PositionHistoryEvent: {
|
|
6080
6214
|
id?: string | null;
|
|
@@ -11004,6 +11138,56 @@ export interface operations {
|
|
|
11004
11138
|
};
|
|
11005
11139
|
};
|
|
11006
11140
|
};
|
|
11141
|
+
get_twap_order_tca: {
|
|
11142
|
+
parameters: {
|
|
11143
|
+
query?: never;
|
|
11144
|
+
header?: never;
|
|
11145
|
+
path: {
|
|
11146
|
+
twapOrderId: string;
|
|
11147
|
+
};
|
|
11148
|
+
cookie?: never;
|
|
11149
|
+
};
|
|
11150
|
+
requestBody?: never;
|
|
11151
|
+
responses: {
|
|
11152
|
+
/** @description OK */
|
|
11153
|
+
200: {
|
|
11154
|
+
headers: {
|
|
11155
|
+
[name: string]: unknown;
|
|
11156
|
+
};
|
|
11157
|
+
content: {
|
|
11158
|
+
"application/json": components["schemas"]["GetTwapOrderTcaResponse"];
|
|
11159
|
+
};
|
|
11160
|
+
};
|
|
11161
|
+
/** @description Invalid TWAP order ID format, or the order has not reached a terminal state yet */
|
|
11162
|
+
400: {
|
|
11163
|
+
headers: {
|
|
11164
|
+
[name: string]: unknown;
|
|
11165
|
+
};
|
|
11166
|
+
content?: never;
|
|
11167
|
+
};
|
|
11168
|
+
/** @description Authentication required or delegated-agent session (rejected for TWAP) */
|
|
11169
|
+
401: {
|
|
11170
|
+
headers: {
|
|
11171
|
+
[name: string]: unknown;
|
|
11172
|
+
};
|
|
11173
|
+
content?: never;
|
|
11174
|
+
};
|
|
11175
|
+
/** @description TWAP order not found */
|
|
11176
|
+
404: {
|
|
11177
|
+
headers: {
|
|
11178
|
+
[name: string]: unknown;
|
|
11179
|
+
};
|
|
11180
|
+
content?: never;
|
|
11181
|
+
};
|
|
11182
|
+
/** @description Internal server error */
|
|
11183
|
+
500: {
|
|
11184
|
+
headers: {
|
|
11185
|
+
[name: string]: unknown;
|
|
11186
|
+
};
|
|
11187
|
+
content?: never;
|
|
11188
|
+
};
|
|
11189
|
+
};
|
|
11190
|
+
};
|
|
11007
11191
|
get_order_by_id: {
|
|
11008
11192
|
parameters: {
|
|
11009
11193
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lint": "biome lint ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@0xmonaco/contracts": "1.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.46",
|
|
20
20
|
"zod": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|