@reyaxyz/common 0.261.1 → 0.262.1
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/README.md +1 -1
- package/dist/rest/helpers/constants.js +16 -10
- package/dist/rest/helpers/constants.js.map +1 -1
- package/dist/trading-api-types.js.map +1 -1
- package/dist/types/rest/helpers/constants.d.ts +1 -1
- package/dist/types/rest/helpers/constants.d.ts.map +1 -1
- package/dist/types/trading-api-types.d.ts +320 -360
- package/dist/types/trading-api-types.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -3
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/rest/helpers/constants.ts +30 -11
- package/src/trading-api-types.ts +414 -341
- package/src/types.ts +5 -3
package/src/trading-api-types.ts
CHANGED
|
@@ -51,13 +51,186 @@ type Order = {
|
|
|
51
51
|
created_at: Date;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
type Position = {
|
|
55
|
+
market_id: Decimal;
|
|
56
|
+
account_id: Decimal;
|
|
57
|
+
base: Decimal | null;
|
|
58
|
+
realized_pnl: Decimal | null;
|
|
59
|
+
realized_pnl_latest_snapshot: Decimal | null;
|
|
60
|
+
average_entry_price_off_chain_tracker: Decimal | null;
|
|
61
|
+
funding_value_off_chain_tracker: Decimal | null;
|
|
62
|
+
last_price: Decimal | null;
|
|
63
|
+
position_data_last_price_data_timestamp: Decimal | null;
|
|
64
|
+
funding_value: Decimal | null;
|
|
65
|
+
base_multiplier: Decimal | null;
|
|
66
|
+
adl_unwind_price: Decimal | null;
|
|
67
|
+
transaction_hash: string;
|
|
68
|
+
block_timestamp: Decimal | null;
|
|
69
|
+
block_number: Decimal;
|
|
70
|
+
unique_id: bigint | null;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
type ConditionalOrder = {
|
|
74
|
+
id: string;
|
|
75
|
+
account_id: Decimal;
|
|
76
|
+
market_id: Decimal;
|
|
77
|
+
order_type: string;
|
|
78
|
+
is_long: boolean;
|
|
79
|
+
trigger_price: number;
|
|
80
|
+
order_base: Decimal;
|
|
81
|
+
exchange_id: bigint;
|
|
82
|
+
inputs: string;
|
|
83
|
+
counterparty_account_id: bigint;
|
|
84
|
+
reya_chain_id: bigint;
|
|
85
|
+
deadline: bigint;
|
|
86
|
+
signer_address: string;
|
|
87
|
+
nonce: Decimal;
|
|
88
|
+
signature: string;
|
|
89
|
+
status: string;
|
|
90
|
+
creation_timestamp_ms: bigint;
|
|
91
|
+
last_update_timestamp_ms: bigint;
|
|
92
|
+
transaction_hash: string | null;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type Swap = {
|
|
96
|
+
id: string;
|
|
97
|
+
account_id: Decimal;
|
|
98
|
+
token_in: string;
|
|
99
|
+
token_out: string;
|
|
100
|
+
amount_in: Decimal;
|
|
101
|
+
amount_out: Decimal;
|
|
102
|
+
executed_amount_out: Decimal;
|
|
103
|
+
transaction_hash: string;
|
|
104
|
+
block_timestamp: Decimal;
|
|
105
|
+
block_number: Decimal;
|
|
106
|
+
unique_id: bigint | null;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type Market = {
|
|
110
|
+
id: Decimal;
|
|
111
|
+
ticker: string;
|
|
112
|
+
markPrice: number;
|
|
113
|
+
isActive: boolean;
|
|
114
|
+
maxLeverage: number;
|
|
115
|
+
volume24H: number;
|
|
116
|
+
priceChange24H: number;
|
|
117
|
+
longOI: number;
|
|
118
|
+
shortOI: number;
|
|
119
|
+
availableLong: number;
|
|
120
|
+
availableShort: number;
|
|
121
|
+
marketPriceDeviation: number;
|
|
122
|
+
riskBlockId: number;
|
|
123
|
+
rootCollateralPoolId: number;
|
|
124
|
+
description: string;
|
|
125
|
+
name: string;
|
|
126
|
+
quoteTokenId: string;
|
|
127
|
+
tickSizeDecimals: number;
|
|
128
|
+
underlyingAssetId: string;
|
|
129
|
+
priceChange24HPercentage: number;
|
|
130
|
+
openInterest: number;
|
|
131
|
+
fundingRate: number;
|
|
132
|
+
priority: number;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
type Account = {
|
|
136
|
+
account_id: Decimal;
|
|
137
|
+
name: string;
|
|
138
|
+
status: AccountStatus;
|
|
139
|
+
updated_timestamp_ms: Decimal;
|
|
140
|
+
source: string | null;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
type Price = {
|
|
144
|
+
block_number: Decimal;
|
|
145
|
+
unique_id: bigint | null;
|
|
146
|
+
contract_id: string;
|
|
147
|
+
price: Decimal | null;
|
|
148
|
+
round_id: Decimal | null;
|
|
149
|
+
timestamp: Decimal;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
type AccountBalance = {
|
|
153
|
+
account_id: number | null;
|
|
154
|
+
collateral: string | null;
|
|
155
|
+
balance?: string | null;
|
|
156
|
+
delta?: string | null;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
type AutoExchange = {
|
|
160
|
+
id: string;
|
|
161
|
+
liquidated_account_id: Decimal | null;
|
|
162
|
+
liquidator_account_id: Decimal | null;
|
|
163
|
+
requested_quote_amount: Decimal | null;
|
|
164
|
+
collateral_out_address: string | null;
|
|
165
|
+
collateral_in_address: string | null;
|
|
166
|
+
collateral_amount_to_liquidator: Decimal | null;
|
|
167
|
+
quote_amount_to_insurance_fund: Decimal | null;
|
|
168
|
+
quote_amount_to_account: Decimal | null;
|
|
169
|
+
block_timestamp: Decimal | null;
|
|
170
|
+
block_number: Decimal;
|
|
171
|
+
transaction_hash: string;
|
|
172
|
+
unique_id: bigint | null;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
type Leverage = {
|
|
176
|
+
accountId: Decimal;
|
|
177
|
+
marketId: Decimal;
|
|
178
|
+
leverage: number;
|
|
179
|
+
createdAt: Date;
|
|
180
|
+
updatedAt: Date;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type TradingApiEndpoint<
|
|
184
|
+
Response,
|
|
185
|
+
Params,
|
|
186
|
+
ReplicationTable extends ReplicationModel = never,
|
|
187
|
+
Replication = Response,
|
|
188
|
+
Query = never,
|
|
189
|
+
> = {
|
|
190
|
+
params: Params;
|
|
191
|
+
query: Query;
|
|
192
|
+
response: Response;
|
|
193
|
+
replication: GenericReplicationMessage<Replication, ReplicationTable>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export type TradingApiListEndpoint<
|
|
197
|
+
Response,
|
|
198
|
+
Params = never,
|
|
199
|
+
ReplicationTable extends ReplicationModel = never,
|
|
200
|
+
Replication = Response,
|
|
201
|
+
Query = never,
|
|
202
|
+
> = {
|
|
203
|
+
params: Params;
|
|
204
|
+
query: Query;
|
|
205
|
+
response: Response[];
|
|
206
|
+
replication: GenericReplicationMessage<Replication, ReplicationTable>;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type TradingApiInfiniteListEndpointResponse<Response> = {
|
|
210
|
+
data: Response[];
|
|
211
|
+
meta: PaginatedQueryMeta;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type TradingApiInfiniteListEndpoint<
|
|
215
|
+
Response,
|
|
216
|
+
Params = never,
|
|
217
|
+
ReplicationTable extends ReplicationModel = never,
|
|
218
|
+
Replication = Response,
|
|
219
|
+
Query = PaginatedQueryParams,
|
|
220
|
+
> = {
|
|
221
|
+
params: Params;
|
|
222
|
+
query: Query;
|
|
223
|
+
response: TradingApiInfiniteListEndpointResponse<Response>;
|
|
224
|
+
replication: GenericReplicationMessage<Replication, ReplicationTable>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
type AddressParam = {
|
|
228
|
+
address: string;
|
|
229
|
+
};
|
|
230
|
+
|
|
54
231
|
export type TradingApiSource = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
poolId?: string;
|
|
58
|
-
};
|
|
59
|
-
query: never;
|
|
60
|
-
response: {
|
|
232
|
+
'poolBalance/:poolId?': TradingApiEndpoint<
|
|
233
|
+
{
|
|
61
234
|
id: number;
|
|
62
235
|
timestamp: bigint;
|
|
63
236
|
pool_id: number;
|
|
@@ -65,353 +238,198 @@ export type TradingApiSource = {
|
|
|
65
238
|
apy: Decimal;
|
|
66
239
|
share_price: Decimal;
|
|
67
240
|
share_price_index: Decimal;
|
|
68
|
-
} | null
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
241
|
+
} | null,
|
|
242
|
+
{
|
|
243
|
+
poolId?: string;
|
|
244
|
+
}
|
|
245
|
+
>;
|
|
246
|
+
'wallet/:address/leverages': TradingApiListEndpoint<
|
|
247
|
+
Leverage,
|
|
248
|
+
{ address: string },
|
|
249
|
+
'accountLeveragePerMarket'
|
|
250
|
+
>;
|
|
251
|
+
'markets/configuration': TradingApiListEndpoint<{
|
|
252
|
+
market_id: Decimal;
|
|
253
|
+
risk_matrix_index: Decimal | null;
|
|
254
|
+
max_open_base: Decimal | null;
|
|
255
|
+
velocity_multiplier: Decimal | null;
|
|
256
|
+
minimum_order_base: Decimal | null;
|
|
257
|
+
base_spacing: Decimal | null;
|
|
258
|
+
price_spacing: Decimal | null;
|
|
259
|
+
oracle_node_id: string | null;
|
|
260
|
+
mtm_window: Decimal | null;
|
|
261
|
+
dutch_config_lambda: Decimal | null;
|
|
262
|
+
dutch_config_min_base: Decimal | null;
|
|
263
|
+
slippage_params_phi: Decimal | null;
|
|
264
|
+
slippage_params_beta: Decimal | null;
|
|
265
|
+
depth_factor: Decimal | null;
|
|
266
|
+
max_exposure_factor: Decimal | null;
|
|
267
|
+
max_p_slippage: Decimal | null;
|
|
268
|
+
price_spread: Decimal | null;
|
|
269
|
+
volatility_index_multiplier: Decimal | null;
|
|
270
|
+
block_timestamp: Decimal | null;
|
|
271
|
+
block_number: Decimal;
|
|
272
|
+
unique_id: bigint | null;
|
|
273
|
+
}>;
|
|
274
|
+
'markets/storage': TradingApiListEndpoint<{
|
|
275
|
+
market_id: Decimal;
|
|
276
|
+
quote_collateral: string | null;
|
|
277
|
+
instrument_address: string | null;
|
|
278
|
+
name: string | null;
|
|
279
|
+
risk_block_id: Decimal | null;
|
|
280
|
+
collateral_pool_id: Decimal | null;
|
|
281
|
+
block_timestamp: Decimal | null;
|
|
282
|
+
block_number: Decimal;
|
|
283
|
+
unique_id: bigint | null;
|
|
284
|
+
}>;
|
|
285
|
+
'markets/trackers': TradingApiListEndpoint<{
|
|
286
|
+
market_data_id: Decimal;
|
|
287
|
+
passive_pool_id: Decimal | null;
|
|
288
|
+
pool_account_id: Decimal | null;
|
|
289
|
+
quote_token: string | null;
|
|
290
|
+
quote_token_decimals: Decimal | null;
|
|
291
|
+
last_funding_velocity: Decimal | null;
|
|
292
|
+
last_funding_timestamp: Decimal | null;
|
|
293
|
+
last_mtm_price: Decimal | null;
|
|
294
|
+
last_mtm_timestamp: Decimal | null;
|
|
295
|
+
long_trackers_funding_value: Decimal | null;
|
|
296
|
+
last_funding_rate: Decimal | null;
|
|
297
|
+
long_trackers_base_multiplier: Decimal | null;
|
|
298
|
+
long_trackers_adl_unwind_price: Decimal | null;
|
|
299
|
+
short_trackers_funding_value: Decimal | null;
|
|
300
|
+
short_trackers_base_multiplier: Decimal | null;
|
|
301
|
+
short_trackers_adl_unwind_price: Decimal | null;
|
|
302
|
+
open_interest: Decimal | null;
|
|
303
|
+
block_timestamp: Decimal | null;
|
|
304
|
+
block_number: Decimal;
|
|
305
|
+
unique_id: bigint | null;
|
|
306
|
+
}>;
|
|
307
|
+
'wallet/:address/positions': TradingApiListEndpoint<
|
|
308
|
+
Position,
|
|
309
|
+
AddressParam,
|
|
310
|
+
'position_raw'
|
|
311
|
+
>;
|
|
312
|
+
'wallet/:address/conditionalOrders': TradingApiListEndpoint<
|
|
313
|
+
ConditionalOrder,
|
|
314
|
+
AddressParam,
|
|
315
|
+
'ConditionalOrders'
|
|
316
|
+
>;
|
|
317
|
+
assets: TradingApiListEndpoint<{
|
|
318
|
+
address: string;
|
|
319
|
+
name: string;
|
|
320
|
+
short: string;
|
|
321
|
+
createdAt: Date;
|
|
322
|
+
updatedAt: Date;
|
|
323
|
+
asset_price_contract_id: string | null;
|
|
324
|
+
asset_price_usdc_contract_id: string | null;
|
|
325
|
+
decimals: number;
|
|
326
|
+
}>;
|
|
327
|
+
prices: TradingApiListEndpoint<Price>;
|
|
328
|
+
'wallet/:address/accounts': TradingApiListEndpoint<
|
|
329
|
+
Account,
|
|
330
|
+
AddressParam,
|
|
331
|
+
'accountProfile'
|
|
332
|
+
>;
|
|
333
|
+
'wallet/:address/accounts/tiers': TradingApiListEndpoint<
|
|
334
|
+
{
|
|
157
335
|
market_id: Decimal;
|
|
158
336
|
account_id: Decimal;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
id: string;
|
|
182
|
-
account_id: Decimal;
|
|
183
|
-
market_id: Decimal;
|
|
184
|
-
order_type: string;
|
|
185
|
-
is_long: boolean;
|
|
186
|
-
trigger_price: number;
|
|
187
|
-
order_base: Decimal;
|
|
188
|
-
exchange_id: bigint;
|
|
189
|
-
inputs: string;
|
|
190
|
-
counterparty_account_id: bigint;
|
|
191
|
-
reya_chain_id: bigint;
|
|
192
|
-
deadline: bigint;
|
|
193
|
-
signer_address: string;
|
|
194
|
-
nonce: Decimal;
|
|
195
|
-
signature: string;
|
|
196
|
-
status: string;
|
|
197
|
-
creation_timestamp_ms: bigint;
|
|
198
|
-
last_update_timestamp_ms: bigint;
|
|
199
|
-
transaction_hash: string | null;
|
|
200
|
-
}[];
|
|
201
|
-
};
|
|
202
|
-
Assets: {
|
|
203
|
-
params: never;
|
|
204
|
-
query: never;
|
|
205
|
-
response: {
|
|
206
|
-
address: string;
|
|
207
|
-
name: string;
|
|
208
|
-
short: string;
|
|
209
|
-
createdAt: Date;
|
|
210
|
-
updatedAt: Date;
|
|
211
|
-
asset_price_contract_id: string | null;
|
|
212
|
-
asset_price_usdc_contract_id: string | null;
|
|
213
|
-
decimals: number;
|
|
214
|
-
}[];
|
|
215
|
-
};
|
|
216
|
-
Prices: {
|
|
217
|
-
params: never;
|
|
218
|
-
query: never;
|
|
219
|
-
response: {
|
|
220
|
-
block_number: Decimal;
|
|
221
|
-
unique_id: bigint | null;
|
|
222
|
-
contract_id: string;
|
|
223
|
-
price: Decimal | null;
|
|
224
|
-
round_id: Decimal | null;
|
|
225
|
-
timestamp: Decimal;
|
|
226
|
-
}[];
|
|
227
|
-
};
|
|
228
|
-
Accounts: {
|
|
229
|
-
params: {
|
|
230
|
-
address: string;
|
|
231
|
-
};
|
|
232
|
-
query: never;
|
|
233
|
-
response: {
|
|
234
|
-
account_id: Decimal;
|
|
235
|
-
name: string;
|
|
236
|
-
status: AccountStatus;
|
|
237
|
-
updated_timestamp_ms: Decimal;
|
|
238
|
-
source: string | null;
|
|
239
|
-
}[];
|
|
240
|
-
};
|
|
241
|
-
AccountsBalances: {
|
|
242
|
-
params: {
|
|
243
|
-
address: string;
|
|
244
|
-
};
|
|
245
|
-
query: never;
|
|
246
|
-
response: {
|
|
247
|
-
account_id: number;
|
|
248
|
-
collateral: string;
|
|
249
|
-
balance: string;
|
|
250
|
-
}[];
|
|
251
|
-
};
|
|
252
|
-
AutoExchange: {
|
|
253
|
-
params: {
|
|
254
|
-
address: string;
|
|
255
|
-
};
|
|
256
|
-
query: PaginatedQueryParams;
|
|
257
|
-
response: {
|
|
258
|
-
data: {
|
|
259
|
-
id: string;
|
|
260
|
-
liquidated_account_id: Decimal | null;
|
|
261
|
-
liquidator_account_id: Decimal | null;
|
|
262
|
-
requested_quote_amount: Decimal | null;
|
|
263
|
-
collateral_out_address: string | null;
|
|
264
|
-
collateral_in_address: string | null;
|
|
265
|
-
collateral_amount_to_liquidator: Decimal | null;
|
|
266
|
-
quote_amount_to_insurance_fund: Decimal | null;
|
|
267
|
-
quote_amount_to_account: Decimal | null;
|
|
268
|
-
block_timestamp: Decimal | null;
|
|
269
|
-
block_number: Decimal;
|
|
270
|
-
transaction_hash: string;
|
|
271
|
-
unique_id: bigint | null;
|
|
272
|
-
}[];
|
|
273
|
-
meta: PaginatedQueryMeta;
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
Swaps: {
|
|
277
|
-
params: {
|
|
278
|
-
address: string;
|
|
279
|
-
};
|
|
280
|
-
query: PaginatedQueryParams;
|
|
281
|
-
response: {
|
|
282
|
-
data: {
|
|
283
|
-
id: string;
|
|
284
|
-
account_id: Decimal;
|
|
285
|
-
token_in: string;
|
|
286
|
-
token_out: string;
|
|
287
|
-
amount_in: Decimal;
|
|
288
|
-
amount_out: Decimal;
|
|
289
|
-
executed_amount_out: Decimal;
|
|
290
|
-
transaction_hash: string;
|
|
291
|
-
block_timestamp: Decimal;
|
|
292
|
-
block_number: Decimal;
|
|
293
|
-
unique_id: bigint | null;
|
|
294
|
-
}[];
|
|
295
|
-
meta: PaginatedQueryMeta;
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
MarketOrders: {
|
|
299
|
-
params: {
|
|
337
|
+
tier_id: Decimal;
|
|
338
|
+
},
|
|
339
|
+
AddressParam
|
|
340
|
+
>;
|
|
341
|
+
'wallet/:address/accounts/balances': TradingApiListEndpoint<
|
|
342
|
+
AccountBalance,
|
|
343
|
+
AddressParam,
|
|
344
|
+
'account_balances'
|
|
345
|
+
>;
|
|
346
|
+
'wallet/:address/autoExchange': TradingApiInfiniteListEndpoint<
|
|
347
|
+
AutoExchange,
|
|
348
|
+
AddressParam,
|
|
349
|
+
'auto_exchange'
|
|
350
|
+
>;
|
|
351
|
+
'wallet/:address/swaps': TradingApiInfiniteListEndpoint<
|
|
352
|
+
Swap,
|
|
353
|
+
AddressParam,
|
|
354
|
+
'swaps'
|
|
355
|
+
>;
|
|
356
|
+
'market/:marketId/orders': TradingApiInfiniteListEndpoint<
|
|
357
|
+
Order,
|
|
358
|
+
{
|
|
300
359
|
marketId: string;
|
|
301
360
|
type?: string;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
};
|
|
309
|
-
AccountOrders: {
|
|
310
|
-
params: {
|
|
361
|
+
},
|
|
362
|
+
'order_history'
|
|
363
|
+
>;
|
|
364
|
+
'account/:accountId/orders': TradingApiInfiniteListEndpoint<
|
|
365
|
+
Order,
|
|
366
|
+
{
|
|
311
367
|
accountId: string;
|
|
312
368
|
type?: string;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
|
-
WalletBalanceHistory: {
|
|
321
|
-
params: {
|
|
322
|
-
address: string;
|
|
323
|
-
timestamp?: string;
|
|
324
|
-
};
|
|
325
|
-
query: never;
|
|
326
|
-
response: {
|
|
369
|
+
},
|
|
370
|
+
'order_history'
|
|
371
|
+
>;
|
|
372
|
+
'wallet/:address/balanceHistory/:timestamp?': TradingApiListEndpoint<
|
|
373
|
+
{
|
|
327
374
|
timestamp: number;
|
|
328
375
|
balance: number;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
address: string;
|
|
379
|
+
timestamp?: string;
|
|
380
|
+
}
|
|
381
|
+
>;
|
|
382
|
+
'wallet/:address/orders/:type?': TradingApiInfiniteListEndpoint<
|
|
383
|
+
Order,
|
|
384
|
+
{
|
|
333
385
|
address: string;
|
|
334
386
|
type?: string;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
RiskMatrices: {
|
|
343
|
-
params: {
|
|
344
|
-
poolId: string;
|
|
345
|
-
};
|
|
346
|
-
query: never;
|
|
347
|
-
response: {
|
|
387
|
+
},
|
|
388
|
+
'order_history'
|
|
389
|
+
>;
|
|
390
|
+
'riskMatrices/:poolId?': TradingApiListEndpoint<
|
|
391
|
+
{
|
|
348
392
|
blockId: Decimal;
|
|
349
393
|
matrix: string[][];
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
AccountsTiers: {
|
|
391
|
-
params: {
|
|
392
|
-
address: string;
|
|
393
|
-
};
|
|
394
|
-
query: never;
|
|
395
|
-
response: {
|
|
396
|
-
market_id: Decimal;
|
|
397
|
-
account_id: Decimal;
|
|
398
|
-
tier_id: Decimal;
|
|
399
|
-
}[];
|
|
400
|
-
};
|
|
401
|
-
CollateralConfiguration: {
|
|
402
|
-
params: never;
|
|
403
|
-
query: never;
|
|
404
|
-
response: {
|
|
405
|
-
collateral_pool_id: Decimal;
|
|
406
|
-
collateral_address: string;
|
|
407
|
-
price_haircut: Decimal | null;
|
|
408
|
-
auto_exchange_discount: Decimal | null;
|
|
409
|
-
oracle_node_id: string | null;
|
|
410
|
-
block_timestamp: Decimal | null;
|
|
411
|
-
block_number: Decimal;
|
|
412
|
-
unique_id: bigint | null;
|
|
413
|
-
}[];
|
|
414
|
-
};
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
poolId: string;
|
|
397
|
+
}
|
|
398
|
+
>;
|
|
399
|
+
markets: TradingApiListEndpoint<Market>;
|
|
400
|
+
tierFees: TradingApiListEndpoint<{
|
|
401
|
+
market_id: Decimal;
|
|
402
|
+
tier_id: Decimal;
|
|
403
|
+
fee_parameter: Decimal | null;
|
|
404
|
+
}>;
|
|
405
|
+
collateralConfiguration: TradingApiListEndpoint<{
|
|
406
|
+
collateral_pool_id: Decimal;
|
|
407
|
+
collateral_address: string;
|
|
408
|
+
price_haircut: Decimal | null;
|
|
409
|
+
auto_exchange_discount: Decimal | null;
|
|
410
|
+
oracle_node_id: string | null;
|
|
411
|
+
block_timestamp: Decimal | null;
|
|
412
|
+
block_number: Decimal;
|
|
413
|
+
unique_id: bigint | null;
|
|
414
|
+
}>;
|
|
415
|
+
candles: TradingApiEndpoint<
|
|
416
|
+
{
|
|
417
|
+
t: number[];
|
|
418
|
+
o: number[];
|
|
419
|
+
h: number[];
|
|
420
|
+
l: number[];
|
|
421
|
+
c: number[];
|
|
422
|
+
},
|
|
423
|
+
never,
|
|
424
|
+
never,
|
|
425
|
+
never,
|
|
426
|
+
{
|
|
427
|
+
from: number;
|
|
428
|
+
to: number;
|
|
429
|
+
resolution: 1 | 5 | 15 | 30 | 60 | 240 | '1D';
|
|
430
|
+
symbol: string;
|
|
431
|
+
}
|
|
432
|
+
>;
|
|
415
433
|
};
|
|
416
434
|
|
|
417
435
|
export type Stringified<T, D = Decimal> = T extends D | bigint | Date
|
|
@@ -448,5 +466,60 @@ export type TradingApi = {
|
|
|
448
466
|
params: TradingApiSource[K]['params'];
|
|
449
467
|
query: TradingApiSource[K]['query'];
|
|
450
468
|
response: Stringified<TradingApiSource[K]['response']>;
|
|
469
|
+
replication: Stringified<TradingApiSource[K]['replication']>;
|
|
451
470
|
};
|
|
452
471
|
};
|
|
472
|
+
|
|
473
|
+
type ReplicationModel = string | never;
|
|
474
|
+
|
|
475
|
+
export type GenericReplicationMessage<T, model extends ReplicationModel> =
|
|
476
|
+
| {
|
|
477
|
+
model: model;
|
|
478
|
+
result: T;
|
|
479
|
+
operation: 'create' | 'update' | 'upsert' | 'delete';
|
|
480
|
+
}
|
|
481
|
+
| {
|
|
482
|
+
model: model;
|
|
483
|
+
result: T[];
|
|
484
|
+
operation: 'updateMany';
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
type account_collateral_balance_entries = {
|
|
488
|
+
id: string;
|
|
489
|
+
account_id: Decimal | null;
|
|
490
|
+
collateral: string | null;
|
|
491
|
+
amount: Decimal | null;
|
|
492
|
+
transaction_hash: string;
|
|
493
|
+
block_timestamp: Decimal | null;
|
|
494
|
+
block_number: Decimal;
|
|
495
|
+
unique_id: bigint | null;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
type account_owner_updated_snapshot = {
|
|
499
|
+
account_id: Decimal;
|
|
500
|
+
transaction_hash: string;
|
|
501
|
+
new_owner: string | null;
|
|
502
|
+
block_timestamp: Decimal | null;
|
|
503
|
+
block_number: Decimal;
|
|
504
|
+
unique_id: bigint | null;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export type ReplicationMessage =
|
|
508
|
+
| GenericReplicationMessage<Order, 'order_history'>
|
|
509
|
+
| GenericReplicationMessage<ConditionalOrder, 'ConditionalOrders'>
|
|
510
|
+
| GenericReplicationMessage<Swap, 'swaps'>
|
|
511
|
+
| GenericReplicationMessage<AutoExchange, 'auto_exchange'>
|
|
512
|
+
| GenericReplicationMessage<Position, 'position_raw'>
|
|
513
|
+
| GenericReplicationMessage<Price, 'asset_price'>
|
|
514
|
+
| GenericReplicationMessage<Account, 'accountProfile'>
|
|
515
|
+
| GenericReplicationMessage<Leverage, 'accountLeveragePerMarket'>
|
|
516
|
+
| GenericReplicationMessage<
|
|
517
|
+
account_owner_updated_snapshot,
|
|
518
|
+
'account_owner_updated_snapshot'
|
|
519
|
+
>
|
|
520
|
+
| GenericReplicationMessage<
|
|
521
|
+
account_collateral_balance_entries,
|
|
522
|
+
'account_collateral_balance_entries'
|
|
523
|
+
>
|
|
524
|
+
| GenericReplicationMessage<AccountBalance, 'account_balances'>
|
|
525
|
+
| GenericReplicationMessage<Market, 'Market'>;
|