@nadohq/engine-client 0.1.0-alpha.4 → 0.1.0-alpha.41

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.
Files changed (83) hide show
  1. package/dist/EngineBaseClient.d.cts +1 -1
  2. package/dist/EngineBaseClient.d.ts +1 -1
  3. package/dist/EngineExecuteBuilder.cjs +9 -6
  4. package/dist/EngineExecuteBuilder.cjs.map +1 -1
  5. package/dist/EngineExecuteBuilder.js +9 -6
  6. package/dist/EngineExecuteBuilder.js.map +1 -1
  7. package/dist/EngineExecuteClient.cjs +6 -6
  8. package/dist/EngineExecuteClient.cjs.map +1 -1
  9. package/dist/EngineExecuteClient.d.cts +1 -1
  10. package/dist/EngineExecuteClient.d.ts +1 -1
  11. package/dist/EngineExecuteClient.js +6 -6
  12. package/dist/EngineExecuteClient.js.map +1 -1
  13. package/dist/EngineQueryClient.cjs +48 -4
  14. package/dist/EngineQueryClient.cjs.map +1 -1
  15. package/dist/EngineQueryClient.d.cts +18 -2
  16. package/dist/EngineQueryClient.d.ts +18 -2
  17. package/dist/EngineQueryClient.js +50 -4
  18. package/dist/EngineQueryClient.js.map +1 -1
  19. package/dist/endpoints.cjs +6 -6
  20. package/dist/endpoints.cjs.map +1 -1
  21. package/dist/endpoints.js +6 -6
  22. package/dist/endpoints.js.map +1 -1
  23. package/dist/index.cjs +4 -4
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +9 -9
  26. package/dist/index.d.ts +9 -9
  27. package/dist/index.js +2 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/types/EngineServerFailureError.cjs +1 -1
  30. package/dist/types/EngineServerFailureError.cjs.map +1 -1
  31. package/dist/types/EngineServerFailureError.js +1 -1
  32. package/dist/types/EngineServerFailureError.js.map +1 -1
  33. package/dist/types/clientExecuteTypes.cjs.map +1 -1
  34. package/dist/types/clientExecuteTypes.d.cts +8 -1
  35. package/dist/types/clientExecuteTypes.d.ts +8 -1
  36. package/dist/types/clientQueryTypes.cjs.map +1 -1
  37. package/dist/types/clientQueryTypes.d.cts +37 -5
  38. package/dist/types/clientQueryTypes.d.ts +37 -5
  39. package/dist/types/index.cjs +10 -10
  40. package/dist/types/index.cjs.map +1 -1
  41. package/dist/types/index.d.cts +6 -6
  42. package/dist/types/index.d.ts +6 -6
  43. package/dist/types/index.js +5 -5
  44. package/dist/types/index.js.map +1 -1
  45. package/dist/types/serverExecuteTypes.cjs.map +1 -1
  46. package/dist/types/serverExecuteTypes.d.cts +8 -1
  47. package/dist/types/serverExecuteTypes.d.ts +8 -1
  48. package/dist/types/serverQueryModelTypes.cjs.map +1 -1
  49. package/dist/types/serverQueryModelTypes.d.cts +24 -1
  50. package/dist/types/serverQueryModelTypes.d.ts +24 -1
  51. package/dist/types/serverQueryTypes.cjs.map +1 -1
  52. package/dist/types/serverQueryTypes.d.cts +47 -22
  53. package/dist/types/serverQueryTypes.d.ts +47 -22
  54. package/dist/types/serverSubscriptionEventTypes.cjs.map +1 -1
  55. package/dist/types/serverSubscriptionEventTypes.d.cts +86 -22
  56. package/dist/types/serverSubscriptionEventTypes.d.ts +86 -22
  57. package/dist/types/serverSubscriptionTypes.cjs.map +1 -1
  58. package/dist/types/serverSubscriptionTypes.d.cts +21 -4
  59. package/dist/types/serverSubscriptionTypes.d.ts +21 -4
  60. package/dist/utils/index.d.cts +2 -2
  61. package/dist/utils/index.d.ts +2 -2
  62. package/dist/utils/queryDataMappers.cjs +66 -19
  63. package/dist/utils/queryDataMappers.cjs.map +1 -1
  64. package/dist/utils/queryDataMappers.d.cts +5 -3
  65. package/dist/utils/queryDataMappers.d.ts +5 -3
  66. package/dist/utils/queryDataMappers.js +64 -19
  67. package/dist/utils/queryDataMappers.js.map +1 -1
  68. package/package.json +7 -3
  69. package/src/EngineExecuteBuilder.ts +9 -6
  70. package/src/EngineExecuteClient.ts +7 -7
  71. package/src/EngineQueryClient.ts +63 -1
  72. package/src/endpoints.ts +6 -6
  73. package/src/index.ts +2 -2
  74. package/src/types/EngineServerFailureError.ts +1 -1
  75. package/src/types/clientExecuteTypes.ts +9 -2
  76. package/src/types/clientQueryTypes.ts +49 -4
  77. package/src/types/index.ts +5 -5
  78. package/src/types/serverExecuteTypes.ts +9 -2
  79. package/src/types/serverQueryModelTypes.ts +25 -0
  80. package/src/types/serverQueryTypes.ts +61 -21
  81. package/src/types/serverSubscriptionEventTypes.ts +131 -21
  82. package/src/types/serverSubscriptionTypes.ts +23 -3
  83. package/src/utils/queryDataMappers.ts +85 -20
@@ -1,5 +1,5 @@
1
1
  import { HealthStatus } from '@nadohq/shared';
2
- import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerHealthBreakdown } from './serverQueryModelTypes.cjs';
2
+ import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerHealthBreakdown, EngineServerOrder } from './serverQueryModelTypes.cjs';
3
3
 
4
4
  interface EngineServerNoncesParams {
5
5
  address: string;
@@ -14,6 +14,7 @@ interface EngineServerSubaccountInfoQueryParams {
14
14
  v_quote_delta: string;
15
15
  };
16
16
  }>;
17
+ pre_state?: string;
17
18
  }
18
19
  interface EngineServerIsolatedPositionsQueryParams {
19
20
  subaccount: string;
@@ -63,6 +64,8 @@ interface EngineServerMaxOrderSizeQueryParams {
63
64
  direction: 'long' | 'short';
64
65
  spot_leverage: string | null;
65
66
  reduce_only: string | null;
67
+ isolated: string | null;
68
+ borrow_margin: string | null;
66
69
  }
67
70
  interface EngineServerLinkedSignerParams {
68
71
  subaccount: string;
@@ -71,6 +74,12 @@ interface EngineServerMaxMintNlpQueryParams {
71
74
  sender: string;
72
75
  spot_leverage: string | null;
73
76
  }
77
+ interface EngineServerMaxBurnNlpQueryParams {
78
+ sender: string;
79
+ }
80
+ interface EngineServerNlpLockedBalancesQueryParams {
81
+ subaccount: string;
82
+ }
74
83
  interface EngineServerQueryRequestByType {
75
84
  all_products: Record<string, never>;
76
85
  contracts: Record<string, never>;
@@ -83,8 +92,11 @@ interface EngineServerQueryRequestByType {
83
92
  market_liquidity: EngineServerMarketLiquidityQueryParams;
84
93
  market_price: EngineServerMarketPriceQueryParams;
85
94
  market_prices: EngineServerMarketPricesQueryParams;
95
+ max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
86
96
  max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
87
97
  max_order_size: EngineServerMaxOrderSizeQueryParams;
98
+ nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
99
+ nlp_pool_info: Record<string, never>;
88
100
  max_withdrawable: EngineServerMaxWithdrawableQueryParams;
89
101
  nonces: EngineServerNoncesParams;
90
102
  order: EngineServerGetOrderQueryParams;
@@ -110,21 +122,25 @@ interface EngineServerNoncesResponse {
110
122
  order_nonce: string;
111
123
  tx_nonce: string;
112
124
  }
113
- interface EngineServerSubaccountInfoResponse {
125
+ interface EngineServerSubaccountInfoResponse extends EngineServerSubaccountInfoState {
114
126
  exists: boolean;
115
127
  subaccount: string;
128
+ spot_count: number;
129
+ perp_count: number;
130
+ spot_products: EngineServerSpotProduct[];
131
+ perp_products: EngineServerPerpProduct[];
132
+ /** This is set if request has `pre_state` flag set to 'true' */
133
+ pre_state: EngineServerSubaccountInfoState | undefined;
134
+ }
135
+ interface EngineServerSubaccountInfoState {
116
136
  healths: [
117
137
  initial: EngineServerHealthBreakdown,
118
138
  maintenance: EngineServerHealthBreakdown,
119
139
  unweighted: EngineServerHealthBreakdown
120
140
  ];
121
141
  health_contributions: string[][];
122
- spot_count: number;
123
- perp_count: number;
124
142
  spot_balances: EngineServerSpotBalance[];
125
143
  perp_balances: EngineServerPerpBalance[];
126
- spot_products: EngineServerSpotProduct[];
127
- perp_products: EngineServerPerpProduct[];
128
144
  }
129
145
  interface EngineServerIsolatedPosition {
130
146
  subaccount: string;
@@ -150,12 +166,11 @@ interface EngineServerSymbol {
150
166
  price_increment_x18: string;
151
167
  size_increment: string;
152
168
  min_size: string;
153
- min_depth_x18: string;
154
- max_spread_rate_x18: string;
155
169
  maker_fee_rate_x18: string;
156
170
  taker_fee_rate_x18: string;
157
171
  long_weight_initial_x18: string;
158
172
  long_weight_maintenance_x18: string;
173
+ max_open_interest_x18: string | undefined;
159
174
  }
160
175
  interface EngineServerSymbolsResponse {
161
176
  symbols: Record<string, EngineServerSymbol>;
@@ -192,6 +207,7 @@ interface EngineServerFeeRatesResponse {
192
207
  withdraw_sequencer_fees: string[];
193
208
  taker_fee_rates_x18: string[];
194
209
  maker_fee_rates_x18: string[];
210
+ fee_tier: number;
195
211
  }
196
212
  interface EngineServerMarketPrice {
197
213
  product_id: number;
@@ -202,19 +218,6 @@ type EngineServerMarketPriceResponse = EngineServerMarketPrice;
202
218
  interface EngineServerMarketPricesResponse {
203
219
  market_prices: EngineServerMarketPrice[];
204
220
  }
205
- interface EngineServerOrder {
206
- product_id: number;
207
- sender: string;
208
- price_x18: string;
209
- amount: string;
210
- expiration: string;
211
- nonce: string;
212
- unfilled_amount: string;
213
- digest: string;
214
- placed_at: number;
215
- order_type: string;
216
- appendix: string;
217
- }
218
221
  type EngineServerOrderResponse = EngineServerOrder;
219
222
  interface EngineServerValidateOrderResponse {
220
223
  product_id: number;
@@ -241,9 +244,28 @@ interface EngineInsuranceResponse {
241
244
  interface EngineServerEdgeAllProductsResponse {
242
245
  edge_all_products: Record<number, EngineServerAllProductsResponse>;
243
246
  }
247
+ interface EngineServerMaxBurnNlpResponse {
248
+ max_nlp_amount: string;
249
+ }
244
250
  interface EngineServerMaxMintNlpResponse {
245
251
  max_quote_amount: string;
246
252
  }
253
+ interface EngineServerNlpLockedBalancesResponse {
254
+ balance_locked: EngineServerNlpBalance;
255
+ balance_unlocked: EngineServerNlpBalance;
256
+ locked_balances: EngineServerNlpLockedBalance[];
257
+ }
258
+ interface EngineServerNlpPool {
259
+ pool_id: number;
260
+ subaccount: string;
261
+ owner: string;
262
+ balance_weight_x18: string;
263
+ subaccount_info: EngineServerSubaccountInfoResponse;
264
+ open_orders: EngineServerOrder[];
265
+ }
266
+ interface EngineServerNlpPoolInfoResponse {
267
+ nlp_pools: EngineServerNlpPool[];
268
+ }
247
269
  interface EngineServerQueryResponseByType {
248
270
  all_products: EngineServerAllProductsResponse;
249
271
  contracts: EngineServerContractsResponse;
@@ -256,8 +278,11 @@ interface EngineServerQueryResponseByType {
256
278
  market_liquidity: EngineServerMarketLiquidityResponse;
257
279
  market_price: EngineServerMarketPriceResponse;
258
280
  market_prices: EngineServerMarketPricesResponse;
281
+ max_nlp_burnable: EngineServerMaxBurnNlpResponse;
259
282
  max_nlp_mintable: EngineServerMaxMintNlpResponse;
260
283
  max_order_size: EngineServerMaxOrderSizeResponse;
284
+ nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
285
+ nlp_pool_info: EngineServerNlpPoolInfoResponse;
261
286
  max_withdrawable: EngineServerMaxWithdrawableResponse;
262
287
  nonces: EngineServerNoncesResponse;
263
288
  order: EngineServerOrderResponse;
@@ -279,4 +304,4 @@ interface EngineServerQueryFailureResponse {
279
304
  }
280
305
  type EngineServerQueryResponse<TQueryType extends keyof EngineServerQueryResponseByType = EngineServerQueryRequestType> = EngineServerQuerySuccessResponse<TQueryType> | EngineServerQueryFailureResponse;
281
306
 
282
- 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, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };
307
+ 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, EngineServerSubaccountInfoState, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };
@@ -1,5 +1,5 @@
1
1
  import { HealthStatus } from '@nadohq/shared';
2
- import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerHealthBreakdown } from './serverQueryModelTypes.js';
2
+ import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerNlpBalance, EngineServerNlpLockedBalance, EngineServerHealthBreakdown, EngineServerOrder } from './serverQueryModelTypes.js';
3
3
 
4
4
  interface EngineServerNoncesParams {
5
5
  address: string;
@@ -14,6 +14,7 @@ interface EngineServerSubaccountInfoQueryParams {
14
14
  v_quote_delta: string;
15
15
  };
16
16
  }>;
17
+ pre_state?: string;
17
18
  }
18
19
  interface EngineServerIsolatedPositionsQueryParams {
19
20
  subaccount: string;
@@ -63,6 +64,8 @@ interface EngineServerMaxOrderSizeQueryParams {
63
64
  direction: 'long' | 'short';
64
65
  spot_leverage: string | null;
65
66
  reduce_only: string | null;
67
+ isolated: string | null;
68
+ borrow_margin: string | null;
66
69
  }
67
70
  interface EngineServerLinkedSignerParams {
68
71
  subaccount: string;
@@ -71,6 +74,12 @@ interface EngineServerMaxMintNlpQueryParams {
71
74
  sender: string;
72
75
  spot_leverage: string | null;
73
76
  }
77
+ interface EngineServerMaxBurnNlpQueryParams {
78
+ sender: string;
79
+ }
80
+ interface EngineServerNlpLockedBalancesQueryParams {
81
+ subaccount: string;
82
+ }
74
83
  interface EngineServerQueryRequestByType {
75
84
  all_products: Record<string, never>;
76
85
  contracts: Record<string, never>;
@@ -83,8 +92,11 @@ interface EngineServerQueryRequestByType {
83
92
  market_liquidity: EngineServerMarketLiquidityQueryParams;
84
93
  market_price: EngineServerMarketPriceQueryParams;
85
94
  market_prices: EngineServerMarketPricesQueryParams;
95
+ max_nlp_burnable: EngineServerMaxBurnNlpQueryParams;
86
96
  max_nlp_mintable: EngineServerMaxMintNlpQueryParams;
87
97
  max_order_size: EngineServerMaxOrderSizeQueryParams;
98
+ nlp_locked_balances: EngineServerNlpLockedBalancesQueryParams;
99
+ nlp_pool_info: Record<string, never>;
88
100
  max_withdrawable: EngineServerMaxWithdrawableQueryParams;
89
101
  nonces: EngineServerNoncesParams;
90
102
  order: EngineServerGetOrderQueryParams;
@@ -110,21 +122,25 @@ interface EngineServerNoncesResponse {
110
122
  order_nonce: string;
111
123
  tx_nonce: string;
112
124
  }
113
- interface EngineServerSubaccountInfoResponse {
125
+ interface EngineServerSubaccountInfoResponse extends EngineServerSubaccountInfoState {
114
126
  exists: boolean;
115
127
  subaccount: string;
128
+ spot_count: number;
129
+ perp_count: number;
130
+ spot_products: EngineServerSpotProduct[];
131
+ perp_products: EngineServerPerpProduct[];
132
+ /** This is set if request has `pre_state` flag set to 'true' */
133
+ pre_state: EngineServerSubaccountInfoState | undefined;
134
+ }
135
+ interface EngineServerSubaccountInfoState {
116
136
  healths: [
117
137
  initial: EngineServerHealthBreakdown,
118
138
  maintenance: EngineServerHealthBreakdown,
119
139
  unweighted: EngineServerHealthBreakdown
120
140
  ];
121
141
  health_contributions: string[][];
122
- spot_count: number;
123
- perp_count: number;
124
142
  spot_balances: EngineServerSpotBalance[];
125
143
  perp_balances: EngineServerPerpBalance[];
126
- spot_products: EngineServerSpotProduct[];
127
- perp_products: EngineServerPerpProduct[];
128
144
  }
129
145
  interface EngineServerIsolatedPosition {
130
146
  subaccount: string;
@@ -150,12 +166,11 @@ interface EngineServerSymbol {
150
166
  price_increment_x18: string;
151
167
  size_increment: string;
152
168
  min_size: string;
153
- min_depth_x18: string;
154
- max_spread_rate_x18: string;
155
169
  maker_fee_rate_x18: string;
156
170
  taker_fee_rate_x18: string;
157
171
  long_weight_initial_x18: string;
158
172
  long_weight_maintenance_x18: string;
173
+ max_open_interest_x18: string | undefined;
159
174
  }
160
175
  interface EngineServerSymbolsResponse {
161
176
  symbols: Record<string, EngineServerSymbol>;
@@ -192,6 +207,7 @@ interface EngineServerFeeRatesResponse {
192
207
  withdraw_sequencer_fees: string[];
193
208
  taker_fee_rates_x18: string[];
194
209
  maker_fee_rates_x18: string[];
210
+ fee_tier: number;
195
211
  }
196
212
  interface EngineServerMarketPrice {
197
213
  product_id: number;
@@ -202,19 +218,6 @@ type EngineServerMarketPriceResponse = EngineServerMarketPrice;
202
218
  interface EngineServerMarketPricesResponse {
203
219
  market_prices: EngineServerMarketPrice[];
204
220
  }
205
- interface EngineServerOrder {
206
- product_id: number;
207
- sender: string;
208
- price_x18: string;
209
- amount: string;
210
- expiration: string;
211
- nonce: string;
212
- unfilled_amount: string;
213
- digest: string;
214
- placed_at: number;
215
- order_type: string;
216
- appendix: string;
217
- }
218
221
  type EngineServerOrderResponse = EngineServerOrder;
219
222
  interface EngineServerValidateOrderResponse {
220
223
  product_id: number;
@@ -241,9 +244,28 @@ interface EngineInsuranceResponse {
241
244
  interface EngineServerEdgeAllProductsResponse {
242
245
  edge_all_products: Record<number, EngineServerAllProductsResponse>;
243
246
  }
247
+ interface EngineServerMaxBurnNlpResponse {
248
+ max_nlp_amount: string;
249
+ }
244
250
  interface EngineServerMaxMintNlpResponse {
245
251
  max_quote_amount: string;
246
252
  }
253
+ interface EngineServerNlpLockedBalancesResponse {
254
+ balance_locked: EngineServerNlpBalance;
255
+ balance_unlocked: EngineServerNlpBalance;
256
+ locked_balances: EngineServerNlpLockedBalance[];
257
+ }
258
+ interface EngineServerNlpPool {
259
+ pool_id: number;
260
+ subaccount: string;
261
+ owner: string;
262
+ balance_weight_x18: string;
263
+ subaccount_info: EngineServerSubaccountInfoResponse;
264
+ open_orders: EngineServerOrder[];
265
+ }
266
+ interface EngineServerNlpPoolInfoResponse {
267
+ nlp_pools: EngineServerNlpPool[];
268
+ }
247
269
  interface EngineServerQueryResponseByType {
248
270
  all_products: EngineServerAllProductsResponse;
249
271
  contracts: EngineServerContractsResponse;
@@ -256,8 +278,11 @@ interface EngineServerQueryResponseByType {
256
278
  market_liquidity: EngineServerMarketLiquidityResponse;
257
279
  market_price: EngineServerMarketPriceResponse;
258
280
  market_prices: EngineServerMarketPricesResponse;
281
+ max_nlp_burnable: EngineServerMaxBurnNlpResponse;
259
282
  max_nlp_mintable: EngineServerMaxMintNlpResponse;
260
283
  max_order_size: EngineServerMaxOrderSizeResponse;
284
+ nlp_locked_balances: EngineServerNlpLockedBalancesResponse;
285
+ nlp_pool_info: EngineServerNlpPoolInfoResponse;
261
286
  max_withdrawable: EngineServerMaxWithdrawableResponse;
262
287
  nonces: EngineServerNoncesResponse;
263
288
  order: EngineServerOrderResponse;
@@ -279,4 +304,4 @@ interface EngineServerQueryFailureResponse {
279
304
  }
280
305
  type EngineServerQueryResponse<TQueryType extends keyof EngineServerQueryResponseByType = EngineServerQueryRequestType> = EngineServerQuerySuccessResponse<TQueryType> | EngineServerQueryFailureResponse;
281
306
 
282
- 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, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };
307
+ 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, EngineServerSubaccountInfoState, 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 `order_update` stream.\n */\nexport interface EngineServerSubscriptionOrderUpdateEvent {\n timestamp: string;\n product_id: number;\n digest: string;\n amount: string;\n reason: string;\n}\n\n/**\n * Event from subscribing to a `trade` stream.\n */\nexport interface EngineServerSubscriptionTradeEvent {\n timestamp: string;\n product_id: number;\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 timestamp: string;\n product_id: number;\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 `fill` stream.\n */\nexport interface EngineServerSubscriptionFillEvent {\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 product_id: number;\n subaccount: string;\n order_digest: string;\n filled_qty: string;\n remaining_qty: string;\n price: string;\n is_taker: boolean;\n}\n\n/**\n * Event from subscribing to a `position_change` stream.\n */\nexport interface EngineServerSubscriptionPositionChangeEvent {\n timestamp: string;\n product_id: number;\n subaccount: string;\n amount: string;\n v_quote_amount: string;\n}\n\n/**\n * Event from subscribing to a `book_depth` stream.\n */\nexport interface EngineServerSubscriptionBookDepthEvent {\n min_timestamp: string;\n max_timestamp: string;\n product_id: number;\n bids: EngineServerPriceTickLiquidity[];\n asks: EngineServerPriceTickLiquidity[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
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":[]}
@@ -3,21 +3,23 @@ import '@nadohq/shared';
3
3
  import './serverQueryModelTypes.cjs';
4
4
 
5
5
  /**
6
- * Event from subscribing to a `order_update` stream.
6
+ * Reasons that can trigger position change events.
7
7
  */
8
- interface EngineServerSubscriptionOrderUpdateEvent {
9
- timestamp: string;
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 a `book_depth` stream.
81
+ * Event from subscribing to an `order_update` stream.
62
82
  */
63
- interface EngineServerSubscriptionBookDepthEvent {
64
- min_timestamp: string;
65
- max_timestamp: string;
66
- product_id: number;
67
- bids: EngineServerPriceTickLiquidity[];
68
- asks: EngineServerPriceTickLiquidity[];
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 };
@@ -3,21 +3,23 @@ import '@nadohq/shared';
3
3
  import './serverQueryModelTypes.js';
4
4
 
5
5
  /**
6
- * Event from subscribing to a `order_update` stream.
6
+ * Reasons that can trigger position change events.
7
7
  */
8
- interface EngineServerSubscriptionOrderUpdateEvent {
9
- timestamp: string;
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 a `book_depth` stream.
81
+ * Event from subscribing to an `order_update` stream.
62
82
  */
63
- interface EngineServerSubscriptionBookDepthEvent {
64
- min_timestamp: string;
65
- max_timestamp: string;
66
- product_id: number;
67
- bids: EngineServerPriceTickLiquidity[];
68
- asks: EngineServerPriceTickLiquidity[];
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 };