@injectivelabs/indexer-proto-ts-v2 1.0.0

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 (79) hide show
  1. package/generated/event_provider_api_pb.client.d.ts +156 -0
  2. package/generated/event_provider_api_pb.client.js +76 -0
  3. package/generated/event_provider_api_pb.d.ts +1980 -0
  4. package/generated/event_provider_api_pb.js +1776 -0
  5. package/generated/health_pb.client.d.ts +53 -0
  6. package/generated/health_pb.client.js +22 -0
  7. package/generated/health_pb.d.ts +309 -0
  8. package/generated/health_pb.js +265 -0
  9. package/generated/injective_accounts_rpc_pb.client.d.ts +211 -0
  10. package/generated/injective_accounts_rpc_pb.client.js +105 -0
  11. package/generated/injective_accounts_rpc_pb.d.ts +5307 -0
  12. package/generated/injective_accounts_rpc_pb.js +4784 -0
  13. package/generated/injective_archiver_rpc_pb.client.d.ts +224 -0
  14. package/generated/injective_archiver_rpc_pb.client.js +112 -0
  15. package/generated/injective_archiver_rpc_pb.d.ts +2944 -0
  16. package/generated/injective_archiver_rpc_pb.js +2603 -0
  17. package/generated/injective_auction_rpc_pb.client.d.ts +190 -0
  18. package/generated/injective_auction_rpc_pb.client.js +94 -0
  19. package/generated/injective_auction_rpc_pb.d.ts +2131 -0
  20. package/generated/injective_auction_rpc_pb.js +1917 -0
  21. package/generated/injective_campaign_rpc_pb.client.d.ts +138 -0
  22. package/generated/injective_campaign_rpc_pb.client.js +67 -0
  23. package/generated/injective_campaign_rpc_pb.d.ts +2766 -0
  24. package/generated/injective_campaign_rpc_pb.js +2542 -0
  25. package/generated/injective_chart_rpc_pb.client.d.ts +159 -0
  26. package/generated/injective_chart_rpc_pb.client.js +78 -0
  27. package/generated/injective_chart_rpc_pb.d.ts +1840 -0
  28. package/generated/injective_chart_rpc_pb.js +1690 -0
  29. package/generated/injective_derivative_exchange_rpc_pb.client.d.ts +504 -0
  30. package/generated/injective_derivative_exchange_rpc_pb.client.js +259 -0
  31. package/generated/injective_derivative_exchange_rpc_pb.d.ts +9214 -0
  32. package/generated/injective_derivative_exchange_rpc_pb.js +8407 -0
  33. package/generated/injective_exchange_rpc_pb.client.d.ts +155 -0
  34. package/generated/injective_exchange_rpc_pb.client.js +76 -0
  35. package/generated/injective_exchange_rpc_pb.d.ts +1925 -0
  36. package/generated/injective_exchange_rpc_pb.js +1740 -0
  37. package/generated/injective_explorer_rpc_pb.client.d.ts +495 -0
  38. package/generated/injective_explorer_rpc_pb.client.js +255 -0
  39. package/generated/injective_explorer_rpc_pb.d.ts +9394 -0
  40. package/generated/injective_explorer_rpc_pb.js +8921 -0
  41. package/generated/injective_insurance_rpc_pb.client.d.ts +87 -0
  42. package/generated/injective_insurance_rpc_pb.client.js +40 -0
  43. package/generated/injective_insurance_rpc_pb.d.ts +904 -0
  44. package/generated/injective_insurance_rpc_pb.js +807 -0
  45. package/generated/injective_megavault_rpc_pb.client.d.ts +155 -0
  46. package/generated/injective_megavault_rpc_pb.client.js +76 -0
  47. package/generated/injective_megavault_rpc_pb.d.ts +3408 -0
  48. package/generated/injective_megavault_rpc_pb.js +3019 -0
  49. package/generated/injective_meta_rpc_pb.client.d.ts +124 -0
  50. package/generated/injective_meta_rpc_pb.client.js +59 -0
  51. package/generated/injective_meta_rpc_pb.d.ts +825 -0
  52. package/generated/injective_meta_rpc_pb.js +716 -0
  53. package/generated/injective_oracle_rpc_pb.client.d.ts +124 -0
  54. package/generated/injective_oracle_rpc_pb.client.js +59 -0
  55. package/generated/injective_oracle_rpc_pb.d.ts +1117 -0
  56. package/generated/injective_oracle_rpc_pb.js +987 -0
  57. package/generated/injective_portfolio_rpc_pb.client.d.ts +105 -0
  58. package/generated/injective_portfolio_rpc_pb.client.js +49 -0
  59. package/generated/injective_portfolio_rpc_pb.d.ts +1492 -0
  60. package/generated/injective_portfolio_rpc_pb.js +1314 -0
  61. package/generated/injective_referral_rpc_pb.client.d.ts +89 -0
  62. package/generated/injective_referral_rpc_pb.client.js +41 -0
  63. package/generated/injective_referral_rpc_pb.d.ts +575 -0
  64. package/generated/injective_referral_rpc_pb.js +497 -0
  65. package/generated/injective_rfqrpc_pb.client.d.ts +208 -0
  66. package/generated/injective_rfqrpc_pb.client.js +103 -0
  67. package/generated/injective_rfqrpc_pb.d.ts +2241 -0
  68. package/generated/injective_rfqrpc_pb.js +1940 -0
  69. package/generated/injective_spot_exchange_rpc_pb.client.d.ts +343 -0
  70. package/generated/injective_spot_exchange_rpc_pb.client.js +175 -0
  71. package/generated/injective_spot_exchange_rpc_pb.d.ts +5958 -0
  72. package/generated/injective_spot_exchange_rpc_pb.js +5426 -0
  73. package/generated/injective_trading_rpc_pb.client.d.ts +90 -0
  74. package/generated/injective_trading_rpc_pb.client.js +40 -0
  75. package/generated/injective_trading_rpc_pb.d.ts +1882 -0
  76. package/generated/injective_trading_rpc_pb.js +1754 -0
  77. package/index.d.ts +43 -0
  78. package/index.js +78 -0
  79. package/package.json +37 -0
@@ -0,0 +1,1882 @@
1
+ // @generated by protobuf-ts 2.11.1 with parameter add_pb_suffix
2
+ // @generated from protobuf file "injective_trading_rpc.proto" (package "injective_trading_rpc", syntax proto3)
3
+ // tslint:disable
4
+ //
5
+ // Code generated with goa v3.7.0, DO NOT EDIT.
6
+ //
7
+ // InjectiveTradingRPC protocol buffer definition
8
+ //
9
+ // Command:
10
+ // $ goa gen github.com/InjectiveLabs/injective-indexer/api/design -o ../
11
+ //
12
+ import { ServiceType } from "@protobuf-ts/runtime-rpc";
13
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
14
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
15
+ import { WireType } from "@protobuf-ts/runtime";
16
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
17
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
18
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
19
+ import type { PartialMessage } from "@protobuf-ts/runtime";
20
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
21
+ import { MessageType } from "@protobuf-ts/runtime";
22
+ /**
23
+ * @generated from protobuf message injective_trading_rpc.ListTradingStrategiesRequest
24
+ */
25
+ export interface ListTradingStrategiesRequest {
26
+ /**
27
+ * @generated from protobuf field: string state = 1
28
+ */
29
+ state: string;
30
+ /**
31
+ * MarketId of the trading strategy
32
+ *
33
+ * @generated from protobuf field: string market_id = 2
34
+ */
35
+ marketId: string;
36
+ /**
37
+ * subaccount ID to filter by
38
+ *
39
+ * @generated from protobuf field: string subaccount_id = 3
40
+ */
41
+ subaccountId: string;
42
+ /**
43
+ * Account address
44
+ *
45
+ * @generated from protobuf field: string account_address = 4
46
+ */
47
+ accountAddress: string;
48
+ /**
49
+ * Indicates whether the trading strategy is pending execution
50
+ *
51
+ * @generated from protobuf field: bool pending_execution = 5
52
+ */
53
+ pendingExecution: boolean;
54
+ /**
55
+ * The starting timestamp in UNIX milliseconds for the creation time of the
56
+ * trading strategy
57
+ *
58
+ * @generated from protobuf field: sint64 start_time = 6
59
+ */
60
+ startTime: bigint;
61
+ /**
62
+ * The ending timestamp in UNIX milliseconds for the creation time of the
63
+ * trading strategy
64
+ *
65
+ * @generated from protobuf field: sint64 end_time = 7
66
+ */
67
+ endTime: bigint;
68
+ /**
69
+ * @generated from protobuf field: sint32 limit = 8
70
+ */
71
+ limit: number;
72
+ /**
73
+ * @generated from protobuf field: uint64 skip = 9
74
+ */
75
+ skip: bigint;
76
+ /**
77
+ * Filter by strategy type
78
+ *
79
+ * @generated from protobuf field: repeated string strategy_type = 10
80
+ */
81
+ strategyType: string[];
82
+ /**
83
+ * Filter by market type
84
+ *
85
+ * @generated from protobuf field: string market_type = 11
86
+ */
87
+ marketType: string;
88
+ /**
89
+ * The last executed timestamp in UNIX milliseconds for the last executed time
90
+ * of the trading strategy
91
+ *
92
+ * @generated from protobuf field: sint64 last_executed_time = 12
93
+ */
94
+ lastExecutedTime: bigint;
95
+ /**
96
+ * Include TVL in the response
97
+ *
98
+ * @generated from protobuf field: bool with_tvl = 13
99
+ */
100
+ withTvl: boolean;
101
+ /**
102
+ * Indicates whether the trading strategy is a trailing strategy
103
+ *
104
+ * @generated from protobuf field: bool is_trailing_strategy = 14
105
+ */
106
+ isTrailingStrategy: boolean;
107
+ /**
108
+ * Indicates whether the trading strategy performance should be included in the
109
+ * response
110
+ *
111
+ * @generated from protobuf field: bool with_performance = 15
112
+ */
113
+ withPerformance: boolean;
114
+ }
115
+ /**
116
+ * @generated from protobuf message injective_trading_rpc.ListTradingStrategiesResponse
117
+ */
118
+ export interface ListTradingStrategiesResponse {
119
+ /**
120
+ * The trading strategies
121
+ *
122
+ * @generated from protobuf field: repeated injective_trading_rpc.TradingStrategy strategies = 1
123
+ */
124
+ strategies: TradingStrategy[];
125
+ /**
126
+ * @generated from protobuf field: injective_trading_rpc.Paging paging = 2
127
+ */
128
+ paging?: Paging;
129
+ }
130
+ /**
131
+ * @generated from protobuf message injective_trading_rpc.TradingStrategy
132
+ */
133
+ export interface TradingStrategy {
134
+ /**
135
+ * @generated from protobuf field: string state = 1
136
+ */
137
+ state: string;
138
+ /**
139
+ * MarketId of the trading strategy
140
+ *
141
+ * @generated from protobuf field: string market_id = 2
142
+ */
143
+ marketId: string;
144
+ /**
145
+ * subaccount ID of the trading strategy
146
+ *
147
+ * @generated from protobuf field: string subaccount_id = 3
148
+ */
149
+ subaccountId: string;
150
+ /**
151
+ * Account address
152
+ *
153
+ * @generated from protobuf field: string account_address = 4
154
+ */
155
+ accountAddress: string;
156
+ /**
157
+ * Contract address
158
+ *
159
+ * @generated from protobuf field: string contract_address = 5
160
+ */
161
+ contractAddress: string;
162
+ /**
163
+ * Execution price of the trading strategy
164
+ *
165
+ * @generated from protobuf field: string execution_price = 6
166
+ */
167
+ executionPrice: string;
168
+ /**
169
+ * Base quantity of the trading strategy
170
+ *
171
+ * @generated from protobuf field: string base_quantity = 7
172
+ */
173
+ baseQuantity: string;
174
+ /**
175
+ * Quote quantity of the trading strategy
176
+ *
177
+ * @generated from protobuf field: string quote_quantity = 20
178
+ */
179
+ quoteQuantity: string;
180
+ /**
181
+ * Lower bound of the trading strategy
182
+ *
183
+ * @generated from protobuf field: string lower_bound = 8
184
+ */
185
+ lowerBound: string;
186
+ /**
187
+ * Upper bound of the trading strategy
188
+ *
189
+ * @generated from protobuf field: string upper_bound = 9
190
+ */
191
+ upperBound: string;
192
+ /**
193
+ * Stop loss limit of the trading strategy
194
+ *
195
+ * @generated from protobuf field: string stop_loss = 10
196
+ */
197
+ stopLoss: string;
198
+ /**
199
+ * Take profit limit of the trading strategy
200
+ *
201
+ * @generated from protobuf field: string take_profit = 11
202
+ */
203
+ takeProfit: string;
204
+ /**
205
+ * Swap fee of the trading strategy
206
+ *
207
+ * @generated from protobuf field: string swap_fee = 12
208
+ */
209
+ swapFee: string;
210
+ /**
211
+ * Base deposit at the time of closing the trading strategy
212
+ *
213
+ * @generated from protobuf field: string base_deposit = 17
214
+ */
215
+ baseDeposit: string;
216
+ /**
217
+ * Quote deposit at the time of closing the trading strategy
218
+ *
219
+ * @generated from protobuf field: string quote_deposit = 18
220
+ */
221
+ quoteDeposit: string;
222
+ /**
223
+ * Market mid price at the time of closing the trading strategy
224
+ *
225
+ * @generated from protobuf field: string market_mid_price = 19
226
+ */
227
+ marketMidPrice: string;
228
+ /**
229
+ * Subscription quote quantity of the trading strategy
230
+ *
231
+ * @generated from protobuf field: string subscription_quote_quantity = 21
232
+ */
233
+ subscriptionQuoteQuantity: string;
234
+ /**
235
+ * Subscription base quantity of the trading strategy
236
+ *
237
+ * @generated from protobuf field: string subscription_base_quantity = 22
238
+ */
239
+ subscriptionBaseQuantity: string;
240
+ /**
241
+ * Number of grid levels of the trading strategy
242
+ *
243
+ * @generated from protobuf field: string number_of_grid_levels = 23
244
+ */
245
+ numberOfGridLevels: string;
246
+ /**
247
+ * Indicates whether the trading strategy should exit with quote only
248
+ *
249
+ * @generated from protobuf field: bool should_exit_with_quote_only = 24
250
+ */
251
+ shouldExitWithQuoteOnly: boolean;
252
+ /**
253
+ * Indicates the reason for stopping the trading strategy
254
+ *
255
+ * @generated from protobuf field: string stop_reason = 25
256
+ */
257
+ stopReason: string;
258
+ /**
259
+ * Indicates whether the trading strategy is pending execution
260
+ *
261
+ * @generated from protobuf field: bool pending_execution = 26
262
+ */
263
+ pendingExecution: boolean;
264
+ /**
265
+ * Block height when the strategy was created.
266
+ *
267
+ * @generated from protobuf field: sint64 created_height = 13
268
+ */
269
+ createdHeight: bigint;
270
+ /**
271
+ * Block height when the strategy was removed.
272
+ *
273
+ * @generated from protobuf field: sint64 removed_height = 14
274
+ */
275
+ removedHeight: bigint;
276
+ /**
277
+ * UpdatedAt timestamp in UNIX millis.
278
+ *
279
+ * @generated from protobuf field: sint64 created_at = 15
280
+ */
281
+ createdAt: bigint;
282
+ /**
283
+ * UpdatedAt timestamp in UNIX millis.
284
+ *
285
+ * @generated from protobuf field: sint64 updated_at = 16
286
+ */
287
+ updatedAt: bigint;
288
+ /**
289
+ * Indicate how bot will convert funds (into base or quote or keep as is) after
290
+ * strategy ended
291
+ *
292
+ * @generated from protobuf field: string exit_type = 27
293
+ */
294
+ exitType: string;
295
+ /**
296
+ * Exit config for stop loss
297
+ *
298
+ * @generated from protobuf field: injective_trading_rpc.ExitConfig stop_loss_config = 28
299
+ */
300
+ stopLossConfig?: ExitConfig;
301
+ /**
302
+ * Exit config for take profit
303
+ *
304
+ * @generated from protobuf field: injective_trading_rpc.ExitConfig take_profit_config = 29
305
+ */
306
+ takeProfitConfig?: ExitConfig;
307
+ /**
308
+ * Strategy type: arithmetic, geometric...
309
+ *
310
+ * @generated from protobuf field: string strategy_type = 30
311
+ */
312
+ strategyType: string;
313
+ /**
314
+ * Version of the contract
315
+ *
316
+ * @generated from protobuf field: string contract_version = 31
317
+ */
318
+ contractVersion: string;
319
+ /**
320
+ * Name of the contract
321
+ *
322
+ * @generated from protobuf field: string contract_name = 32
323
+ */
324
+ contractName: string;
325
+ /**
326
+ * Type of the market
327
+ *
328
+ * @generated from protobuf field: string market_type = 33
329
+ */
330
+ marketType: string;
331
+ /**
332
+ * lastExecutedAt timestamp in UNIX millis.
333
+ *
334
+ * @generated from protobuf field: sint64 last_executed_at = 34
335
+ */
336
+ lastExecutedAt: bigint;
337
+ /**
338
+ * trailing up price
339
+ *
340
+ * @generated from protobuf field: string trail_up_price = 35
341
+ */
342
+ trailUpPrice: string;
343
+ /**
344
+ * trailing down price
345
+ *
346
+ * @generated from protobuf field: string trail_down_price = 36
347
+ */
348
+ trailDownPrice: string;
349
+ /**
350
+ * trailing up counter
351
+ *
352
+ * @generated from protobuf field: sint64 trail_up_counter = 37
353
+ */
354
+ trailUpCounter: bigint;
355
+ /**
356
+ * trailing down counter
357
+ *
358
+ * @generated from protobuf field: sint64 trail_down_counter = 38
359
+ */
360
+ trailDownCounter: bigint;
361
+ /**
362
+ * TVL of the trading strategy
363
+ *
364
+ * @generated from protobuf field: string tvl = 39
365
+ */
366
+ tvl: string;
367
+ /**
368
+ * PnL of the trading strategy
369
+ *
370
+ * @generated from protobuf field: string pnl = 40
371
+ */
372
+ pnl: string;
373
+ /**
374
+ * PnL percentage of the trading strategy
375
+ *
376
+ * @generated from protobuf field: string pnl_perc = 41
377
+ */
378
+ pnlPerc: string;
379
+ /**
380
+ * pnlUpdatedAt timestamp in UNIX millis.
381
+ *
382
+ * @generated from protobuf field: sint64 pnl_updated_at = 42
383
+ */
384
+ pnlUpdatedAt: bigint;
385
+ /**
386
+ * Indicates the performance of the trading strategy
387
+ *
388
+ * @generated from protobuf field: string performance = 43
389
+ */
390
+ performance: string;
391
+ /**
392
+ * Return on investment of the trading strategy
393
+ *
394
+ * @generated from protobuf field: string roi = 44
395
+ */
396
+ roi: string;
397
+ /**
398
+ * Initial base price of the trading strategy from asset price service
399
+ * Use strategyFinalData if available to have more accurate data
400
+ *
401
+ * @generated from protobuf field: string initial_base_price = 45
402
+ */
403
+ initialBasePrice: string;
404
+ /**
405
+ * Initial quote price of the trading strategy from asset price service
406
+ * Use strategyFinalData if available to have more accurate data
407
+ *
408
+ * @generated from protobuf field: string initial_quote_price = 46
409
+ */
410
+ initialQuotePrice: string;
411
+ /**
412
+ * Current base price of the trading strategy from asset price service
413
+ * Use strategyFinalData if available to have more accurate data
414
+ *
415
+ * @generated from protobuf field: string current_base_price = 47
416
+ */
417
+ currentBasePrice: string;
418
+ /**
419
+ * Current quote price of the trading strategy from asset price service
420
+ * Use strategyFinalData if available to have more accurate data
421
+ *
422
+ * @generated from protobuf field: string current_quote_price = 48
423
+ */
424
+ currentQuotePrice: string;
425
+ /**
426
+ * Final base price of the trading strategy from asset price service
427
+ * Use strategyFinalData if available to have more accurate data
428
+ *
429
+ * @generated from protobuf field: string final_base_price = 49
430
+ */
431
+ finalBasePrice: string;
432
+ /**
433
+ * Final quote price of the trading strategy from asset price service
434
+ * Use strategyFinalData if available to have more accurate data
435
+ *
436
+ * @generated from protobuf field: string final_quote_price = 50
437
+ */
438
+ finalQuotePrice: string;
439
+ /**
440
+ * Final data of the trading strategy. This is present from contract v0.8.4.
441
+ *
442
+ * @generated from protobuf field: injective_trading_rpc.StrategyFinalData final_data = 51
443
+ */
444
+ finalData?: StrategyFinalData;
445
+ /**
446
+ * Margin ratio of the trading strategy
447
+ *
448
+ * @generated from protobuf field: string margin_ratio = 52
449
+ */
450
+ marginRatio: string;
451
+ /**
452
+ * Lower trailing bound of the trading strategy
453
+ *
454
+ * @generated from protobuf field: string lower_trailing_bound = 53
455
+ */
456
+ lowerTrailingBound: string;
457
+ /**
458
+ * Upper trailing bound of the trading strategy
459
+ *
460
+ * @generated from protobuf field: string upper_trailing_bound = 54
461
+ */
462
+ upperTrailingBound: string;
463
+ /**
464
+ * New upper bound of the trading strategy
465
+ *
466
+ * @generated from protobuf field: string new_upper_bound = 55
467
+ */
468
+ newUpperBound: string;
469
+ /**
470
+ * New lower bound of the trading strategy
471
+ *
472
+ * @generated from protobuf field: string new_lower_bound = 56
473
+ */
474
+ newLowerBound: string;
475
+ }
476
+ /**
477
+ * @generated from protobuf message injective_trading_rpc.ExitConfig
478
+ */
479
+ export interface ExitConfig {
480
+ /**
481
+ * strategy exit type (stopLoss/takeProfit)
482
+ *
483
+ * @generated from protobuf field: string exit_type = 1
484
+ */
485
+ exitType: string;
486
+ /**
487
+ * strategy stopLoss/takeProfit price
488
+ *
489
+ * @generated from protobuf field: string exit_price = 2
490
+ */
491
+ exitPrice: string;
492
+ }
493
+ /**
494
+ * @generated from protobuf message injective_trading_rpc.StrategyFinalData
495
+ */
496
+ export interface StrategyFinalData {
497
+ /**
498
+ * Initial base amount
499
+ *
500
+ * @generated from protobuf field: string initial_base_amount = 1
501
+ */
502
+ initialBaseAmount: string;
503
+ /**
504
+ * Initial quote amount
505
+ *
506
+ * @generated from protobuf field: string initial_quote_amount = 2
507
+ */
508
+ initialQuoteAmount: string;
509
+ /**
510
+ * Final base amount
511
+ *
512
+ * @generated from protobuf field: string final_base_amount = 3
513
+ */
514
+ finalBaseAmount: string;
515
+ /**
516
+ * Final quote amount
517
+ *
518
+ * @generated from protobuf field: string final_quote_amount = 4
519
+ */
520
+ finalQuoteAmount: string;
521
+ /**
522
+ * Initial base price
523
+ *
524
+ * @generated from protobuf field: string initial_base_price = 5
525
+ */
526
+ initialBasePrice: string;
527
+ /**
528
+ * Initial quote price
529
+ *
530
+ * @generated from protobuf field: string initial_quote_price = 6
531
+ */
532
+ initialQuotePrice: string;
533
+ /**
534
+ * Final base price
535
+ *
536
+ * @generated from protobuf field: string final_base_price = 7
537
+ */
538
+ finalBasePrice: string;
539
+ /**
540
+ * Final quote price
541
+ *
542
+ * @generated from protobuf field: string final_quote_price = 8
543
+ */
544
+ finalQuotePrice: string;
545
+ }
546
+ /**
547
+ * Paging defines the structure for required params for handling pagination
548
+ *
549
+ * @generated from protobuf message injective_trading_rpc.Paging
550
+ */
551
+ export interface Paging {
552
+ /**
553
+ * total number of txs saved in database
554
+ *
555
+ * @generated from protobuf field: sint64 total = 1
556
+ */
557
+ total: bigint;
558
+ /**
559
+ * can be either block height or index num
560
+ *
561
+ * @generated from protobuf field: sint32 from = 2
562
+ */
563
+ from: number;
564
+ /**
565
+ * can be either block height or index num
566
+ *
567
+ * @generated from protobuf field: sint32 to = 3
568
+ */
569
+ to: number;
570
+ /**
571
+ * count entries by subaccount, serving some places on helix
572
+ *
573
+ * @generated from protobuf field: sint64 count_by_subaccount = 4
574
+ */
575
+ countBySubaccount: bigint;
576
+ /**
577
+ * array of tokens to navigate to the next pages
578
+ *
579
+ * @generated from protobuf field: repeated string next = 5
580
+ */
581
+ next: string[];
582
+ }
583
+ /**
584
+ * @generated from protobuf message injective_trading_rpc.GetTradingStatsRequest
585
+ */
586
+ export interface GetTradingStatsRequest {
587
+ }
588
+ /**
589
+ * @generated from protobuf message injective_trading_rpc.GetTradingStatsResponse
590
+ */
591
+ export interface GetTradingStatsResponse {
592
+ /**
593
+ * Total of unique active trading strategies
594
+ *
595
+ * @generated from protobuf field: uint64 active_trading_strategies = 1
596
+ */
597
+ activeTradingStrategies: bigint;
598
+ /**
599
+ * Total number of created trading strategies
600
+ *
601
+ * @generated from protobuf field: uint64 total_trading_strategies_created = 2
602
+ */
603
+ totalTradingStrategiesCreated: bigint;
604
+ /**
605
+ * Total TVL of all active trading strategies
606
+ *
607
+ * @generated from protobuf field: string total_tvl = 3
608
+ */
609
+ totalTvl: string;
610
+ /**
611
+ * Market stats
612
+ *
613
+ * @generated from protobuf field: repeated injective_trading_rpc.Market markets = 4
614
+ */
615
+ markets: Market[];
616
+ }
617
+ /**
618
+ * @generated from protobuf message injective_trading_rpc.Market
619
+ */
620
+ export interface Market {
621
+ /**
622
+ * MarketId of the trading strategy
623
+ *
624
+ * @generated from protobuf field: string market_id = 1
625
+ */
626
+ marketId: string;
627
+ /**
628
+ * Total of unique active trading strategies
629
+ *
630
+ * @generated from protobuf field: uint64 active_trading_strategies = 2
631
+ */
632
+ activeTradingStrategies: bigint;
633
+ }
634
+ /**
635
+ * @generated from protobuf message injective_trading_rpc.StreamStrategyRequest
636
+ */
637
+ export interface StreamStrategyRequest {
638
+ /**
639
+ * Account addresses
640
+ *
641
+ * @generated from protobuf field: repeated string account_addresses = 1
642
+ */
643
+ accountAddresses: string[];
644
+ /**
645
+ * MarketId of the trading strategy
646
+ *
647
+ * @generated from protobuf field: string market_id = 2
648
+ */
649
+ marketId: string;
650
+ }
651
+ /**
652
+ * @generated from protobuf message injective_trading_rpc.StreamStrategyResponse
653
+ */
654
+ export interface StreamStrategyResponse {
655
+ /**
656
+ * The trading strategy
657
+ *
658
+ * @generated from protobuf field: injective_trading_rpc.TradingStrategy trading_strategy = 1
659
+ */
660
+ tradingStrategy?: TradingStrategy;
661
+ /**
662
+ * Timestamp in UNIX millis
663
+ *
664
+ * @generated from protobuf field: sint64 timestamp = 2
665
+ */
666
+ timestamp: bigint;
667
+ }
668
+ // @generated message type with reflection information, may provide speed optimized methods
669
+ class ListTradingStrategiesRequest$Type extends MessageType<ListTradingStrategiesRequest> {
670
+ constructor() {
671
+ super("injective_trading_rpc.ListTradingStrategiesRequest", [
672
+ { no: 1, name: "state", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
673
+ { no: 2, name: "market_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
674
+ { no: 3, name: "subaccount_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
675
+ { no: 4, name: "account_address", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
676
+ { no: 5, name: "pending_execution", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
677
+ { no: 6, name: "start_time", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
678
+ { no: 7, name: "end_time", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
679
+ { no: 8, name: "limit", kind: "scalar", T: 17 /*ScalarType.SINT32*/ },
680
+ { no: 9, name: "skip", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
681
+ { no: 10, name: "strategy_type", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
682
+ { no: 11, name: "market_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
683
+ { no: 12, name: "last_executed_time", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
684
+ { no: 13, name: "with_tvl", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
685
+ { no: 14, name: "is_trailing_strategy", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
686
+ { no: 15, name: "with_performance", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
687
+ ]);
688
+ }
689
+ create(value?: PartialMessage<ListTradingStrategiesRequest>): ListTradingStrategiesRequest {
690
+ const message = globalThis.Object.create((this.messagePrototype!));
691
+ message.state = "";
692
+ message.marketId = "";
693
+ message.subaccountId = "";
694
+ message.accountAddress = "";
695
+ message.pendingExecution = false;
696
+ message.startTime = 0n;
697
+ message.endTime = 0n;
698
+ message.limit = 0;
699
+ message.skip = 0n;
700
+ message.strategyType = [];
701
+ message.marketType = "";
702
+ message.lastExecutedTime = 0n;
703
+ message.withTvl = false;
704
+ message.isTrailingStrategy = false;
705
+ message.withPerformance = false;
706
+ if (value !== undefined)
707
+ reflectionMergePartial<ListTradingStrategiesRequest>(this, message, value);
708
+ return message;
709
+ }
710
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListTradingStrategiesRequest): ListTradingStrategiesRequest {
711
+ let message = target ?? this.create(), end = reader.pos + length;
712
+ while (reader.pos < end) {
713
+ let [fieldNo, wireType] = reader.tag();
714
+ switch (fieldNo) {
715
+ case /* string state */ 1:
716
+ message.state = reader.string();
717
+ break;
718
+ case /* string market_id */ 2:
719
+ message.marketId = reader.string();
720
+ break;
721
+ case /* string subaccount_id */ 3:
722
+ message.subaccountId = reader.string();
723
+ break;
724
+ case /* string account_address */ 4:
725
+ message.accountAddress = reader.string();
726
+ break;
727
+ case /* bool pending_execution */ 5:
728
+ message.pendingExecution = reader.bool();
729
+ break;
730
+ case /* sint64 start_time */ 6:
731
+ message.startTime = reader.sint64().toBigInt();
732
+ break;
733
+ case /* sint64 end_time */ 7:
734
+ message.endTime = reader.sint64().toBigInt();
735
+ break;
736
+ case /* sint32 limit */ 8:
737
+ message.limit = reader.sint32();
738
+ break;
739
+ case /* uint64 skip */ 9:
740
+ message.skip = reader.uint64().toBigInt();
741
+ break;
742
+ case /* repeated string strategy_type */ 10:
743
+ message.strategyType.push(reader.string());
744
+ break;
745
+ case /* string market_type */ 11:
746
+ message.marketType = reader.string();
747
+ break;
748
+ case /* sint64 last_executed_time */ 12:
749
+ message.lastExecutedTime = reader.sint64().toBigInt();
750
+ break;
751
+ case /* bool with_tvl */ 13:
752
+ message.withTvl = reader.bool();
753
+ break;
754
+ case /* bool is_trailing_strategy */ 14:
755
+ message.isTrailingStrategy = reader.bool();
756
+ break;
757
+ case /* bool with_performance */ 15:
758
+ message.withPerformance = reader.bool();
759
+ break;
760
+ default:
761
+ let u = options.readUnknownField;
762
+ if (u === "throw")
763
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
764
+ let d = reader.skip(wireType);
765
+ if (u !== false)
766
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
767
+ }
768
+ }
769
+ return message;
770
+ }
771
+ internalBinaryWrite(message: ListTradingStrategiesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
772
+ /* string state = 1; */
773
+ if (message.state !== "")
774
+ writer.tag(1, WireType.LengthDelimited).string(message.state);
775
+ /* string market_id = 2; */
776
+ if (message.marketId !== "")
777
+ writer.tag(2, WireType.LengthDelimited).string(message.marketId);
778
+ /* string subaccount_id = 3; */
779
+ if (message.subaccountId !== "")
780
+ writer.tag(3, WireType.LengthDelimited).string(message.subaccountId);
781
+ /* string account_address = 4; */
782
+ if (message.accountAddress !== "")
783
+ writer.tag(4, WireType.LengthDelimited).string(message.accountAddress);
784
+ /* bool pending_execution = 5; */
785
+ if (message.pendingExecution !== false)
786
+ writer.tag(5, WireType.Varint).bool(message.pendingExecution);
787
+ /* sint64 start_time = 6; */
788
+ if (message.startTime !== 0n)
789
+ writer.tag(6, WireType.Varint).sint64(message.startTime);
790
+ /* sint64 end_time = 7; */
791
+ if (message.endTime !== 0n)
792
+ writer.tag(7, WireType.Varint).sint64(message.endTime);
793
+ /* sint32 limit = 8; */
794
+ if (message.limit !== 0)
795
+ writer.tag(8, WireType.Varint).sint32(message.limit);
796
+ /* uint64 skip = 9; */
797
+ if (message.skip !== 0n)
798
+ writer.tag(9, WireType.Varint).uint64(message.skip);
799
+ /* repeated string strategy_type = 10; */
800
+ for (let i = 0; i < message.strategyType.length; i++)
801
+ writer.tag(10, WireType.LengthDelimited).string(message.strategyType[i]);
802
+ /* string market_type = 11; */
803
+ if (message.marketType !== "")
804
+ writer.tag(11, WireType.LengthDelimited).string(message.marketType);
805
+ /* sint64 last_executed_time = 12; */
806
+ if (message.lastExecutedTime !== 0n)
807
+ writer.tag(12, WireType.Varint).sint64(message.lastExecutedTime);
808
+ /* bool with_tvl = 13; */
809
+ if (message.withTvl !== false)
810
+ writer.tag(13, WireType.Varint).bool(message.withTvl);
811
+ /* bool is_trailing_strategy = 14; */
812
+ if (message.isTrailingStrategy !== false)
813
+ writer.tag(14, WireType.Varint).bool(message.isTrailingStrategy);
814
+ /* bool with_performance = 15; */
815
+ if (message.withPerformance !== false)
816
+ writer.tag(15, WireType.Varint).bool(message.withPerformance);
817
+ let u = options.writeUnknownFields;
818
+ if (u !== false)
819
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
820
+ return writer;
821
+ }
822
+ }
823
+ /**
824
+ * @generated MessageType for protobuf message injective_trading_rpc.ListTradingStrategiesRequest
825
+ */
826
+ export const ListTradingStrategiesRequest = new ListTradingStrategiesRequest$Type();
827
+ // @generated message type with reflection information, may provide speed optimized methods
828
+ class ListTradingStrategiesResponse$Type extends MessageType<ListTradingStrategiesResponse> {
829
+ constructor() {
830
+ super("injective_trading_rpc.ListTradingStrategiesResponse", [
831
+ { no: 1, name: "strategies", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => TradingStrategy },
832
+ { no: 2, name: "paging", kind: "message", T: () => Paging }
833
+ ]);
834
+ }
835
+ create(value?: PartialMessage<ListTradingStrategiesResponse>): ListTradingStrategiesResponse {
836
+ const message = globalThis.Object.create((this.messagePrototype!));
837
+ message.strategies = [];
838
+ if (value !== undefined)
839
+ reflectionMergePartial<ListTradingStrategiesResponse>(this, message, value);
840
+ return message;
841
+ }
842
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListTradingStrategiesResponse): ListTradingStrategiesResponse {
843
+ let message = target ?? this.create(), end = reader.pos + length;
844
+ while (reader.pos < end) {
845
+ let [fieldNo, wireType] = reader.tag();
846
+ switch (fieldNo) {
847
+ case /* repeated injective_trading_rpc.TradingStrategy strategies */ 1:
848
+ message.strategies.push(TradingStrategy.internalBinaryRead(reader, reader.uint32(), options));
849
+ break;
850
+ case /* injective_trading_rpc.Paging paging */ 2:
851
+ message.paging = Paging.internalBinaryRead(reader, reader.uint32(), options, message.paging);
852
+ break;
853
+ default:
854
+ let u = options.readUnknownField;
855
+ if (u === "throw")
856
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
857
+ let d = reader.skip(wireType);
858
+ if (u !== false)
859
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
860
+ }
861
+ }
862
+ return message;
863
+ }
864
+ internalBinaryWrite(message: ListTradingStrategiesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
865
+ /* repeated injective_trading_rpc.TradingStrategy strategies = 1; */
866
+ for (let i = 0; i < message.strategies.length; i++)
867
+ TradingStrategy.internalBinaryWrite(message.strategies[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
868
+ /* injective_trading_rpc.Paging paging = 2; */
869
+ if (message.paging)
870
+ Paging.internalBinaryWrite(message.paging, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
871
+ let u = options.writeUnknownFields;
872
+ if (u !== false)
873
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
874
+ return writer;
875
+ }
876
+ }
877
+ /**
878
+ * @generated MessageType for protobuf message injective_trading_rpc.ListTradingStrategiesResponse
879
+ */
880
+ export const ListTradingStrategiesResponse = new ListTradingStrategiesResponse$Type();
881
+ // @generated message type with reflection information, may provide speed optimized methods
882
+ class TradingStrategy$Type extends MessageType<TradingStrategy> {
883
+ constructor() {
884
+ super("injective_trading_rpc.TradingStrategy", [
885
+ { no: 1, name: "state", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
886
+ { no: 2, name: "market_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
887
+ { no: 3, name: "subaccount_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
888
+ { no: 4, name: "account_address", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
889
+ { no: 5, name: "contract_address", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
890
+ { no: 6, name: "execution_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
891
+ { no: 7, name: "base_quantity", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
892
+ { no: 20, name: "quote_quantity", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
893
+ { no: 8, name: "lower_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
894
+ { no: 9, name: "upper_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
895
+ { no: 10, name: "stop_loss", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
896
+ { no: 11, name: "take_profit", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
897
+ { no: 12, name: "swap_fee", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
898
+ { no: 17, name: "base_deposit", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
899
+ { no: 18, name: "quote_deposit", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
900
+ { no: 19, name: "market_mid_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
901
+ { no: 21, name: "subscription_quote_quantity", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
902
+ { no: 22, name: "subscription_base_quantity", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
903
+ { no: 23, name: "number_of_grid_levels", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
904
+ { no: 24, name: "should_exit_with_quote_only", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
905
+ { no: 25, name: "stop_reason", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
906
+ { no: 26, name: "pending_execution", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
907
+ { no: 13, name: "created_height", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
908
+ { no: 14, name: "removed_height", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
909
+ { no: 15, name: "created_at", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
910
+ { no: 16, name: "updated_at", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
911
+ { no: 27, name: "exit_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
912
+ { no: 28, name: "stop_loss_config", kind: "message", T: () => ExitConfig },
913
+ { no: 29, name: "take_profit_config", kind: "message", T: () => ExitConfig },
914
+ { no: 30, name: "strategy_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
915
+ { no: 31, name: "contract_version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
916
+ { no: 32, name: "contract_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
917
+ { no: 33, name: "market_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
918
+ { no: 34, name: "last_executed_at", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
919
+ { no: 35, name: "trail_up_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
920
+ { no: 36, name: "trail_down_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
921
+ { no: 37, name: "trail_up_counter", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
922
+ { no: 38, name: "trail_down_counter", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
923
+ { no: 39, name: "tvl", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
924
+ { no: 40, name: "pnl", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
925
+ { no: 41, name: "pnl_perc", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
926
+ { no: 42, name: "pnl_updated_at", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
927
+ { no: 43, name: "performance", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
928
+ { no: 44, name: "roi", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
929
+ { no: 45, name: "initial_base_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
930
+ { no: 46, name: "initial_quote_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
931
+ { no: 47, name: "current_base_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
932
+ { no: 48, name: "current_quote_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
933
+ { no: 49, name: "final_base_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
934
+ { no: 50, name: "final_quote_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
935
+ { no: 51, name: "final_data", kind: "message", T: () => StrategyFinalData },
936
+ { no: 52, name: "margin_ratio", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
937
+ { no: 53, name: "lower_trailing_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
938
+ { no: 54, name: "upper_trailing_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
939
+ { no: 55, name: "new_upper_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
940
+ { no: 56, name: "new_lower_bound", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
941
+ ]);
942
+ }
943
+ create(value?: PartialMessage<TradingStrategy>): TradingStrategy {
944
+ const message = globalThis.Object.create((this.messagePrototype!));
945
+ message.state = "";
946
+ message.marketId = "";
947
+ message.subaccountId = "";
948
+ message.accountAddress = "";
949
+ message.contractAddress = "";
950
+ message.executionPrice = "";
951
+ message.baseQuantity = "";
952
+ message.quoteQuantity = "";
953
+ message.lowerBound = "";
954
+ message.upperBound = "";
955
+ message.stopLoss = "";
956
+ message.takeProfit = "";
957
+ message.swapFee = "";
958
+ message.baseDeposit = "";
959
+ message.quoteDeposit = "";
960
+ message.marketMidPrice = "";
961
+ message.subscriptionQuoteQuantity = "";
962
+ message.subscriptionBaseQuantity = "";
963
+ message.numberOfGridLevels = "";
964
+ message.shouldExitWithQuoteOnly = false;
965
+ message.stopReason = "";
966
+ message.pendingExecution = false;
967
+ message.createdHeight = 0n;
968
+ message.removedHeight = 0n;
969
+ message.createdAt = 0n;
970
+ message.updatedAt = 0n;
971
+ message.exitType = "";
972
+ message.strategyType = "";
973
+ message.contractVersion = "";
974
+ message.contractName = "";
975
+ message.marketType = "";
976
+ message.lastExecutedAt = 0n;
977
+ message.trailUpPrice = "";
978
+ message.trailDownPrice = "";
979
+ message.trailUpCounter = 0n;
980
+ message.trailDownCounter = 0n;
981
+ message.tvl = "";
982
+ message.pnl = "";
983
+ message.pnlPerc = "";
984
+ message.pnlUpdatedAt = 0n;
985
+ message.performance = "";
986
+ message.roi = "";
987
+ message.initialBasePrice = "";
988
+ message.initialQuotePrice = "";
989
+ message.currentBasePrice = "";
990
+ message.currentQuotePrice = "";
991
+ message.finalBasePrice = "";
992
+ message.finalQuotePrice = "";
993
+ message.marginRatio = "";
994
+ message.lowerTrailingBound = "";
995
+ message.upperTrailingBound = "";
996
+ message.newUpperBound = "";
997
+ message.newLowerBound = "";
998
+ if (value !== undefined)
999
+ reflectionMergePartial<TradingStrategy>(this, message, value);
1000
+ return message;
1001
+ }
1002
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TradingStrategy): TradingStrategy {
1003
+ let message = target ?? this.create(), end = reader.pos + length;
1004
+ while (reader.pos < end) {
1005
+ let [fieldNo, wireType] = reader.tag();
1006
+ switch (fieldNo) {
1007
+ case /* string state */ 1:
1008
+ message.state = reader.string();
1009
+ break;
1010
+ case /* string market_id */ 2:
1011
+ message.marketId = reader.string();
1012
+ break;
1013
+ case /* string subaccount_id */ 3:
1014
+ message.subaccountId = reader.string();
1015
+ break;
1016
+ case /* string account_address */ 4:
1017
+ message.accountAddress = reader.string();
1018
+ break;
1019
+ case /* string contract_address */ 5:
1020
+ message.contractAddress = reader.string();
1021
+ break;
1022
+ case /* string execution_price */ 6:
1023
+ message.executionPrice = reader.string();
1024
+ break;
1025
+ case /* string base_quantity */ 7:
1026
+ message.baseQuantity = reader.string();
1027
+ break;
1028
+ case /* string quote_quantity */ 20:
1029
+ message.quoteQuantity = reader.string();
1030
+ break;
1031
+ case /* string lower_bound */ 8:
1032
+ message.lowerBound = reader.string();
1033
+ break;
1034
+ case /* string upper_bound */ 9:
1035
+ message.upperBound = reader.string();
1036
+ break;
1037
+ case /* string stop_loss */ 10:
1038
+ message.stopLoss = reader.string();
1039
+ break;
1040
+ case /* string take_profit */ 11:
1041
+ message.takeProfit = reader.string();
1042
+ break;
1043
+ case /* string swap_fee */ 12:
1044
+ message.swapFee = reader.string();
1045
+ break;
1046
+ case /* string base_deposit */ 17:
1047
+ message.baseDeposit = reader.string();
1048
+ break;
1049
+ case /* string quote_deposit */ 18:
1050
+ message.quoteDeposit = reader.string();
1051
+ break;
1052
+ case /* string market_mid_price */ 19:
1053
+ message.marketMidPrice = reader.string();
1054
+ break;
1055
+ case /* string subscription_quote_quantity */ 21:
1056
+ message.subscriptionQuoteQuantity = reader.string();
1057
+ break;
1058
+ case /* string subscription_base_quantity */ 22:
1059
+ message.subscriptionBaseQuantity = reader.string();
1060
+ break;
1061
+ case /* string number_of_grid_levels */ 23:
1062
+ message.numberOfGridLevels = reader.string();
1063
+ break;
1064
+ case /* bool should_exit_with_quote_only */ 24:
1065
+ message.shouldExitWithQuoteOnly = reader.bool();
1066
+ break;
1067
+ case /* string stop_reason */ 25:
1068
+ message.stopReason = reader.string();
1069
+ break;
1070
+ case /* bool pending_execution */ 26:
1071
+ message.pendingExecution = reader.bool();
1072
+ break;
1073
+ case /* sint64 created_height */ 13:
1074
+ message.createdHeight = reader.sint64().toBigInt();
1075
+ break;
1076
+ case /* sint64 removed_height */ 14:
1077
+ message.removedHeight = reader.sint64().toBigInt();
1078
+ break;
1079
+ case /* sint64 created_at */ 15:
1080
+ message.createdAt = reader.sint64().toBigInt();
1081
+ break;
1082
+ case /* sint64 updated_at */ 16:
1083
+ message.updatedAt = reader.sint64().toBigInt();
1084
+ break;
1085
+ case /* string exit_type */ 27:
1086
+ message.exitType = reader.string();
1087
+ break;
1088
+ case /* injective_trading_rpc.ExitConfig stop_loss_config */ 28:
1089
+ message.stopLossConfig = ExitConfig.internalBinaryRead(reader, reader.uint32(), options, message.stopLossConfig);
1090
+ break;
1091
+ case /* injective_trading_rpc.ExitConfig take_profit_config */ 29:
1092
+ message.takeProfitConfig = ExitConfig.internalBinaryRead(reader, reader.uint32(), options, message.takeProfitConfig);
1093
+ break;
1094
+ case /* string strategy_type */ 30:
1095
+ message.strategyType = reader.string();
1096
+ break;
1097
+ case /* string contract_version */ 31:
1098
+ message.contractVersion = reader.string();
1099
+ break;
1100
+ case /* string contract_name */ 32:
1101
+ message.contractName = reader.string();
1102
+ break;
1103
+ case /* string market_type */ 33:
1104
+ message.marketType = reader.string();
1105
+ break;
1106
+ case /* sint64 last_executed_at */ 34:
1107
+ message.lastExecutedAt = reader.sint64().toBigInt();
1108
+ break;
1109
+ case /* string trail_up_price */ 35:
1110
+ message.trailUpPrice = reader.string();
1111
+ break;
1112
+ case /* string trail_down_price */ 36:
1113
+ message.trailDownPrice = reader.string();
1114
+ break;
1115
+ case /* sint64 trail_up_counter */ 37:
1116
+ message.trailUpCounter = reader.sint64().toBigInt();
1117
+ break;
1118
+ case /* sint64 trail_down_counter */ 38:
1119
+ message.trailDownCounter = reader.sint64().toBigInt();
1120
+ break;
1121
+ case /* string tvl */ 39:
1122
+ message.tvl = reader.string();
1123
+ break;
1124
+ case /* string pnl */ 40:
1125
+ message.pnl = reader.string();
1126
+ break;
1127
+ case /* string pnl_perc */ 41:
1128
+ message.pnlPerc = reader.string();
1129
+ break;
1130
+ case /* sint64 pnl_updated_at */ 42:
1131
+ message.pnlUpdatedAt = reader.sint64().toBigInt();
1132
+ break;
1133
+ case /* string performance */ 43:
1134
+ message.performance = reader.string();
1135
+ break;
1136
+ case /* string roi */ 44:
1137
+ message.roi = reader.string();
1138
+ break;
1139
+ case /* string initial_base_price */ 45:
1140
+ message.initialBasePrice = reader.string();
1141
+ break;
1142
+ case /* string initial_quote_price */ 46:
1143
+ message.initialQuotePrice = reader.string();
1144
+ break;
1145
+ case /* string current_base_price */ 47:
1146
+ message.currentBasePrice = reader.string();
1147
+ break;
1148
+ case /* string current_quote_price */ 48:
1149
+ message.currentQuotePrice = reader.string();
1150
+ break;
1151
+ case /* string final_base_price */ 49:
1152
+ message.finalBasePrice = reader.string();
1153
+ break;
1154
+ case /* string final_quote_price */ 50:
1155
+ message.finalQuotePrice = reader.string();
1156
+ break;
1157
+ case /* injective_trading_rpc.StrategyFinalData final_data */ 51:
1158
+ message.finalData = StrategyFinalData.internalBinaryRead(reader, reader.uint32(), options, message.finalData);
1159
+ break;
1160
+ case /* string margin_ratio */ 52:
1161
+ message.marginRatio = reader.string();
1162
+ break;
1163
+ case /* string lower_trailing_bound */ 53:
1164
+ message.lowerTrailingBound = reader.string();
1165
+ break;
1166
+ case /* string upper_trailing_bound */ 54:
1167
+ message.upperTrailingBound = reader.string();
1168
+ break;
1169
+ case /* string new_upper_bound */ 55:
1170
+ message.newUpperBound = reader.string();
1171
+ break;
1172
+ case /* string new_lower_bound */ 56:
1173
+ message.newLowerBound = reader.string();
1174
+ break;
1175
+ default:
1176
+ let u = options.readUnknownField;
1177
+ if (u === "throw")
1178
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1179
+ let d = reader.skip(wireType);
1180
+ if (u !== false)
1181
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1182
+ }
1183
+ }
1184
+ return message;
1185
+ }
1186
+ internalBinaryWrite(message: TradingStrategy, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1187
+ /* string state = 1; */
1188
+ if (message.state !== "")
1189
+ writer.tag(1, WireType.LengthDelimited).string(message.state);
1190
+ /* string market_id = 2; */
1191
+ if (message.marketId !== "")
1192
+ writer.tag(2, WireType.LengthDelimited).string(message.marketId);
1193
+ /* string subaccount_id = 3; */
1194
+ if (message.subaccountId !== "")
1195
+ writer.tag(3, WireType.LengthDelimited).string(message.subaccountId);
1196
+ /* string account_address = 4; */
1197
+ if (message.accountAddress !== "")
1198
+ writer.tag(4, WireType.LengthDelimited).string(message.accountAddress);
1199
+ /* string contract_address = 5; */
1200
+ if (message.contractAddress !== "")
1201
+ writer.tag(5, WireType.LengthDelimited).string(message.contractAddress);
1202
+ /* string execution_price = 6; */
1203
+ if (message.executionPrice !== "")
1204
+ writer.tag(6, WireType.LengthDelimited).string(message.executionPrice);
1205
+ /* string base_quantity = 7; */
1206
+ if (message.baseQuantity !== "")
1207
+ writer.tag(7, WireType.LengthDelimited).string(message.baseQuantity);
1208
+ /* string lower_bound = 8; */
1209
+ if (message.lowerBound !== "")
1210
+ writer.tag(8, WireType.LengthDelimited).string(message.lowerBound);
1211
+ /* string upper_bound = 9; */
1212
+ if (message.upperBound !== "")
1213
+ writer.tag(9, WireType.LengthDelimited).string(message.upperBound);
1214
+ /* string stop_loss = 10; */
1215
+ if (message.stopLoss !== "")
1216
+ writer.tag(10, WireType.LengthDelimited).string(message.stopLoss);
1217
+ /* string take_profit = 11; */
1218
+ if (message.takeProfit !== "")
1219
+ writer.tag(11, WireType.LengthDelimited).string(message.takeProfit);
1220
+ /* string swap_fee = 12; */
1221
+ if (message.swapFee !== "")
1222
+ writer.tag(12, WireType.LengthDelimited).string(message.swapFee);
1223
+ /* sint64 created_height = 13; */
1224
+ if (message.createdHeight !== 0n)
1225
+ writer.tag(13, WireType.Varint).sint64(message.createdHeight);
1226
+ /* sint64 removed_height = 14; */
1227
+ if (message.removedHeight !== 0n)
1228
+ writer.tag(14, WireType.Varint).sint64(message.removedHeight);
1229
+ /* sint64 created_at = 15; */
1230
+ if (message.createdAt !== 0n)
1231
+ writer.tag(15, WireType.Varint).sint64(message.createdAt);
1232
+ /* sint64 updated_at = 16; */
1233
+ if (message.updatedAt !== 0n)
1234
+ writer.tag(16, WireType.Varint).sint64(message.updatedAt);
1235
+ /* string base_deposit = 17; */
1236
+ if (message.baseDeposit !== "")
1237
+ writer.tag(17, WireType.LengthDelimited).string(message.baseDeposit);
1238
+ /* string quote_deposit = 18; */
1239
+ if (message.quoteDeposit !== "")
1240
+ writer.tag(18, WireType.LengthDelimited).string(message.quoteDeposit);
1241
+ /* string market_mid_price = 19; */
1242
+ if (message.marketMidPrice !== "")
1243
+ writer.tag(19, WireType.LengthDelimited).string(message.marketMidPrice);
1244
+ /* string quote_quantity = 20; */
1245
+ if (message.quoteQuantity !== "")
1246
+ writer.tag(20, WireType.LengthDelimited).string(message.quoteQuantity);
1247
+ /* string subscription_quote_quantity = 21; */
1248
+ if (message.subscriptionQuoteQuantity !== "")
1249
+ writer.tag(21, WireType.LengthDelimited).string(message.subscriptionQuoteQuantity);
1250
+ /* string subscription_base_quantity = 22; */
1251
+ if (message.subscriptionBaseQuantity !== "")
1252
+ writer.tag(22, WireType.LengthDelimited).string(message.subscriptionBaseQuantity);
1253
+ /* string number_of_grid_levels = 23; */
1254
+ if (message.numberOfGridLevels !== "")
1255
+ writer.tag(23, WireType.LengthDelimited).string(message.numberOfGridLevels);
1256
+ /* bool should_exit_with_quote_only = 24; */
1257
+ if (message.shouldExitWithQuoteOnly !== false)
1258
+ writer.tag(24, WireType.Varint).bool(message.shouldExitWithQuoteOnly);
1259
+ /* string stop_reason = 25; */
1260
+ if (message.stopReason !== "")
1261
+ writer.tag(25, WireType.LengthDelimited).string(message.stopReason);
1262
+ /* bool pending_execution = 26; */
1263
+ if (message.pendingExecution !== false)
1264
+ writer.tag(26, WireType.Varint).bool(message.pendingExecution);
1265
+ /* string exit_type = 27; */
1266
+ if (message.exitType !== "")
1267
+ writer.tag(27, WireType.LengthDelimited).string(message.exitType);
1268
+ /* injective_trading_rpc.ExitConfig stop_loss_config = 28; */
1269
+ if (message.stopLossConfig)
1270
+ ExitConfig.internalBinaryWrite(message.stopLossConfig, writer.tag(28, WireType.LengthDelimited).fork(), options).join();
1271
+ /* injective_trading_rpc.ExitConfig take_profit_config = 29; */
1272
+ if (message.takeProfitConfig)
1273
+ ExitConfig.internalBinaryWrite(message.takeProfitConfig, writer.tag(29, WireType.LengthDelimited).fork(), options).join();
1274
+ /* string strategy_type = 30; */
1275
+ if (message.strategyType !== "")
1276
+ writer.tag(30, WireType.LengthDelimited).string(message.strategyType);
1277
+ /* string contract_version = 31; */
1278
+ if (message.contractVersion !== "")
1279
+ writer.tag(31, WireType.LengthDelimited).string(message.contractVersion);
1280
+ /* string contract_name = 32; */
1281
+ if (message.contractName !== "")
1282
+ writer.tag(32, WireType.LengthDelimited).string(message.contractName);
1283
+ /* string market_type = 33; */
1284
+ if (message.marketType !== "")
1285
+ writer.tag(33, WireType.LengthDelimited).string(message.marketType);
1286
+ /* sint64 last_executed_at = 34; */
1287
+ if (message.lastExecutedAt !== 0n)
1288
+ writer.tag(34, WireType.Varint).sint64(message.lastExecutedAt);
1289
+ /* string trail_up_price = 35; */
1290
+ if (message.trailUpPrice !== "")
1291
+ writer.tag(35, WireType.LengthDelimited).string(message.trailUpPrice);
1292
+ /* string trail_down_price = 36; */
1293
+ if (message.trailDownPrice !== "")
1294
+ writer.tag(36, WireType.LengthDelimited).string(message.trailDownPrice);
1295
+ /* sint64 trail_up_counter = 37; */
1296
+ if (message.trailUpCounter !== 0n)
1297
+ writer.tag(37, WireType.Varint).sint64(message.trailUpCounter);
1298
+ /* sint64 trail_down_counter = 38; */
1299
+ if (message.trailDownCounter !== 0n)
1300
+ writer.tag(38, WireType.Varint).sint64(message.trailDownCounter);
1301
+ /* string tvl = 39; */
1302
+ if (message.tvl !== "")
1303
+ writer.tag(39, WireType.LengthDelimited).string(message.tvl);
1304
+ /* string pnl = 40; */
1305
+ if (message.pnl !== "")
1306
+ writer.tag(40, WireType.LengthDelimited).string(message.pnl);
1307
+ /* string pnl_perc = 41; */
1308
+ if (message.pnlPerc !== "")
1309
+ writer.tag(41, WireType.LengthDelimited).string(message.pnlPerc);
1310
+ /* sint64 pnl_updated_at = 42; */
1311
+ if (message.pnlUpdatedAt !== 0n)
1312
+ writer.tag(42, WireType.Varint).sint64(message.pnlUpdatedAt);
1313
+ /* string performance = 43; */
1314
+ if (message.performance !== "")
1315
+ writer.tag(43, WireType.LengthDelimited).string(message.performance);
1316
+ /* string roi = 44; */
1317
+ if (message.roi !== "")
1318
+ writer.tag(44, WireType.LengthDelimited).string(message.roi);
1319
+ /* string initial_base_price = 45; */
1320
+ if (message.initialBasePrice !== "")
1321
+ writer.tag(45, WireType.LengthDelimited).string(message.initialBasePrice);
1322
+ /* string initial_quote_price = 46; */
1323
+ if (message.initialQuotePrice !== "")
1324
+ writer.tag(46, WireType.LengthDelimited).string(message.initialQuotePrice);
1325
+ /* string current_base_price = 47; */
1326
+ if (message.currentBasePrice !== "")
1327
+ writer.tag(47, WireType.LengthDelimited).string(message.currentBasePrice);
1328
+ /* string current_quote_price = 48; */
1329
+ if (message.currentQuotePrice !== "")
1330
+ writer.tag(48, WireType.LengthDelimited).string(message.currentQuotePrice);
1331
+ /* string final_base_price = 49; */
1332
+ if (message.finalBasePrice !== "")
1333
+ writer.tag(49, WireType.LengthDelimited).string(message.finalBasePrice);
1334
+ /* string final_quote_price = 50; */
1335
+ if (message.finalQuotePrice !== "")
1336
+ writer.tag(50, WireType.LengthDelimited).string(message.finalQuotePrice);
1337
+ /* injective_trading_rpc.StrategyFinalData final_data = 51; */
1338
+ if (message.finalData)
1339
+ StrategyFinalData.internalBinaryWrite(message.finalData, writer.tag(51, WireType.LengthDelimited).fork(), options).join();
1340
+ /* string margin_ratio = 52; */
1341
+ if (message.marginRatio !== "")
1342
+ writer.tag(52, WireType.LengthDelimited).string(message.marginRatio);
1343
+ /* string lower_trailing_bound = 53; */
1344
+ if (message.lowerTrailingBound !== "")
1345
+ writer.tag(53, WireType.LengthDelimited).string(message.lowerTrailingBound);
1346
+ /* string upper_trailing_bound = 54; */
1347
+ if (message.upperTrailingBound !== "")
1348
+ writer.tag(54, WireType.LengthDelimited).string(message.upperTrailingBound);
1349
+ /* string new_upper_bound = 55; */
1350
+ if (message.newUpperBound !== "")
1351
+ writer.tag(55, WireType.LengthDelimited).string(message.newUpperBound);
1352
+ /* string new_lower_bound = 56; */
1353
+ if (message.newLowerBound !== "")
1354
+ writer.tag(56, WireType.LengthDelimited).string(message.newLowerBound);
1355
+ let u = options.writeUnknownFields;
1356
+ if (u !== false)
1357
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1358
+ return writer;
1359
+ }
1360
+ }
1361
+ /**
1362
+ * @generated MessageType for protobuf message injective_trading_rpc.TradingStrategy
1363
+ */
1364
+ export const TradingStrategy = new TradingStrategy$Type();
1365
+ // @generated message type with reflection information, may provide speed optimized methods
1366
+ class ExitConfig$Type extends MessageType<ExitConfig> {
1367
+ constructor() {
1368
+ super("injective_trading_rpc.ExitConfig", [
1369
+ { no: 1, name: "exit_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1370
+ { no: 2, name: "exit_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1371
+ ]);
1372
+ }
1373
+ create(value?: PartialMessage<ExitConfig>): ExitConfig {
1374
+ const message = globalThis.Object.create((this.messagePrototype!));
1375
+ message.exitType = "";
1376
+ message.exitPrice = "";
1377
+ if (value !== undefined)
1378
+ reflectionMergePartial<ExitConfig>(this, message, value);
1379
+ return message;
1380
+ }
1381
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExitConfig): ExitConfig {
1382
+ let message = target ?? this.create(), end = reader.pos + length;
1383
+ while (reader.pos < end) {
1384
+ let [fieldNo, wireType] = reader.tag();
1385
+ switch (fieldNo) {
1386
+ case /* string exit_type */ 1:
1387
+ message.exitType = reader.string();
1388
+ break;
1389
+ case /* string exit_price */ 2:
1390
+ message.exitPrice = reader.string();
1391
+ break;
1392
+ default:
1393
+ let u = options.readUnknownField;
1394
+ if (u === "throw")
1395
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1396
+ let d = reader.skip(wireType);
1397
+ if (u !== false)
1398
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1399
+ }
1400
+ }
1401
+ return message;
1402
+ }
1403
+ internalBinaryWrite(message: ExitConfig, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1404
+ /* string exit_type = 1; */
1405
+ if (message.exitType !== "")
1406
+ writer.tag(1, WireType.LengthDelimited).string(message.exitType);
1407
+ /* string exit_price = 2; */
1408
+ if (message.exitPrice !== "")
1409
+ writer.tag(2, WireType.LengthDelimited).string(message.exitPrice);
1410
+ let u = options.writeUnknownFields;
1411
+ if (u !== false)
1412
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1413
+ return writer;
1414
+ }
1415
+ }
1416
+ /**
1417
+ * @generated MessageType for protobuf message injective_trading_rpc.ExitConfig
1418
+ */
1419
+ export const ExitConfig = new ExitConfig$Type();
1420
+ // @generated message type with reflection information, may provide speed optimized methods
1421
+ class StrategyFinalData$Type extends MessageType<StrategyFinalData> {
1422
+ constructor() {
1423
+ super("injective_trading_rpc.StrategyFinalData", [
1424
+ { no: 1, name: "initial_base_amount", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1425
+ { no: 2, name: "initial_quote_amount", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1426
+ { no: 3, name: "final_base_amount", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1427
+ { no: 4, name: "final_quote_amount", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1428
+ { no: 5, name: "initial_base_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1429
+ { no: 6, name: "initial_quote_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1430
+ { no: 7, name: "final_base_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1431
+ { no: 8, name: "final_quote_price", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1432
+ ]);
1433
+ }
1434
+ create(value?: PartialMessage<StrategyFinalData>): StrategyFinalData {
1435
+ const message = globalThis.Object.create((this.messagePrototype!));
1436
+ message.initialBaseAmount = "";
1437
+ message.initialQuoteAmount = "";
1438
+ message.finalBaseAmount = "";
1439
+ message.finalQuoteAmount = "";
1440
+ message.initialBasePrice = "";
1441
+ message.initialQuotePrice = "";
1442
+ message.finalBasePrice = "";
1443
+ message.finalQuotePrice = "";
1444
+ if (value !== undefined)
1445
+ reflectionMergePartial<StrategyFinalData>(this, message, value);
1446
+ return message;
1447
+ }
1448
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StrategyFinalData): StrategyFinalData {
1449
+ let message = target ?? this.create(), end = reader.pos + length;
1450
+ while (reader.pos < end) {
1451
+ let [fieldNo, wireType] = reader.tag();
1452
+ switch (fieldNo) {
1453
+ case /* string initial_base_amount */ 1:
1454
+ message.initialBaseAmount = reader.string();
1455
+ break;
1456
+ case /* string initial_quote_amount */ 2:
1457
+ message.initialQuoteAmount = reader.string();
1458
+ break;
1459
+ case /* string final_base_amount */ 3:
1460
+ message.finalBaseAmount = reader.string();
1461
+ break;
1462
+ case /* string final_quote_amount */ 4:
1463
+ message.finalQuoteAmount = reader.string();
1464
+ break;
1465
+ case /* string initial_base_price */ 5:
1466
+ message.initialBasePrice = reader.string();
1467
+ break;
1468
+ case /* string initial_quote_price */ 6:
1469
+ message.initialQuotePrice = reader.string();
1470
+ break;
1471
+ case /* string final_base_price */ 7:
1472
+ message.finalBasePrice = reader.string();
1473
+ break;
1474
+ case /* string final_quote_price */ 8:
1475
+ message.finalQuotePrice = reader.string();
1476
+ break;
1477
+ default:
1478
+ let u = options.readUnknownField;
1479
+ if (u === "throw")
1480
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1481
+ let d = reader.skip(wireType);
1482
+ if (u !== false)
1483
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1484
+ }
1485
+ }
1486
+ return message;
1487
+ }
1488
+ internalBinaryWrite(message: StrategyFinalData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1489
+ /* string initial_base_amount = 1; */
1490
+ if (message.initialBaseAmount !== "")
1491
+ writer.tag(1, WireType.LengthDelimited).string(message.initialBaseAmount);
1492
+ /* string initial_quote_amount = 2; */
1493
+ if (message.initialQuoteAmount !== "")
1494
+ writer.tag(2, WireType.LengthDelimited).string(message.initialQuoteAmount);
1495
+ /* string final_base_amount = 3; */
1496
+ if (message.finalBaseAmount !== "")
1497
+ writer.tag(3, WireType.LengthDelimited).string(message.finalBaseAmount);
1498
+ /* string final_quote_amount = 4; */
1499
+ if (message.finalQuoteAmount !== "")
1500
+ writer.tag(4, WireType.LengthDelimited).string(message.finalQuoteAmount);
1501
+ /* string initial_base_price = 5; */
1502
+ if (message.initialBasePrice !== "")
1503
+ writer.tag(5, WireType.LengthDelimited).string(message.initialBasePrice);
1504
+ /* string initial_quote_price = 6; */
1505
+ if (message.initialQuotePrice !== "")
1506
+ writer.tag(6, WireType.LengthDelimited).string(message.initialQuotePrice);
1507
+ /* string final_base_price = 7; */
1508
+ if (message.finalBasePrice !== "")
1509
+ writer.tag(7, WireType.LengthDelimited).string(message.finalBasePrice);
1510
+ /* string final_quote_price = 8; */
1511
+ if (message.finalQuotePrice !== "")
1512
+ writer.tag(8, WireType.LengthDelimited).string(message.finalQuotePrice);
1513
+ let u = options.writeUnknownFields;
1514
+ if (u !== false)
1515
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1516
+ return writer;
1517
+ }
1518
+ }
1519
+ /**
1520
+ * @generated MessageType for protobuf message injective_trading_rpc.StrategyFinalData
1521
+ */
1522
+ export const StrategyFinalData = new StrategyFinalData$Type();
1523
+ // @generated message type with reflection information, may provide speed optimized methods
1524
+ class Paging$Type extends MessageType<Paging> {
1525
+ constructor() {
1526
+ super("injective_trading_rpc.Paging", [
1527
+ { no: 1, name: "total", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
1528
+ { no: 2, name: "from", kind: "scalar", T: 17 /*ScalarType.SINT32*/ },
1529
+ { no: 3, name: "to", kind: "scalar", T: 17 /*ScalarType.SINT32*/ },
1530
+ { no: 4, name: "count_by_subaccount", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ },
1531
+ { no: 5, name: "next", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
1532
+ ]);
1533
+ }
1534
+ create(value?: PartialMessage<Paging>): Paging {
1535
+ const message = globalThis.Object.create((this.messagePrototype!));
1536
+ message.total = 0n;
1537
+ message.from = 0;
1538
+ message.to = 0;
1539
+ message.countBySubaccount = 0n;
1540
+ message.next = [];
1541
+ if (value !== undefined)
1542
+ reflectionMergePartial<Paging>(this, message, value);
1543
+ return message;
1544
+ }
1545
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Paging): Paging {
1546
+ let message = target ?? this.create(), end = reader.pos + length;
1547
+ while (reader.pos < end) {
1548
+ let [fieldNo, wireType] = reader.tag();
1549
+ switch (fieldNo) {
1550
+ case /* sint64 total */ 1:
1551
+ message.total = reader.sint64().toBigInt();
1552
+ break;
1553
+ case /* sint32 from */ 2:
1554
+ message.from = reader.sint32();
1555
+ break;
1556
+ case /* sint32 to */ 3:
1557
+ message.to = reader.sint32();
1558
+ break;
1559
+ case /* sint64 count_by_subaccount */ 4:
1560
+ message.countBySubaccount = reader.sint64().toBigInt();
1561
+ break;
1562
+ case /* repeated string next */ 5:
1563
+ message.next.push(reader.string());
1564
+ break;
1565
+ default:
1566
+ let u = options.readUnknownField;
1567
+ if (u === "throw")
1568
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1569
+ let d = reader.skip(wireType);
1570
+ if (u !== false)
1571
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1572
+ }
1573
+ }
1574
+ return message;
1575
+ }
1576
+ internalBinaryWrite(message: Paging, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1577
+ /* sint64 total = 1; */
1578
+ if (message.total !== 0n)
1579
+ writer.tag(1, WireType.Varint).sint64(message.total);
1580
+ /* sint32 from = 2; */
1581
+ if (message.from !== 0)
1582
+ writer.tag(2, WireType.Varint).sint32(message.from);
1583
+ /* sint32 to = 3; */
1584
+ if (message.to !== 0)
1585
+ writer.tag(3, WireType.Varint).sint32(message.to);
1586
+ /* sint64 count_by_subaccount = 4; */
1587
+ if (message.countBySubaccount !== 0n)
1588
+ writer.tag(4, WireType.Varint).sint64(message.countBySubaccount);
1589
+ /* repeated string next = 5; */
1590
+ for (let i = 0; i < message.next.length; i++)
1591
+ writer.tag(5, WireType.LengthDelimited).string(message.next[i]);
1592
+ let u = options.writeUnknownFields;
1593
+ if (u !== false)
1594
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1595
+ return writer;
1596
+ }
1597
+ }
1598
+ /**
1599
+ * @generated MessageType for protobuf message injective_trading_rpc.Paging
1600
+ */
1601
+ export const Paging = new Paging$Type();
1602
+ // @generated message type with reflection information, may provide speed optimized methods
1603
+ class GetTradingStatsRequest$Type extends MessageType<GetTradingStatsRequest> {
1604
+ constructor() {
1605
+ super("injective_trading_rpc.GetTradingStatsRequest", []);
1606
+ }
1607
+ create(value?: PartialMessage<GetTradingStatsRequest>): GetTradingStatsRequest {
1608
+ const message = globalThis.Object.create((this.messagePrototype!));
1609
+ if (value !== undefined)
1610
+ reflectionMergePartial<GetTradingStatsRequest>(this, message, value);
1611
+ return message;
1612
+ }
1613
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetTradingStatsRequest): GetTradingStatsRequest {
1614
+ let message = target ?? this.create(), end = reader.pos + length;
1615
+ while (reader.pos < end) {
1616
+ let [fieldNo, wireType] = reader.tag();
1617
+ switch (fieldNo) {
1618
+ default:
1619
+ let u = options.readUnknownField;
1620
+ if (u === "throw")
1621
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1622
+ let d = reader.skip(wireType);
1623
+ if (u !== false)
1624
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1625
+ }
1626
+ }
1627
+ return message;
1628
+ }
1629
+ internalBinaryWrite(message: GetTradingStatsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1630
+ let u = options.writeUnknownFields;
1631
+ if (u !== false)
1632
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1633
+ return writer;
1634
+ }
1635
+ }
1636
+ /**
1637
+ * @generated MessageType for protobuf message injective_trading_rpc.GetTradingStatsRequest
1638
+ */
1639
+ export const GetTradingStatsRequest = new GetTradingStatsRequest$Type();
1640
+ // @generated message type with reflection information, may provide speed optimized methods
1641
+ class GetTradingStatsResponse$Type extends MessageType<GetTradingStatsResponse> {
1642
+ constructor() {
1643
+ super("injective_trading_rpc.GetTradingStatsResponse", [
1644
+ { no: 1, name: "active_trading_strategies", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
1645
+ { no: 2, name: "total_trading_strategies_created", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
1646
+ { no: 3, name: "total_tvl", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1647
+ { no: 4, name: "markets", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Market }
1648
+ ]);
1649
+ }
1650
+ create(value?: PartialMessage<GetTradingStatsResponse>): GetTradingStatsResponse {
1651
+ const message = globalThis.Object.create((this.messagePrototype!));
1652
+ message.activeTradingStrategies = 0n;
1653
+ message.totalTradingStrategiesCreated = 0n;
1654
+ message.totalTvl = "";
1655
+ message.markets = [];
1656
+ if (value !== undefined)
1657
+ reflectionMergePartial<GetTradingStatsResponse>(this, message, value);
1658
+ return message;
1659
+ }
1660
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetTradingStatsResponse): GetTradingStatsResponse {
1661
+ let message = target ?? this.create(), end = reader.pos + length;
1662
+ while (reader.pos < end) {
1663
+ let [fieldNo, wireType] = reader.tag();
1664
+ switch (fieldNo) {
1665
+ case /* uint64 active_trading_strategies */ 1:
1666
+ message.activeTradingStrategies = reader.uint64().toBigInt();
1667
+ break;
1668
+ case /* uint64 total_trading_strategies_created */ 2:
1669
+ message.totalTradingStrategiesCreated = reader.uint64().toBigInt();
1670
+ break;
1671
+ case /* string total_tvl */ 3:
1672
+ message.totalTvl = reader.string();
1673
+ break;
1674
+ case /* repeated injective_trading_rpc.Market markets */ 4:
1675
+ message.markets.push(Market.internalBinaryRead(reader, reader.uint32(), options));
1676
+ break;
1677
+ default:
1678
+ let u = options.readUnknownField;
1679
+ if (u === "throw")
1680
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1681
+ let d = reader.skip(wireType);
1682
+ if (u !== false)
1683
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1684
+ }
1685
+ }
1686
+ return message;
1687
+ }
1688
+ internalBinaryWrite(message: GetTradingStatsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1689
+ /* uint64 active_trading_strategies = 1; */
1690
+ if (message.activeTradingStrategies !== 0n)
1691
+ writer.tag(1, WireType.Varint).uint64(message.activeTradingStrategies);
1692
+ /* uint64 total_trading_strategies_created = 2; */
1693
+ if (message.totalTradingStrategiesCreated !== 0n)
1694
+ writer.tag(2, WireType.Varint).uint64(message.totalTradingStrategiesCreated);
1695
+ /* string total_tvl = 3; */
1696
+ if (message.totalTvl !== "")
1697
+ writer.tag(3, WireType.LengthDelimited).string(message.totalTvl);
1698
+ /* repeated injective_trading_rpc.Market markets = 4; */
1699
+ for (let i = 0; i < message.markets.length; i++)
1700
+ Market.internalBinaryWrite(message.markets[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
1701
+ let u = options.writeUnknownFields;
1702
+ if (u !== false)
1703
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1704
+ return writer;
1705
+ }
1706
+ }
1707
+ /**
1708
+ * @generated MessageType for protobuf message injective_trading_rpc.GetTradingStatsResponse
1709
+ */
1710
+ export const GetTradingStatsResponse = new GetTradingStatsResponse$Type();
1711
+ // @generated message type with reflection information, may provide speed optimized methods
1712
+ class Market$Type extends MessageType<Market> {
1713
+ constructor() {
1714
+ super("injective_trading_rpc.Market", [
1715
+ { no: 1, name: "market_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1716
+ { no: 2, name: "active_trading_strategies", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
1717
+ ]);
1718
+ }
1719
+ create(value?: PartialMessage<Market>): Market {
1720
+ const message = globalThis.Object.create((this.messagePrototype!));
1721
+ message.marketId = "";
1722
+ message.activeTradingStrategies = 0n;
1723
+ if (value !== undefined)
1724
+ reflectionMergePartial<Market>(this, message, value);
1725
+ return message;
1726
+ }
1727
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Market): Market {
1728
+ let message = target ?? this.create(), end = reader.pos + length;
1729
+ while (reader.pos < end) {
1730
+ let [fieldNo, wireType] = reader.tag();
1731
+ switch (fieldNo) {
1732
+ case /* string market_id */ 1:
1733
+ message.marketId = reader.string();
1734
+ break;
1735
+ case /* uint64 active_trading_strategies */ 2:
1736
+ message.activeTradingStrategies = reader.uint64().toBigInt();
1737
+ break;
1738
+ default:
1739
+ let u = options.readUnknownField;
1740
+ if (u === "throw")
1741
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1742
+ let d = reader.skip(wireType);
1743
+ if (u !== false)
1744
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1745
+ }
1746
+ }
1747
+ return message;
1748
+ }
1749
+ internalBinaryWrite(message: Market, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1750
+ /* string market_id = 1; */
1751
+ if (message.marketId !== "")
1752
+ writer.tag(1, WireType.LengthDelimited).string(message.marketId);
1753
+ /* uint64 active_trading_strategies = 2; */
1754
+ if (message.activeTradingStrategies !== 0n)
1755
+ writer.tag(2, WireType.Varint).uint64(message.activeTradingStrategies);
1756
+ let u = options.writeUnknownFields;
1757
+ if (u !== false)
1758
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1759
+ return writer;
1760
+ }
1761
+ }
1762
+ /**
1763
+ * @generated MessageType for protobuf message injective_trading_rpc.Market
1764
+ */
1765
+ export const Market = new Market$Type();
1766
+ // @generated message type with reflection information, may provide speed optimized methods
1767
+ class StreamStrategyRequest$Type extends MessageType<StreamStrategyRequest> {
1768
+ constructor() {
1769
+ super("injective_trading_rpc.StreamStrategyRequest", [
1770
+ { no: 1, name: "account_addresses", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
1771
+ { no: 2, name: "market_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1772
+ ]);
1773
+ }
1774
+ create(value?: PartialMessage<StreamStrategyRequest>): StreamStrategyRequest {
1775
+ const message = globalThis.Object.create((this.messagePrototype!));
1776
+ message.accountAddresses = [];
1777
+ message.marketId = "";
1778
+ if (value !== undefined)
1779
+ reflectionMergePartial<StreamStrategyRequest>(this, message, value);
1780
+ return message;
1781
+ }
1782
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StreamStrategyRequest): StreamStrategyRequest {
1783
+ let message = target ?? this.create(), end = reader.pos + length;
1784
+ while (reader.pos < end) {
1785
+ let [fieldNo, wireType] = reader.tag();
1786
+ switch (fieldNo) {
1787
+ case /* repeated string account_addresses */ 1:
1788
+ message.accountAddresses.push(reader.string());
1789
+ break;
1790
+ case /* string market_id */ 2:
1791
+ message.marketId = reader.string();
1792
+ break;
1793
+ default:
1794
+ let u = options.readUnknownField;
1795
+ if (u === "throw")
1796
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1797
+ let d = reader.skip(wireType);
1798
+ if (u !== false)
1799
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1800
+ }
1801
+ }
1802
+ return message;
1803
+ }
1804
+ internalBinaryWrite(message: StreamStrategyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1805
+ /* repeated string account_addresses = 1; */
1806
+ for (let i = 0; i < message.accountAddresses.length; i++)
1807
+ writer.tag(1, WireType.LengthDelimited).string(message.accountAddresses[i]);
1808
+ /* string market_id = 2; */
1809
+ if (message.marketId !== "")
1810
+ writer.tag(2, WireType.LengthDelimited).string(message.marketId);
1811
+ let u = options.writeUnknownFields;
1812
+ if (u !== false)
1813
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1814
+ return writer;
1815
+ }
1816
+ }
1817
+ /**
1818
+ * @generated MessageType for protobuf message injective_trading_rpc.StreamStrategyRequest
1819
+ */
1820
+ export const StreamStrategyRequest = new StreamStrategyRequest$Type();
1821
+ // @generated message type with reflection information, may provide speed optimized methods
1822
+ class StreamStrategyResponse$Type extends MessageType<StreamStrategyResponse> {
1823
+ constructor() {
1824
+ super("injective_trading_rpc.StreamStrategyResponse", [
1825
+ { no: 1, name: "trading_strategy", kind: "message", T: () => TradingStrategy },
1826
+ { no: 2, name: "timestamp", kind: "scalar", T: 18 /*ScalarType.SINT64*/, L: 0 /*LongType.BIGINT*/ }
1827
+ ]);
1828
+ }
1829
+ create(value?: PartialMessage<StreamStrategyResponse>): StreamStrategyResponse {
1830
+ const message = globalThis.Object.create((this.messagePrototype!));
1831
+ message.timestamp = 0n;
1832
+ if (value !== undefined)
1833
+ reflectionMergePartial<StreamStrategyResponse>(this, message, value);
1834
+ return message;
1835
+ }
1836
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StreamStrategyResponse): StreamStrategyResponse {
1837
+ let message = target ?? this.create(), end = reader.pos + length;
1838
+ while (reader.pos < end) {
1839
+ let [fieldNo, wireType] = reader.tag();
1840
+ switch (fieldNo) {
1841
+ case /* injective_trading_rpc.TradingStrategy trading_strategy */ 1:
1842
+ message.tradingStrategy = TradingStrategy.internalBinaryRead(reader, reader.uint32(), options, message.tradingStrategy);
1843
+ break;
1844
+ case /* sint64 timestamp */ 2:
1845
+ message.timestamp = reader.sint64().toBigInt();
1846
+ break;
1847
+ default:
1848
+ let u = options.readUnknownField;
1849
+ if (u === "throw")
1850
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1851
+ let d = reader.skip(wireType);
1852
+ if (u !== false)
1853
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1854
+ }
1855
+ }
1856
+ return message;
1857
+ }
1858
+ internalBinaryWrite(message: StreamStrategyResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
1859
+ /* injective_trading_rpc.TradingStrategy trading_strategy = 1; */
1860
+ if (message.tradingStrategy)
1861
+ TradingStrategy.internalBinaryWrite(message.tradingStrategy, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
1862
+ /* sint64 timestamp = 2; */
1863
+ if (message.timestamp !== 0n)
1864
+ writer.tag(2, WireType.Varint).sint64(message.timestamp);
1865
+ let u = options.writeUnknownFields;
1866
+ if (u !== false)
1867
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1868
+ return writer;
1869
+ }
1870
+ }
1871
+ /**
1872
+ * @generated MessageType for protobuf message injective_trading_rpc.StreamStrategyResponse
1873
+ */
1874
+ export const StreamStrategyResponse = new StreamStrategyResponse$Type();
1875
+ /**
1876
+ * @generated ServiceType for protobuf service injective_trading_rpc.InjectiveTradingRPC
1877
+ */
1878
+ export const InjectiveTradingRPC = new ServiceType("injective_trading_rpc.InjectiveTradingRPC", [
1879
+ { name: "ListTradingStrategies", options: {}, I: ListTradingStrategiesRequest, O: ListTradingStrategiesResponse },
1880
+ { name: "GetTradingStats", options: {}, I: GetTradingStatsRequest, O: GetTradingStatsResponse },
1881
+ { name: "StreamStrategy", serverStreaming: true, options: {}, I: StreamStrategyRequest, O: StreamStrategyResponse }
1882
+ ]);