@nadohq/engine-client 0.1.0-alpha.3 → 0.1.0-alpha.30
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/EngineBaseClient.cjs +8 -7
- package/dist/EngineBaseClient.cjs.map +1 -1
- package/dist/EngineBaseClient.d.cts +2 -3
- package/dist/EngineBaseClient.d.ts +2 -3
- package/dist/EngineBaseClient.js +7 -5
- package/dist/EngineBaseClient.js.map +1 -1
- package/dist/EngineClient.d.cts +1 -2
- package/dist/EngineClient.d.ts +1 -2
- package/dist/EngineExecuteBuilder.cjs +25 -50
- package/dist/EngineExecuteBuilder.cjs.map +1 -1
- package/dist/EngineExecuteBuilder.d.cts +6 -17
- package/dist/EngineExecuteBuilder.d.ts +6 -17
- package/dist/EngineExecuteBuilder.js +15 -40
- package/dist/EngineExecuteBuilder.js.map +1 -1
- package/dist/EngineExecuteClient.cjs +5 -9
- package/dist/EngineExecuteClient.cjs.map +1 -1
- package/dist/EngineExecuteClient.d.cts +3 -4
- package/dist/EngineExecuteClient.d.ts +3 -4
- package/dist/EngineExecuteClient.js +5 -9
- package/dist/EngineExecuteClient.js.map +1 -1
- package/dist/EngineQueryClient.cjs +70 -53
- package/dist/EngineQueryClient.cjs.map +1 -1
- package/dist/EngineQueryClient.d.cts +17 -12
- package/dist/EngineQueryClient.d.ts +17 -12
- package/dist/EngineQueryClient.js +50 -31
- package/dist/EngineQueryClient.js.map +1 -1
- package/dist/EngineWebClient.cjs +0 -2
- package/dist/EngineWebClient.cjs.map +1 -1
- package/dist/EngineWebClient.d.cts +1 -2
- package/dist/EngineWebClient.d.ts +1 -2
- package/dist/EngineWebClient.js +0 -2
- package/dist/EngineWebClient.js.map +1 -1
- package/dist/endpoints.cjs +6 -6
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.d.cts +1 -1
- package/dist/endpoints.d.ts +1 -1
- package/dist/endpoints.js +6 -6
- package/dist/endpoints.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/EngineServerFailureError.cjs +1 -1
- package/dist/types/EngineServerFailureError.cjs.map +1 -1
- package/dist/types/EngineServerFailureError.d.cts +2 -2
- package/dist/types/EngineServerFailureError.d.ts +2 -2
- package/dist/types/EngineServerFailureError.js +1 -1
- package/dist/types/EngineServerFailureError.js.map +1 -1
- package/dist/types/clientExecuteTypes.cjs.map +1 -1
- package/dist/types/clientExecuteTypes.d.cts +11 -12
- package/dist/types/clientExecuteTypes.d.ts +11 -12
- package/dist/types/clientQueryTypes.cjs.map +1 -1
- package/dist/types/clientQueryTypes.d.cts +41 -23
- package/dist/types/clientQueryTypes.d.ts +41 -23
- package/dist/types/index.cjs +10 -10
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +8 -9
- package/dist/types/index.d.ts +8 -9
- package/dist/types/index.js +5 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/serverExecuteTypes.cjs.map +1 -1
- package/dist/types/serverExecuteTypes.d.cts +13 -14
- package/dist/types/serverExecuteTypes.d.ts +13 -14
- package/dist/types/serverQueryModelTypes.cjs.map +1 -1
- package/dist/types/serverQueryModelTypes.d.cts +25 -2
- package/dist/types/serverQueryModelTypes.d.ts +25 -2
- package/dist/types/serverQueryTypes.cjs.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +37 -26
- package/dist/types/serverQueryTypes.d.ts +37 -26
- package/dist/types/serverSubscriptionEventTypes.cjs.map +1 -1
- package/dist/types/serverSubscriptionEventTypes.d.cts +87 -23
- package/dist/types/serverSubscriptionEventTypes.d.ts +87 -23
- package/dist/types/serverSubscriptionTypes.cjs.map +1 -1
- package/dist/types/serverSubscriptionTypes.d.cts +21 -4
- package/dist/types/serverSubscriptionTypes.d.ts +21 -4
- package/dist/utils/index.d.cts +3 -4
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/productEngineTypeMappers.cjs +5 -5
- package/dist/utils/productEngineTypeMappers.cjs.map +1 -1
- package/dist/utils/productEngineTypeMappers.d.cts +1 -1
- package/dist/utils/productEngineTypeMappers.d.ts +1 -1
- package/dist/utils/productEngineTypeMappers.js +1 -1
- package/dist/utils/productEngineTypeMappers.js.map +1 -1
- package/dist/utils/queryDataMappers.cjs +113 -90
- package/dist/utils/queryDataMappers.cjs.map +1 -1
- package/dist/utils/queryDataMappers.d.cts +6 -5
- package/dist/utils/queryDataMappers.d.ts +6 -5
- package/dist/utils/queryDataMappers.js +39 -19
- package/dist/utils/queryDataMappers.js.map +1 -1
- package/package.json +3 -4
- package/src/EngineBaseClient.ts +5 -3
- package/src/EngineExecuteBuilder.ts +16 -53
- package/src/EngineExecuteClient.ts +5 -13
- package/src/EngineQueryClient.ts +62 -32
- package/src/EngineWebClient.ts +0 -2
- package/src/endpoints.ts +4 -5
- package/src/index.ts +2 -2
- package/src/types/EngineServerFailureError.ts +2 -2
- package/src/types/clientExecuteTypes.ts +12 -17
- package/src/types/clientQueryTypes.ts +57 -32
- package/src/types/index.ts +5 -5
- package/src/types/serverExecuteTypes.ts +14 -18
- package/src/types/serverQueryModelTypes.ts +26 -1
- package/src/types/serverQueryTypes.ts +46 -29
- package/src/types/serverSubscriptionEventTypes.ts +131 -21
- package/src/types/serverSubscriptionTypes.ts +23 -3
- package/src/utils/productEngineTypeMappers.ts +1 -1
- package/src/utils/queryDataMappers.ts +50 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HealthStatus } from '@nadohq/
|
|
2
|
-
import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerHealthBreakdown } from './serverQueryModelTypes.cjs';
|
|
1
|
+
import { HealthStatus } from '@nadohq/shared';
|
|
2
|
+
import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerHealthBreakdown, EngineServerOrder } from './serverQueryModelTypes.cjs';
|
|
3
3
|
|
|
4
4
|
interface EngineServerNoncesParams {
|
|
5
5
|
address: string;
|
|
@@ -63,6 +63,8 @@ interface EngineServerMaxOrderSizeQueryParams {
|
|
|
63
63
|
direction: 'long' | 'short';
|
|
64
64
|
spot_leverage: string | null;
|
|
65
65
|
reduce_only: string | null;
|
|
66
|
+
isolated: string | null;
|
|
67
|
+
borrow_margin: string | null;
|
|
66
68
|
}
|
|
67
69
|
interface EngineServerLinkedSignerParams {
|
|
68
70
|
subaccount: string;
|
|
@@ -71,6 +73,12 @@ interface EngineServerMaxMintNlpQueryParams {
|
|
|
71
73
|
sender: string;
|
|
72
74
|
spot_leverage: string | null;
|
|
73
75
|
}
|
|
76
|
+
interface EngineServerMaxBurnNlpQueryParams {
|
|
77
|
+
sender: string;
|
|
78
|
+
}
|
|
79
|
+
interface EngineServerNlpLockedBalancesQueryParams {
|
|
80
|
+
subaccount: string;
|
|
81
|
+
}
|
|
74
82
|
interface EngineServerQueryRequestByType {
|
|
75
83
|
all_products: Record<string, never>;
|
|
76
84
|
contracts: Record<string, never>;
|
|
@@ -83,10 +91,12 @@ interface EngineServerQueryRequestByType {
|
|
|
83
91
|
market_liquidity: EngineServerMarketLiquidityQueryParams;
|
|
84
92
|
market_price: EngineServerMarketPriceQueryParams;
|
|
85
93
|
market_prices: EngineServerMarketPricesQueryParams;
|
|
94
|
+
max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
|
|
86
95
|
max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
|
|
87
96
|
max_order_size: EngineServerMaxOrderSizeQueryParams;
|
|
97
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
|
|
98
|
+
nlp_pool_info: Record<string, never>;
|
|
88
99
|
max_withdrawable: EngineServerMaxWithdrawableQueryParams;
|
|
89
|
-
min_deposit_rates: Record<string, never>;
|
|
90
100
|
nonces: EngineServerNoncesParams;
|
|
91
101
|
order: EngineServerGetOrderQueryParams;
|
|
92
102
|
orders: EngineServerOrdersQueryParams;
|
|
@@ -105,7 +115,6 @@ type EngineServerQueryRequest<TRequestType extends EngineServerQueryRequestType>
|
|
|
105
115
|
interface EngineServerContractsResponse {
|
|
106
116
|
chain_id: string;
|
|
107
117
|
endpoint_addr: string;
|
|
108
|
-
book_addrs: string[];
|
|
109
118
|
}
|
|
110
119
|
type EngineServerStatusResponse = 'started' | 'active' | 'stopping' | 'syncing' | 'live_syncing' | 'failed';
|
|
111
120
|
interface EngineServerNoncesResponse {
|
|
@@ -194,6 +203,7 @@ interface EngineServerFeeRatesResponse {
|
|
|
194
203
|
withdraw_sequencer_fees: string[];
|
|
195
204
|
taker_fee_rates_x18: string[];
|
|
196
205
|
maker_fee_rates_x18: string[];
|
|
206
|
+
fee_tier: number;
|
|
197
207
|
}
|
|
198
208
|
interface EngineServerMarketPrice {
|
|
199
209
|
product_id: number;
|
|
@@ -204,19 +214,6 @@ type EngineServerMarketPriceResponse = EngineServerMarketPrice;
|
|
|
204
214
|
interface EngineServerMarketPricesResponse {
|
|
205
215
|
market_prices: EngineServerMarketPrice[];
|
|
206
216
|
}
|
|
207
|
-
interface EngineServerOrder {
|
|
208
|
-
product_id: number;
|
|
209
|
-
sender: string;
|
|
210
|
-
price_x18: string;
|
|
211
|
-
amount: string;
|
|
212
|
-
expiration: string;
|
|
213
|
-
nonce: string;
|
|
214
|
-
unfilled_amount: string;
|
|
215
|
-
digest: string;
|
|
216
|
-
placed_at: number;
|
|
217
|
-
order_type: string;
|
|
218
|
-
margin: string | null;
|
|
219
|
-
}
|
|
220
217
|
type EngineServerOrderResponse = EngineServerOrder;
|
|
221
218
|
interface EngineServerValidateOrderResponse {
|
|
222
219
|
product_id: number;
|
|
@@ -240,19 +237,31 @@ interface EngineServerLinkedSignerResponse {
|
|
|
240
237
|
interface EngineInsuranceResponse {
|
|
241
238
|
insurance: string;
|
|
242
239
|
}
|
|
243
|
-
interface EngineServerMinDepositRate {
|
|
244
|
-
product_id: number;
|
|
245
|
-
min_deposit_rate_x18: string;
|
|
246
|
-
}
|
|
247
|
-
interface EngineServerMinDepositRatesResponse {
|
|
248
|
-
min_deposit_rates: Record<number, EngineServerMinDepositRate>;
|
|
249
|
-
}
|
|
250
240
|
interface EngineServerEdgeAllProductsResponse {
|
|
251
241
|
edge_all_products: Record<number, EngineServerAllProductsResponse>;
|
|
252
242
|
}
|
|
243
|
+
interface EngineServerMaxBurnNlpResponse {
|
|
244
|
+
max_nlp_amount: string;
|
|
245
|
+
}
|
|
253
246
|
interface EngineServerMaxMintNlpResponse {
|
|
254
247
|
max_quote_amount: string;
|
|
255
248
|
}
|
|
249
|
+
interface EngineServerNlpLockedBalancesResponse {
|
|
250
|
+
balance_locked: EngineServerNlpBalance;
|
|
251
|
+
balance_unlocked: EngineServerNlpBalance;
|
|
252
|
+
locked_balances: EngineServerNlpLockedBalance[];
|
|
253
|
+
}
|
|
254
|
+
interface EngineServerNlpPool {
|
|
255
|
+
pool_id: number;
|
|
256
|
+
subaccount: string;
|
|
257
|
+
owner: string;
|
|
258
|
+
balance_weight_x18: string;
|
|
259
|
+
subaccount_info: EngineServerSubaccountInfoResponse;
|
|
260
|
+
open_orders: EngineServerOrder[];
|
|
261
|
+
}
|
|
262
|
+
interface EngineServerNlpPoolInfoResponse {
|
|
263
|
+
nlp_pools: EngineServerNlpPool[];
|
|
264
|
+
}
|
|
256
265
|
interface EngineServerQueryResponseByType {
|
|
257
266
|
all_products: EngineServerAllProductsResponse;
|
|
258
267
|
contracts: EngineServerContractsResponse;
|
|
@@ -265,10 +274,12 @@ interface EngineServerQueryResponseByType {
|
|
|
265
274
|
market_liquidity: EngineServerMarketLiquidityResponse;
|
|
266
275
|
market_price: EngineServerMarketPriceResponse;
|
|
267
276
|
market_prices: EngineServerMarketPricesResponse;
|
|
277
|
+
max_nlp_burnable: EngineServerMaxBurnNlpResponse;
|
|
268
278
|
max_nlp_mintable: EngineServerMaxMintNlpResponse;
|
|
269
279
|
max_order_size: EngineServerMaxOrderSizeResponse;
|
|
280
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
|
|
281
|
+
nlp_pool_info: EngineServerNlpPoolInfoResponse;
|
|
270
282
|
max_withdrawable: EngineServerMaxWithdrawableResponse;
|
|
271
|
-
min_deposit_rates: EngineServerMinDepositRatesResponse;
|
|
272
283
|
nonces: EngineServerNoncesResponse;
|
|
273
284
|
order: EngineServerOrderResponse;
|
|
274
285
|
orders: EngineServerProductOrdersResponse;
|
|
@@ -289,4 +300,4 @@ interface EngineServerQueryFailureResponse {
|
|
|
289
300
|
}
|
|
290
301
|
type EngineServerQueryResponse<TQueryType extends keyof EngineServerQueryResponseByType = EngineServerQueryRequestType> = EngineServerQuerySuccessResponse<TQueryType> | EngineServerQueryFailureResponse;
|
|
291
302
|
|
|
292
|
-
export type { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse,
|
|
303
|
+
export type { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxBurnNlpQueryParams, EngineServerMaxBurnNlpResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNlpLockedBalancesQueryParams, EngineServerNlpLockedBalancesResponse, EngineServerNlpPool, EngineServerNlpPoolInfoResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HealthStatus } from '@nadohq/
|
|
2
|
-
import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerHealthBreakdown } from './serverQueryModelTypes.js';
|
|
1
|
+
import { HealthStatus } from '@nadohq/shared';
|
|
2
|
+
import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerHealthBreakdown, EngineServerOrder } from './serverQueryModelTypes.js';
|
|
3
3
|
|
|
4
4
|
interface EngineServerNoncesParams {
|
|
5
5
|
address: string;
|
|
@@ -63,6 +63,8 @@ interface EngineServerMaxOrderSizeQueryParams {
|
|
|
63
63
|
direction: 'long' | 'short';
|
|
64
64
|
spot_leverage: string | null;
|
|
65
65
|
reduce_only: string | null;
|
|
66
|
+
isolated: string | null;
|
|
67
|
+
borrow_margin: string | null;
|
|
66
68
|
}
|
|
67
69
|
interface EngineServerLinkedSignerParams {
|
|
68
70
|
subaccount: string;
|
|
@@ -71,6 +73,12 @@ interface EngineServerMaxMintNlpQueryParams {
|
|
|
71
73
|
sender: string;
|
|
72
74
|
spot_leverage: string | null;
|
|
73
75
|
}
|
|
76
|
+
interface EngineServerMaxBurnNlpQueryParams {
|
|
77
|
+
sender: string;
|
|
78
|
+
}
|
|
79
|
+
interface EngineServerNlpLockedBalancesQueryParams {
|
|
80
|
+
subaccount: string;
|
|
81
|
+
}
|
|
74
82
|
interface EngineServerQueryRequestByType {
|
|
75
83
|
all_products: Record<string, never>;
|
|
76
84
|
contracts: Record<string, never>;
|
|
@@ -83,10 +91,12 @@ interface EngineServerQueryRequestByType {
|
|
|
83
91
|
market_liquidity: EngineServerMarketLiquidityQueryParams;
|
|
84
92
|
market_price: EngineServerMarketPriceQueryParams;
|
|
85
93
|
market_prices: EngineServerMarketPricesQueryParams;
|
|
94
|
+
max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
|
|
86
95
|
max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
|
|
87
96
|
max_order_size: EngineServerMaxOrderSizeQueryParams;
|
|
97
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
|
|
98
|
+
nlp_pool_info: Record<string, never>;
|
|
88
99
|
max_withdrawable: EngineServerMaxWithdrawableQueryParams;
|
|
89
|
-
min_deposit_rates: Record<string, never>;
|
|
90
100
|
nonces: EngineServerNoncesParams;
|
|
91
101
|
order: EngineServerGetOrderQueryParams;
|
|
92
102
|
orders: EngineServerOrdersQueryParams;
|
|
@@ -105,7 +115,6 @@ type EngineServerQueryRequest<TRequestType extends EngineServerQueryRequestType>
|
|
|
105
115
|
interface EngineServerContractsResponse {
|
|
106
116
|
chain_id: string;
|
|
107
117
|
endpoint_addr: string;
|
|
108
|
-
book_addrs: string[];
|
|
109
118
|
}
|
|
110
119
|
type EngineServerStatusResponse = 'started' | 'active' | 'stopping' | 'syncing' | 'live_syncing' | 'failed';
|
|
111
120
|
interface EngineServerNoncesResponse {
|
|
@@ -194,6 +203,7 @@ interface EngineServerFeeRatesResponse {
|
|
|
194
203
|
withdraw_sequencer_fees: string[];
|
|
195
204
|
taker_fee_rates_x18: string[];
|
|
196
205
|
maker_fee_rates_x18: string[];
|
|
206
|
+
fee_tier: number;
|
|
197
207
|
}
|
|
198
208
|
interface EngineServerMarketPrice {
|
|
199
209
|
product_id: number;
|
|
@@ -204,19 +214,6 @@ type EngineServerMarketPriceResponse = EngineServerMarketPrice;
|
|
|
204
214
|
interface EngineServerMarketPricesResponse {
|
|
205
215
|
market_prices: EngineServerMarketPrice[];
|
|
206
216
|
}
|
|
207
|
-
interface EngineServerOrder {
|
|
208
|
-
product_id: number;
|
|
209
|
-
sender: string;
|
|
210
|
-
price_x18: string;
|
|
211
|
-
amount: string;
|
|
212
|
-
expiration: string;
|
|
213
|
-
nonce: string;
|
|
214
|
-
unfilled_amount: string;
|
|
215
|
-
digest: string;
|
|
216
|
-
placed_at: number;
|
|
217
|
-
order_type: string;
|
|
218
|
-
margin: string | null;
|
|
219
|
-
}
|
|
220
217
|
type EngineServerOrderResponse = EngineServerOrder;
|
|
221
218
|
interface EngineServerValidateOrderResponse {
|
|
222
219
|
product_id: number;
|
|
@@ -240,19 +237,31 @@ interface EngineServerLinkedSignerResponse {
|
|
|
240
237
|
interface EngineInsuranceResponse {
|
|
241
238
|
insurance: string;
|
|
242
239
|
}
|
|
243
|
-
interface EngineServerMinDepositRate {
|
|
244
|
-
product_id: number;
|
|
245
|
-
min_deposit_rate_x18: string;
|
|
246
|
-
}
|
|
247
|
-
interface EngineServerMinDepositRatesResponse {
|
|
248
|
-
min_deposit_rates: Record<number, EngineServerMinDepositRate>;
|
|
249
|
-
}
|
|
250
240
|
interface EngineServerEdgeAllProductsResponse {
|
|
251
241
|
edge_all_products: Record<number, EngineServerAllProductsResponse>;
|
|
252
242
|
}
|
|
243
|
+
interface EngineServerMaxBurnNlpResponse {
|
|
244
|
+
max_nlp_amount: string;
|
|
245
|
+
}
|
|
253
246
|
interface EngineServerMaxMintNlpResponse {
|
|
254
247
|
max_quote_amount: string;
|
|
255
248
|
}
|
|
249
|
+
interface EngineServerNlpLockedBalancesResponse {
|
|
250
|
+
balance_locked: EngineServerNlpBalance;
|
|
251
|
+
balance_unlocked: EngineServerNlpBalance;
|
|
252
|
+
locked_balances: EngineServerNlpLockedBalance[];
|
|
253
|
+
}
|
|
254
|
+
interface EngineServerNlpPool {
|
|
255
|
+
pool_id: number;
|
|
256
|
+
subaccount: string;
|
|
257
|
+
owner: string;
|
|
258
|
+
balance_weight_x18: string;
|
|
259
|
+
subaccount_info: EngineServerSubaccountInfoResponse;
|
|
260
|
+
open_orders: EngineServerOrder[];
|
|
261
|
+
}
|
|
262
|
+
interface EngineServerNlpPoolInfoResponse {
|
|
263
|
+
nlp_pools: EngineServerNlpPool[];
|
|
264
|
+
}
|
|
256
265
|
interface EngineServerQueryResponseByType {
|
|
257
266
|
all_products: EngineServerAllProductsResponse;
|
|
258
267
|
contracts: EngineServerContractsResponse;
|
|
@@ -265,10 +274,12 @@ interface EngineServerQueryResponseByType {
|
|
|
265
274
|
market_liquidity: EngineServerMarketLiquidityResponse;
|
|
266
275
|
market_price: EngineServerMarketPriceResponse;
|
|
267
276
|
market_prices: EngineServerMarketPricesResponse;
|
|
277
|
+
max_nlp_burnable: EngineServerMaxBurnNlpResponse;
|
|
268
278
|
max_nlp_mintable: EngineServerMaxMintNlpResponse;
|
|
269
279
|
max_order_size: EngineServerMaxOrderSizeResponse;
|
|
280
|
+
nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
|
|
281
|
+
nlp_pool_info: EngineServerNlpPoolInfoResponse;
|
|
270
282
|
max_withdrawable: EngineServerMaxWithdrawableResponse;
|
|
271
|
-
min_deposit_rates: EngineServerMinDepositRatesResponse;
|
|
272
283
|
nonces: EngineServerNoncesResponse;
|
|
273
284
|
order: EngineServerOrderResponse;
|
|
274
285
|
orders: EngineServerProductOrdersResponse;
|
|
@@ -289,4 +300,4 @@ interface EngineServerQueryFailureResponse {
|
|
|
289
300
|
}
|
|
290
301
|
type EngineServerQueryResponse<TQueryType extends keyof EngineServerQueryResponseByType = EngineServerQueryRequestType> = EngineServerQuerySuccessResponse<TQueryType> | EngineServerQueryFailureResponse;
|
|
291
302
|
|
|
292
|
-
export type { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse,
|
|
303
|
+
export type { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxBurnNlpQueryParams, EngineServerMaxBurnNlpResponse, EngineServerMaxMintNlpQueryParams, EngineServerMaxMintNlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerNlpLockedBalancesQueryParams, EngineServerNlpLockedBalancesResponse, EngineServerNlpPool, EngineServerNlpPoolInfoResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/serverSubscriptionEventTypes.ts"],"sourcesContent":["import { EngineServerPriceTickLiquidity } from './serverQueryTypes';\n\n/**\n * Event from subscribing to a `
|
|
1
|
+
{"version":3,"sources":["../../src/types/serverSubscriptionEventTypes.ts"],"sourcesContent":["import { EngineServerPriceTickLiquidity } from './serverQueryTypes';\n\n/**\n * Reasons that can trigger position change events.\n */\nexport type PositionChangeReason =\n | 'deposit_collateral'\n | 'match_orders'\n | 'withdraw_collateral'\n | 'transfer_quote'\n | 'settle_pnl'\n | 'mint_nlp'\n | 'burn_nlp'\n | 'liquidate_subaccount';\n\n/**\n * Possible reasons for order updates.\n */\nexport type OrderUpdateReason = 'cancelled' | 'filled' | 'placed';\n\nexport type EngineServerSubscriptionEventType =\n | 'trade'\n | 'best_bid_offer'\n | 'book_depth'\n | 'fill'\n | 'position_change'\n | 'order_update'\n | 'liquidation'\n | 'latest_candlestick'\n | 'funding_payment';\n\nexport interface EngineServerSubscriptionBaseEvent<\n T extends\n EngineServerSubscriptionEventType = EngineServerSubscriptionEventType,\n> {\n type: T;\n product_id: number;\n}\n\n/**\n * Event from subscribing to a `trade` stream.\n */\nexport interface EngineServerSubscriptionTradeEvent\n extends EngineServerSubscriptionBaseEvent<'trade'> {\n timestamp: string;\n price: string;\n taker_qty: string;\n maker_qty: string;\n is_taker_buyer: boolean;\n}\n\n/**\n * Event from subscribing to a `best_bid_offer` stream.\n */\nexport interface EngineServerSubscriptionBestBidOfferEvent\n extends EngineServerSubscriptionBaseEvent<'best_bid_offer'> {\n timestamp: string;\n bid_price: string;\n bid_qty: string;\n ask_price: string;\n ask_qty: string;\n}\n\n/**\n * Event from subscribing to a `book_depth` stream.\n */\nexport interface EngineServerSubscriptionBookDepthEvent\n extends EngineServerSubscriptionBaseEvent<'book_depth'> {\n last_max_timestamp: string;\n min_timestamp: string;\n max_timestamp: string;\n bids: EngineServerPriceTickLiquidity[];\n asks: EngineServerPriceTickLiquidity[];\n}\n\n/**\n * Event from subscribing to a `fill` stream.\n */\nexport interface EngineServerSubscriptionFillEvent\n extends EngineServerSubscriptionBaseEvent<'fill'> {\n // NOTE: `id` is excluded from the response to avoid parsing issues.\n // type of `id` on the backend is `u64` which can overflow until we introduce proper parsing on the SDK.\n timestamp: string;\n subaccount: string;\n order_digest: string;\n filled_qty: string;\n remaining_qty: string;\n original_qty: string;\n price: string;\n is_taker: boolean;\n is_bid: boolean;\n fee: string;\n submission_idx: string;\n appendix: string;\n}\n\n/**\n * Event from subscribing to a `position_change` stream.\n */\nexport interface EngineServerSubscriptionPositionChangeEvent\n extends EngineServerSubscriptionBaseEvent<'position_change'> {\n timestamp: string;\n subaccount: string;\n amount: string;\n /** Zero for everything except perps */\n v_quote_amount: string;\n reason: PositionChangeReason;\n /**\n * True if the position change was for an isolated position\n */\n isolated: boolean;\n}\n\n/**\n * Event from subscribing to an `order_update` stream.\n */\nexport interface EngineServerSubscriptionOrderUpdateEvent\n extends EngineServerSubscriptionBaseEvent<'order_update'> {\n timestamp: string;\n digest: string;\n amount: string;\n reason: OrderUpdateReason;\n}\n\n/**\n * Event from subscribing to a `liquidation` stream.\n */\nexport interface EngineServerSubscriptionLiquidationEvent\n extends EngineServerSubscriptionBaseEvent<'liquidation'> {\n timestamp: string;\n /** Single element for regular liquidations, two elements for spread liquidations [spotId, perpId] */\n product_ids: number[];\n liquidator: string;\n liquidatee: string;\n /** Amount liquidated (positive for long, negative for short) */\n amount: string;\n /** Price at which liquidation occurred */\n price: string;\n}\n\n/**\n * Event from subscribing to a `latest_candlestick` stream.\n */\nexport interface EngineServerSubscriptionLatestCandlestickEvent\n extends EngineServerSubscriptionBaseEvent<'latest_candlestick'> {\n timestamp: string;\n granularity: number;\n open_x18: string;\n high_x18: string;\n low_x18: string;\n close_x18: string;\n volume: string;\n}\n\n/**\n * Event from subscribing to a `funding_payment` stream.\n */\nexport interface EngineServerSubscriptionFundingPaymentEvent\n extends EngineServerSubscriptionBaseEvent<'funding_payment'> {\n timestamp: string;\n /** Funding payment amount (positive = receive, negative = pay) */\n payment_amount: string;\n /** Open interest at time of funding */\n open_interest: string;\n /** Current cumulative funding values */\n cumulative_funding_long_x18: string;\n cumulative_funding_short_x18: string;\n /** Time delta over which the funding payment was calculated */\n dt: string;\n}\n\n/**\n * Union type for all engine server subscription events.\n */\nexport type EngineServerSubscriptionEvent =\n | EngineServerSubscriptionTradeEvent\n | EngineServerSubscriptionBestBidOfferEvent\n | EngineServerSubscriptionBookDepthEvent\n | EngineServerSubscriptionFillEvent\n | EngineServerSubscriptionPositionChangeEvent\n | EngineServerSubscriptionOrderUpdateEvent\n | EngineServerSubscriptionLiquidationEvent\n | EngineServerSubscriptionLatestCandlestickEvent\n | EngineServerSubscriptionFundingPaymentEvent;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { EngineServerPriceTickLiquidity } from './serverQueryTypes.cjs';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import './serverQueryModelTypes.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Reasons that can trigger position change events.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
9
|
+
/**
|
|
10
|
+
* Possible reasons for order updates.
|
|
11
|
+
*/
|
|
12
|
+
type OrderUpdateReason = 'cancelled' | 'filled' | 'placed';
|
|
13
|
+
type EngineServerSubscriptionEventType = 'trade' | 'best_bid_offer' | 'book_depth' | 'fill' | 'position_change' | 'order_update' | 'liquidation' | 'latest_candlestick' | 'funding_payment';
|
|
14
|
+
interface EngineServerSubscriptionBaseEvent<T extends EngineServerSubscriptionEventType = EngineServerSubscriptionEventType> {
|
|
15
|
+
type: T;
|
|
10
16
|
product_id: number;
|
|
11
|
-
digest: string;
|
|
12
|
-
amount: string;
|
|
13
|
-
reason: string;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Event from subscribing to a `trade` stream.
|
|
17
20
|
*/
|
|
18
|
-
interface EngineServerSubscriptionTradeEvent {
|
|
21
|
+
interface EngineServerSubscriptionTradeEvent extends EngineServerSubscriptionBaseEvent<'trade'> {
|
|
19
22
|
timestamp: string;
|
|
20
|
-
product_id: number;
|
|
21
23
|
price: string;
|
|
22
24
|
taker_qty: string;
|
|
23
25
|
maker_qty: string;
|
|
@@ -26,46 +28,108 @@ interface EngineServerSubscriptionTradeEvent {
|
|
|
26
28
|
/**
|
|
27
29
|
* Event from subscribing to a `best_bid_offer` stream.
|
|
28
30
|
*/
|
|
29
|
-
interface EngineServerSubscriptionBestBidOfferEvent {
|
|
31
|
+
interface EngineServerSubscriptionBestBidOfferEvent extends EngineServerSubscriptionBaseEvent<'best_bid_offer'> {
|
|
30
32
|
timestamp: string;
|
|
31
|
-
product_id: number;
|
|
32
33
|
bid_price: string;
|
|
33
34
|
bid_qty: string;
|
|
34
35
|
ask_price: string;
|
|
35
36
|
ask_qty: string;
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Event from subscribing to a `book_depth` stream.
|
|
40
|
+
*/
|
|
41
|
+
interface EngineServerSubscriptionBookDepthEvent extends EngineServerSubscriptionBaseEvent<'book_depth'> {
|
|
42
|
+
last_max_timestamp: string;
|
|
43
|
+
min_timestamp: string;
|
|
44
|
+
max_timestamp: string;
|
|
45
|
+
bids: EngineServerPriceTickLiquidity[];
|
|
46
|
+
asks: EngineServerPriceTickLiquidity[];
|
|
47
|
+
}
|
|
37
48
|
/**
|
|
38
49
|
* Event from subscribing to a `fill` stream.
|
|
39
50
|
*/
|
|
40
|
-
interface EngineServerSubscriptionFillEvent {
|
|
51
|
+
interface EngineServerSubscriptionFillEvent extends EngineServerSubscriptionBaseEvent<'fill'> {
|
|
41
52
|
timestamp: string;
|
|
42
|
-
product_id: number;
|
|
43
53
|
subaccount: string;
|
|
44
54
|
order_digest: string;
|
|
45
55
|
filled_qty: string;
|
|
46
56
|
remaining_qty: string;
|
|
57
|
+
original_qty: string;
|
|
47
58
|
price: string;
|
|
48
59
|
is_taker: boolean;
|
|
60
|
+
is_bid: boolean;
|
|
61
|
+
fee: string;
|
|
62
|
+
submission_idx: string;
|
|
63
|
+
appendix: string;
|
|
49
64
|
}
|
|
50
65
|
/**
|
|
51
66
|
* Event from subscribing to a `position_change` stream.
|
|
52
67
|
*/
|
|
53
|
-
interface EngineServerSubscriptionPositionChangeEvent {
|
|
68
|
+
interface EngineServerSubscriptionPositionChangeEvent extends EngineServerSubscriptionBaseEvent<'position_change'> {
|
|
54
69
|
timestamp: string;
|
|
55
|
-
product_id: number;
|
|
56
70
|
subaccount: string;
|
|
57
71
|
amount: string;
|
|
72
|
+
/** Zero for everything except perps */
|
|
58
73
|
v_quote_amount: string;
|
|
74
|
+
reason: PositionChangeReason;
|
|
75
|
+
/**
|
|
76
|
+
* True if the position change was for an isolated position
|
|
77
|
+
*/
|
|
78
|
+
isolated: boolean;
|
|
59
79
|
}
|
|
60
80
|
/**
|
|
61
|
-
* Event from subscribing to
|
|
81
|
+
* Event from subscribing to an `order_update` stream.
|
|
62
82
|
*/
|
|
63
|
-
interface
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
interface EngineServerSubscriptionOrderUpdateEvent extends EngineServerSubscriptionBaseEvent<'order_update'> {
|
|
84
|
+
timestamp: string;
|
|
85
|
+
digest: string;
|
|
86
|
+
amount: string;
|
|
87
|
+
reason: OrderUpdateReason;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Event from subscribing to a `liquidation` stream.
|
|
91
|
+
*/
|
|
92
|
+
interface EngineServerSubscriptionLiquidationEvent extends EngineServerSubscriptionBaseEvent<'liquidation'> {
|
|
93
|
+
timestamp: string;
|
|
94
|
+
/** Single element for regular liquidations, two elements for spread liquidations [spotId, perpId] */
|
|
95
|
+
product_ids: number[];
|
|
96
|
+
liquidator: string;
|
|
97
|
+
liquidatee: string;
|
|
98
|
+
/** Amount liquidated (positive for long, negative for short) */
|
|
99
|
+
amount: string;
|
|
100
|
+
/** Price at which liquidation occurred */
|
|
101
|
+
price: string;
|
|
69
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Event from subscribing to a `latest_candlestick` stream.
|
|
105
|
+
*/
|
|
106
|
+
interface EngineServerSubscriptionLatestCandlestickEvent extends EngineServerSubscriptionBaseEvent<'latest_candlestick'> {
|
|
107
|
+
timestamp: string;
|
|
108
|
+
granularity: number;
|
|
109
|
+
open_x18: string;
|
|
110
|
+
high_x18: string;
|
|
111
|
+
low_x18: string;
|
|
112
|
+
close_x18: string;
|
|
113
|
+
volume: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Event from subscribing to a `funding_payment` stream.
|
|
117
|
+
*/
|
|
118
|
+
interface EngineServerSubscriptionFundingPaymentEvent extends EngineServerSubscriptionBaseEvent<'funding_payment'> {
|
|
119
|
+
timestamp: string;
|
|
120
|
+
/** Funding payment amount (positive = receive, negative = pay) */
|
|
121
|
+
payment_amount: string;
|
|
122
|
+
/** Open interest at time of funding */
|
|
123
|
+
open_interest: string;
|
|
124
|
+
/** Current cumulative funding values */
|
|
125
|
+
cumulative_funding_long_x18: string;
|
|
126
|
+
cumulative_funding_short_x18: string;
|
|
127
|
+
/** Time delta over which the funding payment was calculated */
|
|
128
|
+
dt: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Union type for all engine server subscription events.
|
|
132
|
+
*/
|
|
133
|
+
type EngineServerSubscriptionEvent = EngineServerSubscriptionTradeEvent | EngineServerSubscriptionBestBidOfferEvent | EngineServerSubscriptionBookDepthEvent | EngineServerSubscriptionFillEvent | EngineServerSubscriptionPositionChangeEvent | EngineServerSubscriptionOrderUpdateEvent | EngineServerSubscriptionLiquidationEvent | EngineServerSubscriptionLatestCandlestickEvent | EngineServerSubscriptionFundingPaymentEvent;
|
|
70
134
|
|
|
71
|
-
export type { EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionFillEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent };
|
|
135
|
+
export type { EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent, OrderUpdateReason, PositionChangeReason };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { EngineServerPriceTickLiquidity } from './serverQueryTypes.js';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import './serverQueryModelTypes.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Reasons that can trigger position change events.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type PositionChangeReason = 'deposit_collateral' | 'match_orders' | 'withdraw_collateral' | 'transfer_quote' | 'settle_pnl' | 'mint_nlp' | 'burn_nlp' | 'liquidate_subaccount';
|
|
9
|
+
/**
|
|
10
|
+
* Possible reasons for order updates.
|
|
11
|
+
*/
|
|
12
|
+
type OrderUpdateReason = 'cancelled' | 'filled' | 'placed';
|
|
13
|
+
type EngineServerSubscriptionEventType = 'trade' | 'best_bid_offer' | 'book_depth' | 'fill' | 'position_change' | 'order_update' | 'liquidation' | 'latest_candlestick' | 'funding_payment';
|
|
14
|
+
interface EngineServerSubscriptionBaseEvent<T extends EngineServerSubscriptionEventType = EngineServerSubscriptionEventType> {
|
|
15
|
+
type: T;
|
|
10
16
|
product_id: number;
|
|
11
|
-
digest: string;
|
|
12
|
-
amount: string;
|
|
13
|
-
reason: string;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Event from subscribing to a `trade` stream.
|
|
17
20
|
*/
|
|
18
|
-
interface EngineServerSubscriptionTradeEvent {
|
|
21
|
+
interface EngineServerSubscriptionTradeEvent extends EngineServerSubscriptionBaseEvent<'trade'> {
|
|
19
22
|
timestamp: string;
|
|
20
|
-
product_id: number;
|
|
21
23
|
price: string;
|
|
22
24
|
taker_qty: string;
|
|
23
25
|
maker_qty: string;
|
|
@@ -26,46 +28,108 @@ interface EngineServerSubscriptionTradeEvent {
|
|
|
26
28
|
/**
|
|
27
29
|
* Event from subscribing to a `best_bid_offer` stream.
|
|
28
30
|
*/
|
|
29
|
-
interface EngineServerSubscriptionBestBidOfferEvent {
|
|
31
|
+
interface EngineServerSubscriptionBestBidOfferEvent extends EngineServerSubscriptionBaseEvent<'best_bid_offer'> {
|
|
30
32
|
timestamp: string;
|
|
31
|
-
product_id: number;
|
|
32
33
|
bid_price: string;
|
|
33
34
|
bid_qty: string;
|
|
34
35
|
ask_price: string;
|
|
35
36
|
ask_qty: string;
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Event from subscribing to a `book_depth` stream.
|
|
40
|
+
*/
|
|
41
|
+
interface EngineServerSubscriptionBookDepthEvent extends EngineServerSubscriptionBaseEvent<'book_depth'> {
|
|
42
|
+
last_max_timestamp: string;
|
|
43
|
+
min_timestamp: string;
|
|
44
|
+
max_timestamp: string;
|
|
45
|
+
bids: EngineServerPriceTickLiquidity[];
|
|
46
|
+
asks: EngineServerPriceTickLiquidity[];
|
|
47
|
+
}
|
|
37
48
|
/**
|
|
38
49
|
* Event from subscribing to a `fill` stream.
|
|
39
50
|
*/
|
|
40
|
-
interface EngineServerSubscriptionFillEvent {
|
|
51
|
+
interface EngineServerSubscriptionFillEvent extends EngineServerSubscriptionBaseEvent<'fill'> {
|
|
41
52
|
timestamp: string;
|
|
42
|
-
product_id: number;
|
|
43
53
|
subaccount: string;
|
|
44
54
|
order_digest: string;
|
|
45
55
|
filled_qty: string;
|
|
46
56
|
remaining_qty: string;
|
|
57
|
+
original_qty: string;
|
|
47
58
|
price: string;
|
|
48
59
|
is_taker: boolean;
|
|
60
|
+
is_bid: boolean;
|
|
61
|
+
fee: string;
|
|
62
|
+
submission_idx: string;
|
|
63
|
+
appendix: string;
|
|
49
64
|
}
|
|
50
65
|
/**
|
|
51
66
|
* Event from subscribing to a `position_change` stream.
|
|
52
67
|
*/
|
|
53
|
-
interface EngineServerSubscriptionPositionChangeEvent {
|
|
68
|
+
interface EngineServerSubscriptionPositionChangeEvent extends EngineServerSubscriptionBaseEvent<'position_change'> {
|
|
54
69
|
timestamp: string;
|
|
55
|
-
product_id: number;
|
|
56
70
|
subaccount: string;
|
|
57
71
|
amount: string;
|
|
72
|
+
/** Zero for everything except perps */
|
|
58
73
|
v_quote_amount: string;
|
|
74
|
+
reason: PositionChangeReason;
|
|
75
|
+
/**
|
|
76
|
+
* True if the position change was for an isolated position
|
|
77
|
+
*/
|
|
78
|
+
isolated: boolean;
|
|
59
79
|
}
|
|
60
80
|
/**
|
|
61
|
-
* Event from subscribing to
|
|
81
|
+
* Event from subscribing to an `order_update` stream.
|
|
62
82
|
*/
|
|
63
|
-
interface
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
interface EngineServerSubscriptionOrderUpdateEvent extends EngineServerSubscriptionBaseEvent<'order_update'> {
|
|
84
|
+
timestamp: string;
|
|
85
|
+
digest: string;
|
|
86
|
+
amount: string;
|
|
87
|
+
reason: OrderUpdateReason;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Event from subscribing to a `liquidation` stream.
|
|
91
|
+
*/
|
|
92
|
+
interface EngineServerSubscriptionLiquidationEvent extends EngineServerSubscriptionBaseEvent<'liquidation'> {
|
|
93
|
+
timestamp: string;
|
|
94
|
+
/** Single element for regular liquidations, two elements for spread liquidations [spotId, perpId] */
|
|
95
|
+
product_ids: number[];
|
|
96
|
+
liquidator: string;
|
|
97
|
+
liquidatee: string;
|
|
98
|
+
/** Amount liquidated (positive for long, negative for short) */
|
|
99
|
+
amount: string;
|
|
100
|
+
/** Price at which liquidation occurred */
|
|
101
|
+
price: string;
|
|
69
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Event from subscribing to a `latest_candlestick` stream.
|
|
105
|
+
*/
|
|
106
|
+
interface EngineServerSubscriptionLatestCandlestickEvent extends EngineServerSubscriptionBaseEvent<'latest_candlestick'> {
|
|
107
|
+
timestamp: string;
|
|
108
|
+
granularity: number;
|
|
109
|
+
open_x18: string;
|
|
110
|
+
high_x18: string;
|
|
111
|
+
low_x18: string;
|
|
112
|
+
close_x18: string;
|
|
113
|
+
volume: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Event from subscribing to a `funding_payment` stream.
|
|
117
|
+
*/
|
|
118
|
+
interface EngineServerSubscriptionFundingPaymentEvent extends EngineServerSubscriptionBaseEvent<'funding_payment'> {
|
|
119
|
+
timestamp: string;
|
|
120
|
+
/** Funding payment amount (positive = receive, negative = pay) */
|
|
121
|
+
payment_amount: string;
|
|
122
|
+
/** Open interest at time of funding */
|
|
123
|
+
open_interest: string;
|
|
124
|
+
/** Current cumulative funding values */
|
|
125
|
+
cumulative_funding_long_x18: string;
|
|
126
|
+
cumulative_funding_short_x18: string;
|
|
127
|
+
/** Time delta over which the funding payment was calculated */
|
|
128
|
+
dt: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Union type for all engine server subscription events.
|
|
132
|
+
*/
|
|
133
|
+
type EngineServerSubscriptionEvent = EngineServerSubscriptionTradeEvent | EngineServerSubscriptionBestBidOfferEvent | EngineServerSubscriptionBookDepthEvent | EngineServerSubscriptionFillEvent | EngineServerSubscriptionPositionChangeEvent | EngineServerSubscriptionOrderUpdateEvent | EngineServerSubscriptionLiquidationEvent | EngineServerSubscriptionLatestCandlestickEvent | EngineServerSubscriptionFundingPaymentEvent;
|
|
70
134
|
|
|
71
|
-
export type { EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionFillEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent };
|
|
135
|
+
export type { EngineServerSubscriptionBaseEvent, EngineServerSubscriptionBestBidOfferEvent, EngineServerSubscriptionBookDepthEvent, EngineServerSubscriptionEvent, EngineServerSubscriptionEventType, EngineServerSubscriptionFillEvent, EngineServerSubscriptionFundingPaymentEvent, EngineServerSubscriptionLatestCandlestickEvent, EngineServerSubscriptionLiquidationEvent, EngineServerSubscriptionOrderUpdateEvent, EngineServerSubscriptionPositionChangeEvent, EngineServerSubscriptionTradeEvent, OrderUpdateReason, PositionChangeReason };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/serverSubscriptionTypes.ts"],"sourcesContent":["export interface EngineServerOrderUpdateStreamParams {\n product_id
|
|
1
|
+
{"version":3,"sources":["../../src/types/serverSubscriptionTypes.ts"],"sourcesContent":["export interface EngineServerOrderUpdateStreamParams {\n /** when not provided, subscribes to all products */\n product_id?: number;\n subaccount: string;\n}\n\nexport interface EngineServerTradeStreamParams {\n product_id: number;\n}\n\nexport interface EngineServerBestBidOfferStreamParams {\n product_id: number;\n}\n\nexport interface EngineServerFillStreamParams {\n /** when not provided, subscribes to all products */\n product_id?: number;\n subaccount: string;\n}\n\nexport interface EngineServerPositionChangeStreamParams {\n /** when not provided, subscribes to all products */\n product_id?: number;\n subaccount: string;\n}\n\nexport interface EngineServerBookDepthStreamParams {\n product_id: number;\n}\n\nexport interface EngineServerLatestCandlestickStreamParams {\n product_id: number;\n granularity: number;\n}\n\nexport interface EngineServerLiquidationStreamParams {\n /** when not provided, subscribes to all products */\n product_id?: number;\n}\n\nexport interface EngineServerFundingPaymentStreamParams {\n product_id: number;\n}\n\n/**\n * Available subscription streams\n */\nexport interface EngineServerSubscriptionStreamParamsByType {\n order_update: EngineServerOrderUpdateStreamParams;\n trade: EngineServerTradeStreamParams;\n best_bid_offer: EngineServerBestBidOfferStreamParams;\n fill: EngineServerFillStreamParams;\n position_change: EngineServerPositionChangeStreamParams;\n book_depth: EngineServerBookDepthStreamParams;\n liquidation: EngineServerLiquidationStreamParams;\n latest_candlestick: EngineServerLatestCandlestickStreamParams;\n funding_payment: EngineServerFundingPaymentStreamParams;\n}\n\nexport type EngineServerSubscriptionStreamParamsType =\n keyof EngineServerSubscriptionStreamParamsByType;\n\n/**\n * Describes a stream that can be subscribed to.\n */\nexport type EngineServerSubscriptionStream<\n TStreamType extends EngineServerSubscriptionStreamParamsType,\n> = {\n type: TStreamType;\n} & EngineServerSubscriptionStreamParamsByType[TStreamType];\n\n/**\n * Params to provide to a `subscribe` / `unsubscribe` action.\n */\nexport interface EngineServerSubscriptionParams {\n stream: EngineServerSubscriptionStream<EngineServerSubscriptionStreamParamsType>;\n}\n\n/**\n * Available actions on the subscription API.\n */\nexport interface EngineServerSubscriptionRequestByType {\n subscribe: EngineServerSubscriptionParams;\n unsubscribe: EngineServerSubscriptionParams;\n list: Record<string, never>;\n}\n\nexport type EngineServerSubscriptionRequestType =\n keyof EngineServerSubscriptionRequestByType;\n\n/**\n * Top level request to send to the server.\n */\nexport type EngineServerSubscriptionRequest<\n TRequestType extends EngineServerSubscriptionRequestType,\n> = {\n id: number;\n method: TRequestType;\n} & EngineServerSubscriptionRequestByType[TRequestType];\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|