@0xmonaco/types 0.7.5 → 0.7.7
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/package.json +2 -2
- package/dist/api/index.d.ts +0 -18
- package/dist/api/index.js +0 -6
- package/dist/applications/index.d.ts +0 -23
- package/dist/applications/index.js +0 -5
- package/dist/applications/responses.d.ts +0 -22
- package/dist/applications/responses.js +0 -5
- package/dist/auth/index.d.ts +0 -81
- package/dist/auth/index.js +0 -6
- package/dist/auth/responses.d.ts +0 -67
- package/dist/auth/responses.js +0 -5
- package/dist/contracts/balances.d.ts +0 -43
- package/dist/contracts/balances.js +0 -5
- package/dist/contracts/index.d.ts +0 -27
- package/dist/contracts/index.js +0 -5
- package/dist/fees/index.d.ts +0 -39
- package/dist/fees/index.js +0 -6
- package/dist/fees/responses.d.ts +0 -54
- package/dist/fees/responses.js +0 -86
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -21
- package/dist/margin-accounts/index.d.ts +0 -110
- package/dist/margin-accounts/index.js +0 -0
- package/dist/market/index.d.ts +0 -312
- package/dist/market/index.js +0 -5
- package/dist/positions/index.d.ts +0 -128
- package/dist/positions/index.js +0 -0
- package/dist/profile/index.d.ts +0 -405
- package/dist/profile/index.js +0 -5
- package/dist/sdk/index.d.ts +0 -131
- package/dist/sdk/index.js +0 -0
- package/dist/sdk/network.d.ts +0 -25
- package/dist/sdk/network.js +0 -5
- package/dist/trading/index.d.ts +0 -132
- package/dist/trading/index.js +0 -6
- package/dist/trading/orders.d.ts +0 -137
- package/dist/trading/orders.js +0 -9
- package/dist/trading/responses.d.ts +0 -347
- package/dist/trading/responses.js +0 -5
- package/dist/validation/common.d.ts +0 -179
- package/dist/validation/common.js +0 -199
- package/dist/validation/index.d.ts +0 -22
- package/dist/validation/index.js +0 -24
- package/dist/validation/margin-accounts.d.ts +0 -55
- package/dist/validation/margin-accounts.js +0 -59
- package/dist/validation/market.d.ts +0 -214
- package/dist/validation/market.js +0 -225
- package/dist/validation/positions.d.ts +0 -89
- package/dist/validation/positions.js +0 -93
- package/dist/validation/profile.d.ts +0 -69
- package/dist/validation/profile.js +0 -44
- package/dist/validation/trading.d.ts +0 -350
- package/dist/validation/trading.js +0 -313
- package/dist/validation/vault.d.ts +0 -66
- package/dist/validation/vault.js +0 -79
- package/dist/vault/index.d.ts +0 -84
- package/dist/vault/index.js +0 -5
- package/dist/vault/responses.d.ts +0 -51
- package/dist/vault/responses.js +0 -5
- package/dist/websocket/base.d.ts +0 -31
- package/dist/websocket/base.js +0 -5
- package/dist/websocket/clients/orderbook-client.d.ts +0 -14
- package/dist/websocket/clients/orderbook-client.js +0 -3
- package/dist/websocket/events/balance-events.d.ts +0 -48
- package/dist/websocket/events/balance-events.js +0 -6
- package/dist/websocket/events/conditional-order-events.d.ts +0 -33
- package/dist/websocket/events/conditional-order-events.js +0 -0
- package/dist/websocket/events/index.d.ts +0 -7
- package/dist/websocket/events/index.js +0 -7
- package/dist/websocket/events/movement-events.d.ts +0 -64
- package/dist/websocket/events/movement-events.js +0 -6
- package/dist/websocket/events/ohlcv-events.d.ts +0 -31
- package/dist/websocket/events/ohlcv-events.js +0 -5
- package/dist/websocket/events/orderbook-events.d.ts +0 -72
- package/dist/websocket/events/orderbook-events.js +0 -5
- package/dist/websocket/events/orders-events.d.ts +0 -284
- package/dist/websocket/events/orders-events.js +0 -0
- package/dist/websocket/events/trade-events.d.ts +0 -34
- package/dist/websocket/events/trade-events.js +0 -5
- package/dist/websocket/index.d.ts +0 -8
- package/dist/websocket/index.js +0 -8
package/dist/trading/index.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trading Types
|
|
3
|
-
*
|
|
4
|
-
* Types for trading operations including order placement and management.
|
|
5
|
-
*/
|
|
6
|
-
import type { BaseAPI } from "../api/index";
|
|
7
|
-
import type { OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
-
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateConditionalOrderParams, CreateConditionalOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ReplaceOrderResponse } from "./responses";
|
|
9
|
-
/**
|
|
10
|
-
* Trading API interface.
|
|
11
|
-
* Provides methods for placing and managing orders.
|
|
12
|
-
* Handles order placement, cancellation, and execution.
|
|
13
|
-
*/
|
|
14
|
-
export interface TradingAPI extends BaseAPI {
|
|
15
|
-
/**
|
|
16
|
-
* Places a limit order on the order book.
|
|
17
|
-
* @param tradingPairId - Trading pair UUID
|
|
18
|
-
* @param side - Order side ("BUY" or "SELL")
|
|
19
|
-
* @param quantity - Order quantity as string
|
|
20
|
-
* @param price - Order price as string
|
|
21
|
-
* @param options - Optional parameters for the limit order
|
|
22
|
-
* @param options.tradingMode - Trading mode (e.g., "SPOT")
|
|
23
|
-
* @param options.timeInForce - Time in force ("GTC", "IOC", or "FOK")
|
|
24
|
-
* @returns Promise resolving to the order result
|
|
25
|
-
*/
|
|
26
|
-
placeLimitOrder(tradingPairId: string, side: OrderSide, quantity: string, price: string, options?: {
|
|
27
|
-
tradingMode?: TradingMode;
|
|
28
|
-
useMasterBalance?: boolean;
|
|
29
|
-
expirationDate?: string;
|
|
30
|
-
timeInForce?: TimeInForce;
|
|
31
|
-
marginAccountId?: string;
|
|
32
|
-
positionSide?: PositionSide;
|
|
33
|
-
leverage?: string;
|
|
34
|
-
reduceOnly?: boolean;
|
|
35
|
-
}): Promise<CreateOrderResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Places a market order for immediate execution.
|
|
38
|
-
* @param tradingPairId - Trading pair UUID
|
|
39
|
-
* @param side - Order side ("BUY" or "SELL")
|
|
40
|
-
* @param quantity - Order quantity as string
|
|
41
|
-
* @param options - Optional parameters for the market order
|
|
42
|
-
* @param options.tradingMode - Trading mode (e.g., "SPOT")
|
|
43
|
-
* @param options.slippageTolerance - Slippage tolerance as decimal (e.g., 0.01 for 1%, 0 for best price only, undefined for unlimited slippage)
|
|
44
|
-
* @returns Promise resolving to the order result
|
|
45
|
-
*/
|
|
46
|
-
placeMarketOrder(tradingPairId: string, side: OrderSide, quantity: string, options?: {
|
|
47
|
-
tradingMode?: TradingMode;
|
|
48
|
-
slippageTolerance?: number;
|
|
49
|
-
marginAccountId?: string;
|
|
50
|
-
positionSide?: PositionSide;
|
|
51
|
-
leverage?: string;
|
|
52
|
-
reduceOnly?: boolean;
|
|
53
|
-
}): Promise<CreateOrderResponse>;
|
|
54
|
-
/**
|
|
55
|
-
* Cancels an existing order.
|
|
56
|
-
* @param orderId - ID of the order to cancel
|
|
57
|
-
* @returns Promise resolving to the cancellation result
|
|
58
|
-
*/
|
|
59
|
-
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a standalone conditional TP/SL order.
|
|
62
|
-
*/
|
|
63
|
-
createConditionalOrder(params: CreateConditionalOrderParams): Promise<CreateConditionalOrderResponse>;
|
|
64
|
-
/**
|
|
65
|
-
* Cancels an active conditional TP/SL order.
|
|
66
|
-
*/
|
|
67
|
-
cancelConditionalOrder(conditionalOrderId: string): Promise<CancelConditionalOrderResponse>;
|
|
68
|
-
/**
|
|
69
|
-
* Lists conditional TP/SL orders for the authenticated user.
|
|
70
|
-
*/
|
|
71
|
-
listConditionalOrders(params?: ListConditionalOrdersParams): Promise<ListConditionalOrdersResponse>;
|
|
72
|
-
/**
|
|
73
|
-
* Batch cancels specific orders by their IDs.
|
|
74
|
-
* @param orderIds - Array of order IDs to cancel
|
|
75
|
-
* @returns Promise resolving to the batch cancellation result
|
|
76
|
-
*/
|
|
77
|
-
batchCancel(orderIds: string[]): Promise<BatchCancelOrdersResponse>;
|
|
78
|
-
/**
|
|
79
|
-
* Cancels all active orders, optionally filtered by trading pair.
|
|
80
|
-
* @param tradingPairId - Optional trading pair ID to filter cancellation
|
|
81
|
-
* @returns Promise resolving to the batch cancellation result
|
|
82
|
-
*/
|
|
83
|
-
batchCancelAll(tradingPairId?: string): Promise<BatchCancelOrdersResponse>;
|
|
84
|
-
/**
|
|
85
|
-
* Replaces an existing order with new parameters.
|
|
86
|
-
* Updates the order with new price, quantity, and balance settings.
|
|
87
|
-
* @param orderId - ID of the order to replace
|
|
88
|
-
* @param newOrder - New order parameters
|
|
89
|
-
* @param newOrder.price - New order price as string (optional)
|
|
90
|
-
* @param newOrder.quantity - New order quantity as string
|
|
91
|
-
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
92
|
-
* @returns Promise resolving to a `ReplaceOrderResponse`
|
|
93
|
-
*/
|
|
94
|
-
replaceOrder(orderId: string, newOrder: {
|
|
95
|
-
price?: string;
|
|
96
|
-
quantity?: string;
|
|
97
|
-
useMasterBalance?: boolean;
|
|
98
|
-
}): Promise<ReplaceOrderResponse>;
|
|
99
|
-
/**
|
|
100
|
-
* Batch creates multiple orders in a single request.
|
|
101
|
-
* Each order is validated and processed through the matching engine.
|
|
102
|
-
* @param orders - Array of order parameters to create
|
|
103
|
-
* @returns Promise resolving to the batch creation result
|
|
104
|
-
*/
|
|
105
|
-
batchCreate(orders: BatchCreateOrderParams[]): Promise<BatchCreateOrdersResponse>;
|
|
106
|
-
/**
|
|
107
|
-
* Batch replaces multiple orders in a single request.
|
|
108
|
-
* Each order is canceled and re-created with new parameters.
|
|
109
|
-
* @param orders - Array of order replacement parameters
|
|
110
|
-
* @returns Promise resolving to the batch replacement result
|
|
111
|
-
*/
|
|
112
|
-
batchReplace(orders: BatchReplaceOrderParams[]): Promise<BatchReplaceOrdersResponse>;
|
|
113
|
-
/**
|
|
114
|
-
* Gets paginated orders based on query parameters.
|
|
115
|
-
* @param params - Query parameters for filtering orders
|
|
116
|
-
* @param params.status - Filter by order status (optional)
|
|
117
|
-
* @param params.trading_pair_id - Filter by trading pair UUID (optional)
|
|
118
|
-
* @param params.page - Page number for pagination (optional)
|
|
119
|
-
* @param params.page_size - Number of orders per page (optional)
|
|
120
|
-
* @returns Promise resolving to the paginated orders result
|
|
121
|
-
*/
|
|
122
|
-
getPaginatedOrders(params?: GetPaginatedOrdersParams): Promise<GetPaginatedOrdersResponse>;
|
|
123
|
-
/**
|
|
124
|
-
* Gets a single order by its ID.
|
|
125
|
-
* @param orderId - ID of the order to retrieve
|
|
126
|
-
* @returns Promise resolving to the order details
|
|
127
|
-
*/
|
|
128
|
-
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
129
|
-
}
|
|
130
|
-
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
131
|
-
export { ORDER_STATUS_VALUES } from "./orders";
|
|
132
|
-
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateConditionalOrderParams, CreateConditionalOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, MatchResult, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|
package/dist/trading/index.js
DELETED
package/dist/trading/orders.d.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trading Order Types
|
|
3
|
-
*
|
|
4
|
-
* Types for trading operations and order management.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Standard order structure used across all order-related responses.
|
|
8
|
-
* This represents the complete order information as returned by the API.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Order lifecycle statuses: `SUBMITTED` → (`PARTIALLY_FILLED`) → `FILLED` → `SETTLED_ON_CHAIN`
|
|
12
|
-
* Legacy backends may still emit `SETTLED`.
|
|
13
|
-
* Orders can transition to `CANCELLED`, `REJECTED`, or `EXPIRED` at various stages.
|
|
14
|
-
* Fee fields are only populated after order fills occur.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* To calculate remaining quantity:
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const remaining = parseFloat(order.quantity) - parseFloat(order.filled_quantity);
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export interface Order {
|
|
23
|
-
/** Order identifier (UUID) */
|
|
24
|
-
id: string;
|
|
25
|
-
/** Trading pair ID (UUID format, e.g., "456e7890-e12b-12d3-a456-426614174000") */
|
|
26
|
-
trading_pair_id: string;
|
|
27
|
-
/** Order side (BUY or SELL) */
|
|
28
|
-
side: OrderSide;
|
|
29
|
-
/** Order type - see OrderType for all supported types */
|
|
30
|
-
order_type: OrderType;
|
|
31
|
-
/** Order status - see OrderStatus for lifecycle details */
|
|
32
|
-
status: OrderStatus;
|
|
33
|
-
/** Order price - null for market orders, required for limit orders */
|
|
34
|
-
price?: string;
|
|
35
|
-
/** Order quantity (base currency amount) */
|
|
36
|
-
quantity: string;
|
|
37
|
-
/** Filled quantity (base currency amount, "0" if unfilled) */
|
|
38
|
-
filled_quantity: string;
|
|
39
|
-
/** Average fill price - only populated after order has fills */
|
|
40
|
-
average_fill_price?: string;
|
|
41
|
-
/** Trading mode (SPOT or MARGIN) */
|
|
42
|
-
trading_mode: TradingMode;
|
|
43
|
-
/** Time in force - GTC, IOC, FOK, or GTD */
|
|
44
|
-
time_in_force?: TimeInForce;
|
|
45
|
-
/** Order creation timestamp (ISO 8601) */
|
|
46
|
-
created_at: string;
|
|
47
|
-
/** Order last update timestamp (ISO 8601) */
|
|
48
|
-
updated_at?: string;
|
|
49
|
-
/** Optional expiration date for GTD orders (ISO 8601, max 1 year) */
|
|
50
|
-
expiration_date?: string;
|
|
51
|
-
/** Application taker fee in basis points (e.g., "100" = 1%) - populated after fills */
|
|
52
|
-
application_taker_fee?: string;
|
|
53
|
-
/** Monaco protocol taker fee in basis points - populated after fills */
|
|
54
|
-
monaco_taker_fee?: string;
|
|
55
|
-
/** Monaco protocol maker rebate in basis points - populated after fills */
|
|
56
|
-
monaco_maker_rebate?: string;
|
|
57
|
-
/** Total taker fees paid in quote currency - populated after fills */
|
|
58
|
-
total_taker_fees?: string;
|
|
59
|
-
/** Total payment for taker including fees in quote currency - populated after fills */
|
|
60
|
-
taker_total_payment?: string;
|
|
61
|
-
/** Total receipt for maker after rebates in quote currency - populated after fills */
|
|
62
|
-
maker_total_receipt?: string;
|
|
63
|
-
/** Margin account ID for margin/perp orders */
|
|
64
|
-
margin_account_id?: string;
|
|
65
|
-
/** Position side for margin/perp orders */
|
|
66
|
-
position_side?: PositionSide;
|
|
67
|
-
/** Leverage used for margin/perp orders */
|
|
68
|
-
leverage?: string;
|
|
69
|
-
/** Whether the order can only reduce existing exposure */
|
|
70
|
-
reduce_only?: boolean;
|
|
71
|
-
/** Position ID linked to the order, when available */
|
|
72
|
-
position_id?: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Role of the creator or order
|
|
76
|
-
*/
|
|
77
|
-
export type OrderRole = "maker" | "taker";
|
|
78
|
-
/**
|
|
79
|
-
* Order side for trading operations
|
|
80
|
-
*/
|
|
81
|
-
export type OrderSide = "BUY" | "SELL";
|
|
82
|
-
/**
|
|
83
|
-
* Position side for margin/perp trading
|
|
84
|
-
*/
|
|
85
|
-
export type PositionSide = "LONG" | "SHORT" | "NONE";
|
|
86
|
-
/**
|
|
87
|
-
* Order type for different order strategies
|
|
88
|
-
* - LIMIT: Execute only at specified price or better
|
|
89
|
-
* - MARKET: Execute immediately at current market price
|
|
90
|
-
* - STOP_LOSS: Stop loss order triggered at trigger price
|
|
91
|
-
* - TAKE_PROFIT: Take profit order triggered at trigger price
|
|
92
|
-
* - STOP_LIMIT: Stop order that becomes a limit order when triggered
|
|
93
|
-
* - TRAILING_STOP: Stop order that trails the market price
|
|
94
|
-
*/
|
|
95
|
-
export type OrderType = "LIMIT" | "MARKET";
|
|
96
|
-
/**
|
|
97
|
-
* Source-of-truth order status values used by runtime validation schemas.
|
|
98
|
-
*/
|
|
99
|
-
export declare const ORDER_STATUS_VALUES: readonly ["SUBMITTED", "PARTIALLY_FILLED", "FILLED", "SETTLED_ON_CHAIN", "SETTLED", "CANCELLED", "REJECTED", "EXPIRED"];
|
|
100
|
-
/**
|
|
101
|
-
* Order status for different order states
|
|
102
|
-
*
|
|
103
|
-
* Order lifecycle progression:
|
|
104
|
-
* - SUBMITTED: Order submitted to the matching engine for processing
|
|
105
|
-
* - PARTIALLY_FILLED: Order has been partially executed
|
|
106
|
-
* - FILLED: Order has been completely executed (pre-commit)
|
|
107
|
-
* - SETTLED_ON_CHAIN: Order settlement has been finalized on-chain
|
|
108
|
-
* - SETTLED: Legacy settled status from older backend versions
|
|
109
|
-
* - CANCELLED: Order was canceled by user or system
|
|
110
|
-
* - REJECTED: Order was rejected due to validation failure
|
|
111
|
-
* - EXPIRED: Order expired based on time constraints
|
|
112
|
-
*/
|
|
113
|
-
export type OrderStatus = (typeof ORDER_STATUS_VALUES)[number];
|
|
114
|
-
/**
|
|
115
|
-
* Trading mode
|
|
116
|
-
*/
|
|
117
|
-
export type TradingMode = "SPOT" | "MARGIN";
|
|
118
|
-
/**
|
|
119
|
-
* Time in force for order execution
|
|
120
|
-
* - GTC: Good Till Cancel - remains active until filled or canceled
|
|
121
|
-
* - IOC: Immediate or Cancel - execute immediately and cancel unfilled portion
|
|
122
|
-
* - FOK: Fill or Kill - execute completely or cancel entirely
|
|
123
|
-
* - GTD: Good Till Date - remains active until specified expiration date
|
|
124
|
-
*/
|
|
125
|
-
export type TimeInForce = "GTC" | "IOC" | "FOK" | "GTD";
|
|
126
|
-
/**
|
|
127
|
-
* Conditional TP/SL condition type.
|
|
128
|
-
*/
|
|
129
|
-
export type ConditionalOrderConditionType = "STOP_LOSS" | "TAKE_PROFIT";
|
|
130
|
-
/**
|
|
131
|
-
* Conditional order trigger source. v1 supports mark-price triggers.
|
|
132
|
-
*/
|
|
133
|
-
export type ConditionalOrderTriggerSource = "MARK_PRICE";
|
|
134
|
-
/**
|
|
135
|
-
* Conditional TP/SL lifecycle state.
|
|
136
|
-
*/
|
|
137
|
-
export type ConditionalOrderState = "ACTIVE" | "TRIGGERING" | "TRIGGERED" | "CANCELLED" | "EXPIRED" | "FAILED";
|
package/dist/trading/orders.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trading Order Types
|
|
3
|
-
*
|
|
4
|
-
* Types for trading operations and order management.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Source-of-truth order status values used by runtime validation schemas.
|
|
8
|
-
*/
|
|
9
|
-
export const ORDER_STATUS_VALUES = ["SUBMITTED", "PARTIALLY_FILLED", "FILLED", "SETTLED_ON_CHAIN", "SETTLED", "CANCELLED", "REJECTED", "EXPIRED"];
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trading Response Types
|
|
3
|
-
*
|
|
4
|
-
* Response types for trading operations.
|
|
5
|
-
*/
|
|
6
|
-
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
7
|
-
/**
|
|
8
|
-
* Match result information for order execution.
|
|
9
|
-
* Contains detailed information about trades, fills, and execution quality.
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* This structure is returned after an order is processed by the matching engine,
|
|
13
|
-
* providing details about how the order was executed, including fills, slippage,
|
|
14
|
-
* and final order status.
|
|
15
|
-
*/
|
|
16
|
-
export interface MatchResult {
|
|
17
|
-
/** Number of trades executed during matching */
|
|
18
|
-
trades_count: number;
|
|
19
|
-
/** Total quantity filled across all trades (in base currency) */
|
|
20
|
-
total_filled: string;
|
|
21
|
-
/** Remaining unfilled quantity after immediate matches (in base currency) */
|
|
22
|
-
remaining_quantity: string;
|
|
23
|
-
/** Average fill price across all trades (null if no fills occurred) */
|
|
24
|
-
average_fill_price: string | null;
|
|
25
|
-
/** Final order status after matching (e.g., FILLED, PARTIALLY_FILLED, etc.) */
|
|
26
|
-
status: OrderStatus;
|
|
27
|
-
/** Actual slippage experienced in basis points (positive = worse price, null if no fills) */
|
|
28
|
-
actual_slippage_bps: number | null;
|
|
29
|
-
/** Maximum slippage allowed when order was submitted in basis points (null if not set) */
|
|
30
|
-
max_slippage_bps: number | null;
|
|
31
|
-
/** Price range across executed trades (null if no fills) */
|
|
32
|
-
execution_price_range: {
|
|
33
|
-
/** Best (most favorable) execution price achieved */
|
|
34
|
-
best_price: string;
|
|
35
|
-
/** Worst (least favorable) execution price achieved */
|
|
36
|
-
worst_price: string;
|
|
37
|
-
} | null;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Response from creating an order.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* Contains the order ID, operation status, and optional match result
|
|
44
|
-
* with details about immediate fills that occurred during order placement.
|
|
45
|
-
*/
|
|
46
|
-
export interface CreateOrderResponse {
|
|
47
|
-
/** Created order identifier (UUID) */
|
|
48
|
-
order_id: string;
|
|
49
|
-
/** Operation status (SUCCESS or FAILED) */
|
|
50
|
-
status: "SUCCESS" | "FAILED";
|
|
51
|
-
/** Operation message describing the result (e.g., "Order processed with 2 trades") */
|
|
52
|
-
message: string;
|
|
53
|
-
/** Match result information if order was processed by matching engine */
|
|
54
|
-
match_result?: MatchResult;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Response from cancelling an order.
|
|
58
|
-
*/
|
|
59
|
-
export interface CancelOrderResponse {
|
|
60
|
-
/** Order identifier */
|
|
61
|
-
order_id: string;
|
|
62
|
-
/** Cancellation status */
|
|
63
|
-
status: "SUCCESS" | "FAILED";
|
|
64
|
-
/** Optional response message */
|
|
65
|
-
message?: string;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Response from replacing an order.
|
|
69
|
-
*/
|
|
70
|
-
export interface ReplaceOrderResponse {
|
|
71
|
-
/** New order identifier (after replacement) */
|
|
72
|
-
order_id: string;
|
|
73
|
-
/** Replace operation status */
|
|
74
|
-
status: "SUCCESS" | "FAILED";
|
|
75
|
-
/** Operation message */
|
|
76
|
-
message: string;
|
|
77
|
-
/** Fields that were updated */
|
|
78
|
-
updated_fields: UpdatedFields;
|
|
79
|
-
/** Original order identifier that was replaced */
|
|
80
|
-
original_order_id?: string;
|
|
81
|
-
/** Match result information for the new order */
|
|
82
|
-
match_result?: MatchResult;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Fields that were updated in the replace operation
|
|
86
|
-
*/
|
|
87
|
-
export interface UpdatedFields {
|
|
88
|
-
/** Updated price (if changed) */
|
|
89
|
-
price?: string;
|
|
90
|
-
/** Updated quantity (if changed) */
|
|
91
|
-
quantity?: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Query parameters for getting paginated orders
|
|
95
|
-
*/
|
|
96
|
-
export interface GetPaginatedOrdersParams {
|
|
97
|
-
/** Filter by order status */
|
|
98
|
-
status?: OrderStatus;
|
|
99
|
-
/** Filter by trading pair UUID */
|
|
100
|
-
trading_pair_id?: string;
|
|
101
|
-
/** Filter by trading mode */
|
|
102
|
-
trading_mode?: TradingMode;
|
|
103
|
-
/** Filter by margin account UUID */
|
|
104
|
-
margin_account_id?: string;
|
|
105
|
-
/** Page number for pagination (default: 1) */
|
|
106
|
-
page?: number;
|
|
107
|
-
/** Number of orders per page (default: 10, max: 100) */
|
|
108
|
-
page_size?: number;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Response from getting paginated orders
|
|
112
|
-
*/
|
|
113
|
-
export interface GetPaginatedOrdersResponse {
|
|
114
|
-
/** Latest orders from Redis cache (real-time, instant updates).
|
|
115
|
-
* These are the most recently created/updated orders that may not yet be in PostgreSQL.
|
|
116
|
-
* Only populated on page 1.
|
|
117
|
-
*/
|
|
118
|
-
latest_orders?: Order[];
|
|
119
|
-
/** Array of historical orders from PostgreSQL (paginated) */
|
|
120
|
-
orders: Order[];
|
|
121
|
-
/** Total number of orders matching the query */
|
|
122
|
-
total: number;
|
|
123
|
-
/** Current page number */
|
|
124
|
-
page: number;
|
|
125
|
-
/** Number of orders per page */
|
|
126
|
-
page_size: number;
|
|
127
|
-
/** Total number of pages */
|
|
128
|
-
total_pages: number;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Response from getting a single order by ID
|
|
132
|
-
*/
|
|
133
|
-
export interface GetOrderResponse {
|
|
134
|
-
/** Order data */
|
|
135
|
-
order: Order;
|
|
136
|
-
/** Request status */
|
|
137
|
-
status: "SUCCESS" | "FAILED";
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Error details for a failed batch cancel operation on a single order
|
|
141
|
-
*/
|
|
142
|
-
export interface BatchCancelError {
|
|
143
|
-
/** Error code */
|
|
144
|
-
code: string;
|
|
145
|
-
/** Error message */
|
|
146
|
-
message: string;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Result of a batch cancel operation for a single order
|
|
150
|
-
*/
|
|
151
|
-
export interface BatchCancelResult {
|
|
152
|
-
/** Order identifier */
|
|
153
|
-
order_id: string;
|
|
154
|
-
/** Timestamp when the order was canceled (ISO 8601 format) */
|
|
155
|
-
cancelled_at?: string;
|
|
156
|
-
/** Error details if the cancellation failed */
|
|
157
|
-
error?: BatchCancelError;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Response from batch cancelling orders
|
|
161
|
-
*/
|
|
162
|
-
export interface BatchCancelOrdersResponse {
|
|
163
|
-
/** Total number of orders requested to cancel */
|
|
164
|
-
total_requested: number;
|
|
165
|
-
/** Total number of orders successfully canceled */
|
|
166
|
-
total_cancelled: number;
|
|
167
|
-
/** Total number of orders that failed to cancel */
|
|
168
|
-
total_failed: number;
|
|
169
|
-
/** Individual results for each order */
|
|
170
|
-
results: BatchCancelResult[];
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Error details for a failed batch operation on a single order
|
|
174
|
-
*/
|
|
175
|
-
export interface BatchError {
|
|
176
|
-
/** Error code */
|
|
177
|
-
code: string;
|
|
178
|
-
/** Error message */
|
|
179
|
-
message: string;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Result of a batch create operation for a single order
|
|
183
|
-
*/
|
|
184
|
-
export interface BatchCreateResult {
|
|
185
|
-
/** Order identifier (empty string if creation failed before ID assignment) */
|
|
186
|
-
order_id: string;
|
|
187
|
-
/** Match result information if the order was processed */
|
|
188
|
-
match_result?: MatchResult;
|
|
189
|
-
/** Error details if the creation failed */
|
|
190
|
-
error?: BatchError;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Response from batch creating orders
|
|
194
|
-
*/
|
|
195
|
-
export interface BatchCreateOrdersResponse {
|
|
196
|
-
/** Total number of orders requested to create */
|
|
197
|
-
total_requested: number;
|
|
198
|
-
/** Total number of orders successfully created */
|
|
199
|
-
total_succeeded: number;
|
|
200
|
-
/** Total number of orders that failed to create */
|
|
201
|
-
total_failed: number;
|
|
202
|
-
/** Individual results for each order */
|
|
203
|
-
results: BatchCreateResult[];
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Result of a batch replace operation for a single order
|
|
207
|
-
*/
|
|
208
|
-
export interface BatchReplaceResult {
|
|
209
|
-
/** Original order identifier */
|
|
210
|
-
original_order_id: string;
|
|
211
|
-
/** New order identifier (if successful) */
|
|
212
|
-
new_order_id?: string;
|
|
213
|
-
/** Fields that were updated (if successful) */
|
|
214
|
-
updated_fields?: UpdatedFields;
|
|
215
|
-
/** Match result information if the new order was processed */
|
|
216
|
-
match_result?: MatchResult;
|
|
217
|
-
/** Error details if the replacement failed */
|
|
218
|
-
error?: BatchError;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Response from batch replacing orders
|
|
222
|
-
*/
|
|
223
|
-
export interface BatchReplaceOrdersResponse {
|
|
224
|
-
/** Total number of orders requested to replace */
|
|
225
|
-
total_requested: number;
|
|
226
|
-
/** Total number of orders successfully replaced */
|
|
227
|
-
total_succeeded: number;
|
|
228
|
-
/** Total number of orders that failed to replace */
|
|
229
|
-
total_failed: number;
|
|
230
|
-
/** Individual results for each order */
|
|
231
|
-
results: BatchReplaceResult[];
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Parameters for a single order in a batch create request
|
|
235
|
-
*/
|
|
236
|
-
export interface BatchCreateOrderParams {
|
|
237
|
-
/** Trading pair UUID */
|
|
238
|
-
tradingPairId: string;
|
|
239
|
-
/** Order type: "LIMIT" or "MARKET" */
|
|
240
|
-
orderType: OrderType;
|
|
241
|
-
/** Order side: "BUY" or "SELL" */
|
|
242
|
-
side: OrderSide;
|
|
243
|
-
/** Order price (required for LIMIT orders) */
|
|
244
|
-
price?: string;
|
|
245
|
-
/** Order quantity */
|
|
246
|
-
quantity: string;
|
|
247
|
-
/** Trading mode (defaults to "SPOT") */
|
|
248
|
-
tradingMode?: TradingMode;
|
|
249
|
-
/** Maximum slippage for market orders as decimal (e.g., 0.01 for 1%) */
|
|
250
|
-
slippageTolerance?: number;
|
|
251
|
-
/** For sub-accounts: use master's balance */
|
|
252
|
-
useMasterBalance?: boolean;
|
|
253
|
-
/** Custom expiration date for GTC orders (ISO 8601 format) */
|
|
254
|
-
expirationDate?: string;
|
|
255
|
-
/** Time in force: "GTC", "IOC", or "FOK" */
|
|
256
|
-
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
257
|
-
/** Margin account UUID for margin/perp orders */
|
|
258
|
-
marginAccountId?: string;
|
|
259
|
-
/** Position side for margin/perp orders */
|
|
260
|
-
positionSide?: PositionSide;
|
|
261
|
-
/** Leverage for margin/perp orders */
|
|
262
|
-
leverage?: string;
|
|
263
|
-
/** Whether the order can only reduce existing exposure */
|
|
264
|
-
reduceOnly?: boolean;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Parameters for a single order in a batch replace request
|
|
268
|
-
*/
|
|
269
|
-
export interface BatchReplaceOrderParams {
|
|
270
|
-
/** Order ID to replace */
|
|
271
|
-
orderId: string;
|
|
272
|
-
/** New order price (optional) */
|
|
273
|
-
price?: string;
|
|
274
|
-
/** New order quantity (optional) */
|
|
275
|
-
quantity?: string;
|
|
276
|
-
/** For sub-accounts: use master's balance (optional) */
|
|
277
|
-
useMasterBalance?: boolean;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Parameters for creating a standalone conditional TP/SL order.
|
|
281
|
-
*/
|
|
282
|
-
export interface CreateConditionalOrderParams {
|
|
283
|
-
tradingPairId: string;
|
|
284
|
-
marginAccountId: string;
|
|
285
|
-
conditionType: ConditionalOrderConditionType;
|
|
286
|
-
triggerPrice: string;
|
|
287
|
-
triggerSource?: ConditionalOrderTriggerSource;
|
|
288
|
-
side: OrderSide;
|
|
289
|
-
positionSide: Exclude<PositionSide, "NONE">;
|
|
290
|
-
orderType: OrderType;
|
|
291
|
-
limitPrice?: string;
|
|
292
|
-
quantity?: string;
|
|
293
|
-
reduceOnly?: boolean;
|
|
294
|
-
timeInForce?: Extract<TimeInForce, "GTC" | "IOC">;
|
|
295
|
-
slippageToleranceBps?: number;
|
|
296
|
-
expiresAt?: string;
|
|
297
|
-
}
|
|
298
|
-
export interface CreateConditionalOrderResponse {
|
|
299
|
-
conditional_order_id: string;
|
|
300
|
-
status: "SUCCESS" | "FAILED";
|
|
301
|
-
message: string;
|
|
302
|
-
state: ConditionalOrderState;
|
|
303
|
-
}
|
|
304
|
-
export interface CancelConditionalOrderResponse {
|
|
305
|
-
conditional_order_id: string;
|
|
306
|
-
status: "SUCCESS" | "FAILED";
|
|
307
|
-
message: string;
|
|
308
|
-
}
|
|
309
|
-
export interface ListConditionalOrdersParams {
|
|
310
|
-
margin_account_id?: string;
|
|
311
|
-
trading_pair_id?: string;
|
|
312
|
-
state?: ConditionalOrderState;
|
|
313
|
-
page?: number;
|
|
314
|
-
page_size?: number;
|
|
315
|
-
}
|
|
316
|
-
export interface ConditionalOrder {
|
|
317
|
-
conditional_order_id: string;
|
|
318
|
-
trading_pair_id: string;
|
|
319
|
-
margin_account_id: string;
|
|
320
|
-
position_id?: string;
|
|
321
|
-
linked_group_id?: string;
|
|
322
|
-
condition_type: ConditionalOrderConditionType;
|
|
323
|
-
trigger_source: ConditionalOrderTriggerSource;
|
|
324
|
-
trigger_price: string;
|
|
325
|
-
side: OrderSide;
|
|
326
|
-
position_side: PositionSide;
|
|
327
|
-
order_type: OrderType;
|
|
328
|
-
limit_price?: string;
|
|
329
|
-
quantity?: string;
|
|
330
|
-
slippage_tolerance_bps?: number;
|
|
331
|
-
reduce_only: boolean;
|
|
332
|
-
time_in_force?: TimeInForce;
|
|
333
|
-
state: ConditionalOrderState;
|
|
334
|
-
triggered_order_id?: string;
|
|
335
|
-
triggered_at?: string;
|
|
336
|
-
cancelled_at?: string;
|
|
337
|
-
expires_at?: string;
|
|
338
|
-
failure_reason?: string;
|
|
339
|
-
created_at: string;
|
|
340
|
-
updated_at: string;
|
|
341
|
-
}
|
|
342
|
-
export interface ListConditionalOrdersResponse {
|
|
343
|
-
orders: ConditionalOrder[];
|
|
344
|
-
total: number;
|
|
345
|
-
page: number;
|
|
346
|
-
page_size: number;
|
|
347
|
-
}
|