@limeint/trade-api 2.18.1-rc.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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/dist/accounts.d.ts +2 -0
  4. package/dist/accounts.d.ts.map +1 -0
  5. package/dist/accounts.js +2 -0
  6. package/dist/accounts.js.map +1 -0
  7. package/dist/assets.d.ts +2 -0
  8. package/dist/assets.d.ts.map +1 -0
  9. package/dist/assets.js +2 -0
  10. package/dist/assets.js.map +1 -0
  11. package/dist/auth.d.ts +2 -0
  12. package/dist/auth.d.ts.map +1 -0
  13. package/dist/auth.js +2 -0
  14. package/dist/auth.js.map +1 -0
  15. package/dist/client.d.ts +53 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +143 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/corporate-actions.d.ts +2 -0
  20. package/dist/corporate-actions.d.ts.map +1 -0
  21. package/dist/corporate-actions.js +2 -0
  22. package/dist/corporate-actions.js.map +1 -0
  23. package/dist/errors.d.ts +31 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +57 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/generated/google/protobuf/timestamp.d.ts +123 -0
  28. package/dist/generated/google/protobuf/timestamp.d.ts.map +1 -0
  29. package/dist/generated/google/protobuf/timestamp.js +83 -0
  30. package/dist/generated/google/protobuf/timestamp.js.map +1 -0
  31. package/dist/generated/google/protobuf/wrappers.d.ts +106 -0
  32. package/dist/generated/google/protobuf/wrappers.d.ts.map +1 -0
  33. package/dist/generated/google/protobuf/wrappers.js +502 -0
  34. package/dist/generated/google/protobuf/wrappers.js.map +1 -0
  35. package/dist/generated/google/type/date.d.ts +50 -0
  36. package/dist/generated/google/type/date.d.ts.map +1 -0
  37. package/dist/generated/google/type/date.js +95 -0
  38. package/dist/generated/google/type/date.js.map +1 -0
  39. package/dist/generated/google/type/decimal.d.ts +91 -0
  40. package/dist/generated/google/type/decimal.d.ts.map +1 -0
  41. package/dist/generated/google/type/decimal.js +63 -0
  42. package/dist/generated/google/type/decimal.js.map +1 -0
  43. package/dist/generated/google/type/interval.d.ts +41 -0
  44. package/dist/generated/google/type/interval.d.ts.map +1 -0
  45. package/dist/generated/google/type/interval.js +110 -0
  46. package/dist/generated/google/type/interval.js.map +1 -0
  47. package/dist/generated/google/type/money.d.ts +36 -0
  48. package/dist/generated/google/type/money.d.ts.map +1 -0
  49. package/dist/generated/google/type/money.js +102 -0
  50. package/dist/generated/google/type/money.js.map +1 -0
  51. package/dist/generated/grpc/tradeapi/v1/accounts/accounts_service.d.ts +357 -0
  52. package/dist/generated/grpc/tradeapi/v1/accounts/accounts_service.d.ts.map +1 -0
  53. package/dist/generated/grpc/tradeapi/v1/accounts/accounts_service.js +1791 -0
  54. package/dist/generated/grpc/tradeapi/v1/accounts/accounts_service.js.map +1 -0
  55. package/dist/generated/grpc/tradeapi/v1/assets/assets_service.d.ts +742 -0
  56. package/dist/generated/grpc/tradeapi/v1/assets/assets_service.d.ts.map +1 -0
  57. package/dist/generated/grpc/tradeapi/v1/assets/assets_service.js +3897 -0
  58. package/dist/generated/grpc/tradeapi/v1/assets/assets_service.js.map +1 -0
  59. package/dist/generated/grpc/tradeapi/v1/auth/auth_service.d.ts +230 -0
  60. package/dist/generated/grpc/tradeapi/v1/auth/auth_service.d.ts.map +1 -0
  61. package/dist/generated/grpc/tradeapi/v1/auth/auth_service.js +779 -0
  62. package/dist/generated/grpc/tradeapi/v1/auth/auth_service.js.map +1 -0
  63. package/dist/generated/grpc/tradeapi/v1/corporateactions/corporate_actions_service.d.ts +419 -0
  64. package/dist/generated/grpc/tradeapi/v1/corporateactions/corporate_actions_service.d.ts.map +1 -0
  65. package/dist/generated/grpc/tradeapi/v1/corporateactions/corporate_actions_service.js +2844 -0
  66. package/dist/generated/grpc/tradeapi/v1/corporateactions/corporate_actions_service.js.map +1 -0
  67. package/dist/generated/grpc/tradeapi/v1/marketdata/marketdata_service.d.ts +553 -0
  68. package/dist/generated/grpc/tradeapi/v1/marketdata/marketdata_service.d.ts.map +1 -0
  69. package/dist/generated/grpc/tradeapi/v1/marketdata/marketdata_service.js +3038 -0
  70. package/dist/generated/grpc/tradeapi/v1/marketdata/marketdata_service.js.map +1 -0
  71. package/dist/generated/grpc/tradeapi/v1/metrics/usage_metrics_service.d.ts +88 -0
  72. package/dist/generated/grpc/tradeapi/v1/metrics/usage_metrics_service.d.ts.map +1 -0
  73. package/dist/generated/grpc/tradeapi/v1/metrics/usage_metrics_service.js +284 -0
  74. package/dist/generated/grpc/tradeapi/v1/metrics/usage_metrics_service.js.map +1 -0
  75. package/dist/generated/grpc/tradeapi/v1/orders/orders_service.d.ts +730 -0
  76. package/dist/generated/grpc/tradeapi/v1/orders/orders_service.d.ts.map +1 -0
  77. package/dist/generated/grpc/tradeapi/v1/orders/orders_service.js +3113 -0
  78. package/dist/generated/grpc/tradeapi/v1/orders/orders_service.js.map +1 -0
  79. package/dist/generated/grpc/tradeapi/v1/reports/reports_service.d.ts +203 -0
  80. package/dist/generated/grpc/tradeapi/v1/reports/reports_service.d.ts.map +1 -0
  81. package/dist/generated/grpc/tradeapi/v1/reports/reports_service.js +871 -0
  82. package/dist/generated/grpc/tradeapi/v1/reports/reports_service.js.map +1 -0
  83. package/dist/generated/grpc/tradeapi/v1/side.d.ts +14 -0
  84. package/dist/generated/grpc/tradeapi/v1/side.d.ts.map +1 -0
  85. package/dist/generated/grpc/tradeapi/v1/side.js +49 -0
  86. package/dist/generated/grpc/tradeapi/v1/side.js.map +1 -0
  87. package/dist/generated/grpc/tradeapi/v1/trade.d.ts +48 -0
  88. package/dist/generated/grpc/tradeapi/v1/trade.d.ts.map +1 -0
  89. package/dist/generated/grpc/tradeapi/v1/trade.js +271 -0
  90. package/dist/generated/grpc/tradeapi/v1/trade.js.map +1 -0
  91. package/dist/index.d.ts +4 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +4 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/market-data.d.ts +2 -0
  96. package/dist/market-data.d.ts.map +1 -0
  97. package/dist/market-data.js +2 -0
  98. package/dist/market-data.js.map +1 -0
  99. package/dist/metrics.d.ts +2 -0
  100. package/dist/metrics.d.ts.map +1 -0
  101. package/dist/metrics.js +2 -0
  102. package/dist/metrics.js.map +1 -0
  103. package/dist/orders.d.ts +4 -0
  104. package/dist/orders.d.ts.map +1 -0
  105. package/dist/orders.js +4 -0
  106. package/dist/orders.js.map +1 -0
  107. package/dist/reports.d.ts +2 -0
  108. package/dist/reports.d.ts.map +1 -0
  109. package/dist/reports.js +2 -0
  110. package/dist/reports.js.map +1 -0
  111. package/package.json +97 -0
@@ -0,0 +1,1791 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.19.1
5
+ // source: grpc/tradeapi/v1/accounts/accounts_service.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { Timestamp } from "../../../../google/protobuf/timestamp.js";
9
+ import { Decimal } from "../../../../google/type/decimal.js";
10
+ import { Interval } from "../../../../google/type/interval.js";
11
+ import { Money } from "../../../../google/type/money.js";
12
+ import { AccountTrade } from "../trade.js";
13
+ export const protobufPackage = "grpc.tradeapi.v1.accounts";
14
+ /** Transaction categories. */
15
+ export var Transaction_TransactionCategory;
16
+ (function (Transaction_TransactionCategory) {
17
+ /** OTHERS - Other */
18
+ Transaction_TransactionCategory[Transaction_TransactionCategory["OTHERS"] = 0] = "OTHERS";
19
+ /** DEPOSIT - Cash deposit */
20
+ Transaction_TransactionCategory[Transaction_TransactionCategory["DEPOSIT"] = 1] = "DEPOSIT";
21
+ /** WITHDRAW - Cash withdrawal */
22
+ Transaction_TransactionCategory[Transaction_TransactionCategory["WITHDRAW"] = 2] = "WITHDRAW";
23
+ /** INCOME - Income */
24
+ Transaction_TransactionCategory[Transaction_TransactionCategory["INCOME"] = 5] = "INCOME";
25
+ /** COMMISSION - Commission */
26
+ Transaction_TransactionCategory[Transaction_TransactionCategory["COMMISSION"] = 7] = "COMMISSION";
27
+ /** TAX - Tax */
28
+ Transaction_TransactionCategory[Transaction_TransactionCategory["TAX"] = 8] = "TAX";
29
+ /** INHERITANCE - Inheritance */
30
+ Transaction_TransactionCategory[Transaction_TransactionCategory["INHERITANCE"] = 9] = "INHERITANCE";
31
+ /** TRANSFER - Cash transfer */
32
+ Transaction_TransactionCategory[Transaction_TransactionCategory["TRANSFER"] = 11] = "TRANSFER";
33
+ /** CONTRACT_TERMINATION - Termination of the contract */
34
+ Transaction_TransactionCategory[Transaction_TransactionCategory["CONTRACT_TERMINATION"] = 12] = "CONTRACT_TERMINATION";
35
+ /** OUTCOMES - Expenses */
36
+ Transaction_TransactionCategory[Transaction_TransactionCategory["OUTCOMES"] = 13] = "OUTCOMES";
37
+ /** FINE - Fine */
38
+ Transaction_TransactionCategory[Transaction_TransactionCategory["FINE"] = 15] = "FINE";
39
+ /** LOAN - Loan */
40
+ Transaction_TransactionCategory[Transaction_TransactionCategory["LOAN"] = 19] = "LOAN";
41
+ Transaction_TransactionCategory[Transaction_TransactionCategory["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
42
+ })(Transaction_TransactionCategory || (Transaction_TransactionCategory = {}));
43
+ export function transaction_TransactionCategoryFromJSON(object) {
44
+ switch (object) {
45
+ case 0:
46
+ case "OTHERS":
47
+ return Transaction_TransactionCategory.OTHERS;
48
+ case 1:
49
+ case "DEPOSIT":
50
+ return Transaction_TransactionCategory.DEPOSIT;
51
+ case 2:
52
+ case "WITHDRAW":
53
+ return Transaction_TransactionCategory.WITHDRAW;
54
+ case 5:
55
+ case "INCOME":
56
+ return Transaction_TransactionCategory.INCOME;
57
+ case 7:
58
+ case "COMMISSION":
59
+ return Transaction_TransactionCategory.COMMISSION;
60
+ case 8:
61
+ case "TAX":
62
+ return Transaction_TransactionCategory.TAX;
63
+ case 9:
64
+ case "INHERITANCE":
65
+ return Transaction_TransactionCategory.INHERITANCE;
66
+ case 11:
67
+ case "TRANSFER":
68
+ return Transaction_TransactionCategory.TRANSFER;
69
+ case 12:
70
+ case "CONTRACT_TERMINATION":
71
+ return Transaction_TransactionCategory.CONTRACT_TERMINATION;
72
+ case 13:
73
+ case "OUTCOMES":
74
+ return Transaction_TransactionCategory.OUTCOMES;
75
+ case 15:
76
+ case "FINE":
77
+ return Transaction_TransactionCategory.FINE;
78
+ case 19:
79
+ case "LOAN":
80
+ return Transaction_TransactionCategory.LOAN;
81
+ case -1:
82
+ case "UNRECOGNIZED":
83
+ default:
84
+ return Transaction_TransactionCategory.UNRECOGNIZED;
85
+ }
86
+ }
87
+ export function transaction_TransactionCategoryToJSON(object) {
88
+ switch (object) {
89
+ case Transaction_TransactionCategory.OTHERS:
90
+ return "OTHERS";
91
+ case Transaction_TransactionCategory.DEPOSIT:
92
+ return "DEPOSIT";
93
+ case Transaction_TransactionCategory.WITHDRAW:
94
+ return "WITHDRAW";
95
+ case Transaction_TransactionCategory.INCOME:
96
+ return "INCOME";
97
+ case Transaction_TransactionCategory.COMMISSION:
98
+ return "COMMISSION";
99
+ case Transaction_TransactionCategory.TAX:
100
+ return "TAX";
101
+ case Transaction_TransactionCategory.INHERITANCE:
102
+ return "INHERITANCE";
103
+ case Transaction_TransactionCategory.TRANSFER:
104
+ return "TRANSFER";
105
+ case Transaction_TransactionCategory.CONTRACT_TERMINATION:
106
+ return "CONTRACT_TERMINATION";
107
+ case Transaction_TransactionCategory.OUTCOMES:
108
+ return "OUTCOMES";
109
+ case Transaction_TransactionCategory.FINE:
110
+ return "FINE";
111
+ case Transaction_TransactionCategory.LOAN:
112
+ return "LOAN";
113
+ case Transaction_TransactionCategory.UNRECOGNIZED:
114
+ default:
115
+ return "UNRECOGNIZED";
116
+ }
117
+ }
118
+ function createBaseGetAccountRequest() {
119
+ return { accountId: "" };
120
+ }
121
+ export const GetAccountRequest = {
122
+ encode(message, writer = new BinaryWriter()) {
123
+ if (message.accountId !== "") {
124
+ writer.uint32(10).string(message.accountId);
125
+ }
126
+ return writer;
127
+ },
128
+ decode(input, length) {
129
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
130
+ const end = length === undefined ? reader.len : reader.pos + length;
131
+ const message = createBaseGetAccountRequest();
132
+ while (reader.pos < end) {
133
+ const tag = reader.uint32();
134
+ switch (tag >>> 3) {
135
+ case 1: {
136
+ if (tag !== 10) {
137
+ break;
138
+ }
139
+ message.accountId = reader.string();
140
+ continue;
141
+ }
142
+ }
143
+ if ((tag & 7) === 4 || tag === 0) {
144
+ break;
145
+ }
146
+ reader.skip(tag & 7);
147
+ }
148
+ return message;
149
+ },
150
+ fromJSON(object) {
151
+ return {
152
+ accountId: isSet(object.accountId)
153
+ ? globalThis.String(object.accountId)
154
+ : isSet(object.account_id)
155
+ ? globalThis.String(object.account_id)
156
+ : "",
157
+ };
158
+ },
159
+ toJSON(message) {
160
+ const obj = {};
161
+ if (message.accountId !== "") {
162
+ obj.accountId = message.accountId;
163
+ }
164
+ return obj;
165
+ },
166
+ create(base) {
167
+ return GetAccountRequest.fromPartial(base ?? {});
168
+ },
169
+ fromPartial(object) {
170
+ const message = createBaseGetAccountRequest();
171
+ message.accountId = object.accountId ?? "";
172
+ return message;
173
+ },
174
+ };
175
+ function createBaseGetAccountResponse() {
176
+ return {
177
+ accountId: "",
178
+ type: "",
179
+ status: "",
180
+ equity: undefined,
181
+ unrealizedProfit: undefined,
182
+ positions: [],
183
+ cash: [],
184
+ portfolioMc: undefined,
185
+ portfolioMct: undefined,
186
+ portfolioForts: undefined,
187
+ openAccountDate: undefined,
188
+ firstTradeDate: undefined,
189
+ firstNonTradeDate: undefined,
190
+ };
191
+ }
192
+ export const GetAccountResponse = {
193
+ encode(message, writer = new BinaryWriter()) {
194
+ if (message.accountId !== "") {
195
+ writer.uint32(10).string(message.accountId);
196
+ }
197
+ if (message.type !== "") {
198
+ writer.uint32(18).string(message.type);
199
+ }
200
+ if (message.status !== "") {
201
+ writer.uint32(26).string(message.status);
202
+ }
203
+ if (message.equity !== undefined) {
204
+ Decimal.encode(message.equity, writer.uint32(34).fork()).join();
205
+ }
206
+ if (message.unrealizedProfit !== undefined) {
207
+ Decimal.encode(message.unrealizedProfit, writer.uint32(42).fork()).join();
208
+ }
209
+ for (const v of message.positions) {
210
+ Position.encode(v, writer.uint32(50).fork()).join();
211
+ }
212
+ for (const v of message.cash) {
213
+ Money.encode(v, writer.uint32(58).fork()).join();
214
+ }
215
+ if (message.portfolioMc !== undefined) {
216
+ MC.encode(message.portfolioMc, writer.uint32(66).fork()).join();
217
+ }
218
+ if (message.portfolioMct !== undefined) {
219
+ MCT.encode(message.portfolioMct, writer.uint32(74).fork()).join();
220
+ }
221
+ if (message.portfolioForts !== undefined) {
222
+ FORTS.encode(message.portfolioForts, writer.uint32(82).fork()).join();
223
+ }
224
+ if (message.openAccountDate !== undefined) {
225
+ Timestamp.encode(toTimestamp(message.openAccountDate), writer.uint32(90).fork()).join();
226
+ }
227
+ if (message.firstTradeDate !== undefined) {
228
+ Timestamp.encode(toTimestamp(message.firstTradeDate), writer.uint32(98).fork()).join();
229
+ }
230
+ if (message.firstNonTradeDate !== undefined) {
231
+ Timestamp.encode(toTimestamp(message.firstNonTradeDate), writer.uint32(106).fork()).join();
232
+ }
233
+ return writer;
234
+ },
235
+ decode(input, length) {
236
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
237
+ const end = length === undefined ? reader.len : reader.pos + length;
238
+ const message = createBaseGetAccountResponse();
239
+ while (reader.pos < end) {
240
+ const tag = reader.uint32();
241
+ switch (tag >>> 3) {
242
+ case 1: {
243
+ if (tag !== 10) {
244
+ break;
245
+ }
246
+ message.accountId = reader.string();
247
+ continue;
248
+ }
249
+ case 2: {
250
+ if (tag !== 18) {
251
+ break;
252
+ }
253
+ message.type = reader.string();
254
+ continue;
255
+ }
256
+ case 3: {
257
+ if (tag !== 26) {
258
+ break;
259
+ }
260
+ message.status = reader.string();
261
+ continue;
262
+ }
263
+ case 4: {
264
+ if (tag !== 34) {
265
+ break;
266
+ }
267
+ message.equity = Decimal.decode(reader, reader.uint32());
268
+ continue;
269
+ }
270
+ case 5: {
271
+ if (tag !== 42) {
272
+ break;
273
+ }
274
+ message.unrealizedProfit = Decimal.decode(reader, reader.uint32());
275
+ continue;
276
+ }
277
+ case 6: {
278
+ if (tag !== 50) {
279
+ break;
280
+ }
281
+ message.positions.push(Position.decode(reader, reader.uint32()));
282
+ continue;
283
+ }
284
+ case 7: {
285
+ if (tag !== 58) {
286
+ break;
287
+ }
288
+ message.cash.push(Money.decode(reader, reader.uint32()));
289
+ continue;
290
+ }
291
+ case 8: {
292
+ if (tag !== 66) {
293
+ break;
294
+ }
295
+ message.portfolioMc = MC.decode(reader, reader.uint32());
296
+ continue;
297
+ }
298
+ case 9: {
299
+ if (tag !== 74) {
300
+ break;
301
+ }
302
+ message.portfolioMct = MCT.decode(reader, reader.uint32());
303
+ continue;
304
+ }
305
+ case 10: {
306
+ if (tag !== 82) {
307
+ break;
308
+ }
309
+ message.portfolioForts = FORTS.decode(reader, reader.uint32());
310
+ continue;
311
+ }
312
+ case 11: {
313
+ if (tag !== 90) {
314
+ break;
315
+ }
316
+ message.openAccountDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
317
+ continue;
318
+ }
319
+ case 12: {
320
+ if (tag !== 98) {
321
+ break;
322
+ }
323
+ message.firstTradeDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
324
+ continue;
325
+ }
326
+ case 13: {
327
+ if (tag !== 106) {
328
+ break;
329
+ }
330
+ message.firstNonTradeDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
331
+ continue;
332
+ }
333
+ }
334
+ if ((tag & 7) === 4 || tag === 0) {
335
+ break;
336
+ }
337
+ reader.skip(tag & 7);
338
+ }
339
+ return message;
340
+ },
341
+ fromJSON(object) {
342
+ return {
343
+ accountId: isSet(object.accountId)
344
+ ? globalThis.String(object.accountId)
345
+ : isSet(object.account_id)
346
+ ? globalThis.String(object.account_id)
347
+ : "",
348
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
349
+ status: isSet(object.status) ? globalThis.String(object.status) : "",
350
+ equity: isSet(object.equity) ? Decimal.fromJSON(object.equity) : undefined,
351
+ unrealizedProfit: isSet(object.unrealizedProfit)
352
+ ? Decimal.fromJSON(object.unrealizedProfit)
353
+ : isSet(object.unrealized_profit)
354
+ ? Decimal.fromJSON(object.unrealized_profit)
355
+ : undefined,
356
+ positions: globalThis.Array.isArray(object?.positions)
357
+ ? object.positions.map((e) => Position.fromJSON(e))
358
+ : [],
359
+ cash: globalThis.Array.isArray(object?.cash) ? object.cash.map((e) => Money.fromJSON(e)) : [],
360
+ portfolioMc: isSet(object.portfolioMc)
361
+ ? MC.fromJSON(object.portfolioMc)
362
+ : isSet(object.portfolio_mc)
363
+ ? MC.fromJSON(object.portfolio_mc)
364
+ : undefined,
365
+ portfolioMct: isSet(object.portfolioMct)
366
+ ? MCT.fromJSON(object.portfolioMct)
367
+ : isSet(object.portfolio_mct)
368
+ ? MCT.fromJSON(object.portfolio_mct)
369
+ : undefined,
370
+ portfolioForts: isSet(object.portfolioForts)
371
+ ? FORTS.fromJSON(object.portfolioForts)
372
+ : isSet(object.portfolio_forts)
373
+ ? FORTS.fromJSON(object.portfolio_forts)
374
+ : undefined,
375
+ openAccountDate: isSet(object.openAccountDate)
376
+ ? fromJsonTimestamp(object.openAccountDate)
377
+ : isSet(object.open_account_date)
378
+ ? fromJsonTimestamp(object.open_account_date)
379
+ : undefined,
380
+ firstTradeDate: isSet(object.firstTradeDate)
381
+ ? fromJsonTimestamp(object.firstTradeDate)
382
+ : isSet(object.first_trade_date)
383
+ ? fromJsonTimestamp(object.first_trade_date)
384
+ : undefined,
385
+ firstNonTradeDate: isSet(object.firstNonTradeDate)
386
+ ? fromJsonTimestamp(object.firstNonTradeDate)
387
+ : isSet(object.first_non_trade_date)
388
+ ? fromJsonTimestamp(object.first_non_trade_date)
389
+ : undefined,
390
+ };
391
+ },
392
+ toJSON(message) {
393
+ const obj = {};
394
+ if (message.accountId !== "") {
395
+ obj.accountId = message.accountId;
396
+ }
397
+ if (message.type !== "") {
398
+ obj.type = message.type;
399
+ }
400
+ if (message.status !== "") {
401
+ obj.status = message.status;
402
+ }
403
+ if (message.equity !== undefined) {
404
+ obj.equity = Decimal.toJSON(message.equity);
405
+ }
406
+ if (message.unrealizedProfit !== undefined) {
407
+ obj.unrealizedProfit = Decimal.toJSON(message.unrealizedProfit);
408
+ }
409
+ if (message.positions?.length) {
410
+ obj.positions = message.positions.map((e) => Position.toJSON(e));
411
+ }
412
+ if (message.cash?.length) {
413
+ obj.cash = message.cash.map((e) => Money.toJSON(e));
414
+ }
415
+ if (message.portfolioMc !== undefined) {
416
+ obj.portfolioMc = MC.toJSON(message.portfolioMc);
417
+ }
418
+ if (message.portfolioMct !== undefined) {
419
+ obj.portfolioMct = MCT.toJSON(message.portfolioMct);
420
+ }
421
+ if (message.portfolioForts !== undefined) {
422
+ obj.portfolioForts = FORTS.toJSON(message.portfolioForts);
423
+ }
424
+ if (message.openAccountDate !== undefined) {
425
+ obj.openAccountDate = message.openAccountDate.toISOString();
426
+ }
427
+ if (message.firstTradeDate !== undefined) {
428
+ obj.firstTradeDate = message.firstTradeDate.toISOString();
429
+ }
430
+ if (message.firstNonTradeDate !== undefined) {
431
+ obj.firstNonTradeDate = message.firstNonTradeDate.toISOString();
432
+ }
433
+ return obj;
434
+ },
435
+ create(base) {
436
+ return GetAccountResponse.fromPartial(base ?? {});
437
+ },
438
+ fromPartial(object) {
439
+ const message = createBaseGetAccountResponse();
440
+ message.accountId = object.accountId ?? "";
441
+ message.type = object.type ?? "";
442
+ message.status = object.status ?? "";
443
+ message.equity = (object.equity !== undefined && object.equity !== null)
444
+ ? Decimal.fromPartial(object.equity)
445
+ : undefined;
446
+ message.unrealizedProfit = (object.unrealizedProfit !== undefined && object.unrealizedProfit !== null)
447
+ ? Decimal.fromPartial(object.unrealizedProfit)
448
+ : undefined;
449
+ message.positions = object.positions?.map((e) => Position.fromPartial(e)) || [];
450
+ message.cash = object.cash?.map((e) => Money.fromPartial(e)) || [];
451
+ message.portfolioMc = (object.portfolioMc !== undefined && object.portfolioMc !== null)
452
+ ? MC.fromPartial(object.portfolioMc)
453
+ : undefined;
454
+ message.portfolioMct = (object.portfolioMct !== undefined && object.portfolioMct !== null)
455
+ ? MCT.fromPartial(object.portfolioMct)
456
+ : undefined;
457
+ message.portfolioForts = (object.portfolioForts !== undefined && object.portfolioForts !== null)
458
+ ? FORTS.fromPartial(object.portfolioForts)
459
+ : undefined;
460
+ message.openAccountDate = object.openAccountDate ?? undefined;
461
+ message.firstTradeDate = object.firstTradeDate ?? undefined;
462
+ message.firstNonTradeDate = object.firstNonTradeDate ?? undefined;
463
+ return message;
464
+ },
465
+ };
466
+ function createBaseMC() {
467
+ return { availableCash: undefined, initialMargin: undefined, maintenanceMargin: undefined };
468
+ }
469
+ export const MC = {
470
+ encode(message, writer = new BinaryWriter()) {
471
+ if (message.availableCash !== undefined) {
472
+ Decimal.encode(message.availableCash, writer.uint32(10).fork()).join();
473
+ }
474
+ if (message.initialMargin !== undefined) {
475
+ Decimal.encode(message.initialMargin, writer.uint32(18).fork()).join();
476
+ }
477
+ if (message.maintenanceMargin !== undefined) {
478
+ Decimal.encode(message.maintenanceMargin, writer.uint32(26).fork()).join();
479
+ }
480
+ return writer;
481
+ },
482
+ decode(input, length) {
483
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
484
+ const end = length === undefined ? reader.len : reader.pos + length;
485
+ const message = createBaseMC();
486
+ while (reader.pos < end) {
487
+ const tag = reader.uint32();
488
+ switch (tag >>> 3) {
489
+ case 1: {
490
+ if (tag !== 10) {
491
+ break;
492
+ }
493
+ message.availableCash = Decimal.decode(reader, reader.uint32());
494
+ continue;
495
+ }
496
+ case 2: {
497
+ if (tag !== 18) {
498
+ break;
499
+ }
500
+ message.initialMargin = Decimal.decode(reader, reader.uint32());
501
+ continue;
502
+ }
503
+ case 3: {
504
+ if (tag !== 26) {
505
+ break;
506
+ }
507
+ message.maintenanceMargin = Decimal.decode(reader, reader.uint32());
508
+ continue;
509
+ }
510
+ }
511
+ if ((tag & 7) === 4 || tag === 0) {
512
+ break;
513
+ }
514
+ reader.skip(tag & 7);
515
+ }
516
+ return message;
517
+ },
518
+ fromJSON(object) {
519
+ return {
520
+ availableCash: isSet(object.availableCash)
521
+ ? Decimal.fromJSON(object.availableCash)
522
+ : isSet(object.available_cash)
523
+ ? Decimal.fromJSON(object.available_cash)
524
+ : undefined,
525
+ initialMargin: isSet(object.initialMargin)
526
+ ? Decimal.fromJSON(object.initialMargin)
527
+ : isSet(object.initial_margin)
528
+ ? Decimal.fromJSON(object.initial_margin)
529
+ : undefined,
530
+ maintenanceMargin: isSet(object.maintenanceMargin)
531
+ ? Decimal.fromJSON(object.maintenanceMargin)
532
+ : isSet(object.maintenance_margin)
533
+ ? Decimal.fromJSON(object.maintenance_margin)
534
+ : undefined,
535
+ };
536
+ },
537
+ toJSON(message) {
538
+ const obj = {};
539
+ if (message.availableCash !== undefined) {
540
+ obj.availableCash = Decimal.toJSON(message.availableCash);
541
+ }
542
+ if (message.initialMargin !== undefined) {
543
+ obj.initialMargin = Decimal.toJSON(message.initialMargin);
544
+ }
545
+ if (message.maintenanceMargin !== undefined) {
546
+ obj.maintenanceMargin = Decimal.toJSON(message.maintenanceMargin);
547
+ }
548
+ return obj;
549
+ },
550
+ create(base) {
551
+ return MC.fromPartial(base ?? {});
552
+ },
553
+ fromPartial(object) {
554
+ const message = createBaseMC();
555
+ message.availableCash = (object.availableCash !== undefined && object.availableCash !== null)
556
+ ? Decimal.fromPartial(object.availableCash)
557
+ : undefined;
558
+ message.initialMargin = (object.initialMargin !== undefined && object.initialMargin !== null)
559
+ ? Decimal.fromPartial(object.initialMargin)
560
+ : undefined;
561
+ message.maintenanceMargin = (object.maintenanceMargin !== undefined && object.maintenanceMargin !== null)
562
+ ? Decimal.fromPartial(object.maintenanceMargin)
563
+ : undefined;
564
+ return message;
565
+ },
566
+ };
567
+ function createBaseMCT() {
568
+ return {};
569
+ }
570
+ export const MCT = {
571
+ encode(_, writer = new BinaryWriter()) {
572
+ return writer;
573
+ },
574
+ decode(input, length) {
575
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
576
+ const end = length === undefined ? reader.len : reader.pos + length;
577
+ const message = createBaseMCT();
578
+ while (reader.pos < end) {
579
+ const tag = reader.uint32();
580
+ switch (tag >>> 3) {
581
+ }
582
+ if ((tag & 7) === 4 || tag === 0) {
583
+ break;
584
+ }
585
+ reader.skip(tag & 7);
586
+ }
587
+ return message;
588
+ },
589
+ fromJSON(_) {
590
+ return {};
591
+ },
592
+ toJSON(_) {
593
+ const obj = {};
594
+ return obj;
595
+ },
596
+ create(base) {
597
+ return MCT.fromPartial(base ?? {});
598
+ },
599
+ fromPartial(_) {
600
+ const message = createBaseMCT();
601
+ return message;
602
+ },
603
+ };
604
+ function createBaseFORTS() {
605
+ return { availableCash: undefined, moneyReserved: undefined };
606
+ }
607
+ export const FORTS = {
608
+ encode(message, writer = new BinaryWriter()) {
609
+ if (message.availableCash !== undefined) {
610
+ Decimal.encode(message.availableCash, writer.uint32(10).fork()).join();
611
+ }
612
+ if (message.moneyReserved !== undefined) {
613
+ Decimal.encode(message.moneyReserved, writer.uint32(18).fork()).join();
614
+ }
615
+ return writer;
616
+ },
617
+ decode(input, length) {
618
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
619
+ const end = length === undefined ? reader.len : reader.pos + length;
620
+ const message = createBaseFORTS();
621
+ while (reader.pos < end) {
622
+ const tag = reader.uint32();
623
+ switch (tag >>> 3) {
624
+ case 1: {
625
+ if (tag !== 10) {
626
+ break;
627
+ }
628
+ message.availableCash = Decimal.decode(reader, reader.uint32());
629
+ continue;
630
+ }
631
+ case 2: {
632
+ if (tag !== 18) {
633
+ break;
634
+ }
635
+ message.moneyReserved = Decimal.decode(reader, reader.uint32());
636
+ continue;
637
+ }
638
+ }
639
+ if ((tag & 7) === 4 || tag === 0) {
640
+ break;
641
+ }
642
+ reader.skip(tag & 7);
643
+ }
644
+ return message;
645
+ },
646
+ fromJSON(object) {
647
+ return {
648
+ availableCash: isSet(object.availableCash)
649
+ ? Decimal.fromJSON(object.availableCash)
650
+ : isSet(object.available_cash)
651
+ ? Decimal.fromJSON(object.available_cash)
652
+ : undefined,
653
+ moneyReserved: isSet(object.moneyReserved)
654
+ ? Decimal.fromJSON(object.moneyReserved)
655
+ : isSet(object.money_reserved)
656
+ ? Decimal.fromJSON(object.money_reserved)
657
+ : undefined,
658
+ };
659
+ },
660
+ toJSON(message) {
661
+ const obj = {};
662
+ if (message.availableCash !== undefined) {
663
+ obj.availableCash = Decimal.toJSON(message.availableCash);
664
+ }
665
+ if (message.moneyReserved !== undefined) {
666
+ obj.moneyReserved = Decimal.toJSON(message.moneyReserved);
667
+ }
668
+ return obj;
669
+ },
670
+ create(base) {
671
+ return FORTS.fromPartial(base ?? {});
672
+ },
673
+ fromPartial(object) {
674
+ const message = createBaseFORTS();
675
+ message.availableCash = (object.availableCash !== undefined && object.availableCash !== null)
676
+ ? Decimal.fromPartial(object.availableCash)
677
+ : undefined;
678
+ message.moneyReserved = (object.moneyReserved !== undefined && object.moneyReserved !== null)
679
+ ? Decimal.fromPartial(object.moneyReserved)
680
+ : undefined;
681
+ return message;
682
+ },
683
+ };
684
+ function createBaseTradesRequest() {
685
+ return { accountId: "", limit: 0, interval: undefined };
686
+ }
687
+ export const TradesRequest = {
688
+ encode(message, writer = new BinaryWriter()) {
689
+ if (message.accountId !== "") {
690
+ writer.uint32(10).string(message.accountId);
691
+ }
692
+ if (message.limit !== 0) {
693
+ writer.uint32(16).int32(message.limit);
694
+ }
695
+ if (message.interval !== undefined) {
696
+ Interval.encode(message.interval, writer.uint32(26).fork()).join();
697
+ }
698
+ return writer;
699
+ },
700
+ decode(input, length) {
701
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
702
+ const end = length === undefined ? reader.len : reader.pos + length;
703
+ const message = createBaseTradesRequest();
704
+ while (reader.pos < end) {
705
+ const tag = reader.uint32();
706
+ switch (tag >>> 3) {
707
+ case 1: {
708
+ if (tag !== 10) {
709
+ break;
710
+ }
711
+ message.accountId = reader.string();
712
+ continue;
713
+ }
714
+ case 2: {
715
+ if (tag !== 16) {
716
+ break;
717
+ }
718
+ message.limit = reader.int32();
719
+ continue;
720
+ }
721
+ case 3: {
722
+ if (tag !== 26) {
723
+ break;
724
+ }
725
+ message.interval = Interval.decode(reader, reader.uint32());
726
+ continue;
727
+ }
728
+ }
729
+ if ((tag & 7) === 4 || tag === 0) {
730
+ break;
731
+ }
732
+ reader.skip(tag & 7);
733
+ }
734
+ return message;
735
+ },
736
+ fromJSON(object) {
737
+ return {
738
+ accountId: isSet(object.accountId)
739
+ ? globalThis.String(object.accountId)
740
+ : isSet(object.account_id)
741
+ ? globalThis.String(object.account_id)
742
+ : "",
743
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
744
+ interval: isSet(object.interval) ? Interval.fromJSON(object.interval) : undefined,
745
+ };
746
+ },
747
+ toJSON(message) {
748
+ const obj = {};
749
+ if (message.accountId !== "") {
750
+ obj.accountId = message.accountId;
751
+ }
752
+ if (message.limit !== 0) {
753
+ obj.limit = Math.round(message.limit);
754
+ }
755
+ if (message.interval !== undefined) {
756
+ obj.interval = Interval.toJSON(message.interval);
757
+ }
758
+ return obj;
759
+ },
760
+ create(base) {
761
+ return TradesRequest.fromPartial(base ?? {});
762
+ },
763
+ fromPartial(object) {
764
+ const message = createBaseTradesRequest();
765
+ message.accountId = object.accountId ?? "";
766
+ message.limit = object.limit ?? 0;
767
+ message.interval = (object.interval !== undefined && object.interval !== null)
768
+ ? Interval.fromPartial(object.interval)
769
+ : undefined;
770
+ return message;
771
+ },
772
+ };
773
+ function createBaseTradesResponse() {
774
+ return { trades: [] };
775
+ }
776
+ export const TradesResponse = {
777
+ encode(message, writer = new BinaryWriter()) {
778
+ for (const v of message.trades) {
779
+ AccountTrade.encode(v, writer.uint32(10).fork()).join();
780
+ }
781
+ return writer;
782
+ },
783
+ decode(input, length) {
784
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
785
+ const end = length === undefined ? reader.len : reader.pos + length;
786
+ const message = createBaseTradesResponse();
787
+ while (reader.pos < end) {
788
+ const tag = reader.uint32();
789
+ switch (tag >>> 3) {
790
+ case 1: {
791
+ if (tag !== 10) {
792
+ break;
793
+ }
794
+ message.trades.push(AccountTrade.decode(reader, reader.uint32()));
795
+ continue;
796
+ }
797
+ }
798
+ if ((tag & 7) === 4 || tag === 0) {
799
+ break;
800
+ }
801
+ reader.skip(tag & 7);
802
+ }
803
+ return message;
804
+ },
805
+ fromJSON(object) {
806
+ return {
807
+ trades: globalThis.Array.isArray(object?.trades) ? object.trades.map((e) => AccountTrade.fromJSON(e)) : [],
808
+ };
809
+ },
810
+ toJSON(message) {
811
+ const obj = {};
812
+ if (message.trades?.length) {
813
+ obj.trades = message.trades.map((e) => AccountTrade.toJSON(e));
814
+ }
815
+ return obj;
816
+ },
817
+ create(base) {
818
+ return TradesResponse.fromPartial(base ?? {});
819
+ },
820
+ fromPartial(object) {
821
+ const message = createBaseTradesResponse();
822
+ message.trades = object.trades?.map((e) => AccountTrade.fromPartial(e)) || [];
823
+ return message;
824
+ },
825
+ };
826
+ function createBaseTransactionsRequest() {
827
+ return { accountId: "", limit: 0, interval: undefined };
828
+ }
829
+ export const TransactionsRequest = {
830
+ encode(message, writer = new BinaryWriter()) {
831
+ if (message.accountId !== "") {
832
+ writer.uint32(10).string(message.accountId);
833
+ }
834
+ if (message.limit !== 0) {
835
+ writer.uint32(16).int32(message.limit);
836
+ }
837
+ if (message.interval !== undefined) {
838
+ Interval.encode(message.interval, writer.uint32(26).fork()).join();
839
+ }
840
+ return writer;
841
+ },
842
+ decode(input, length) {
843
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
844
+ const end = length === undefined ? reader.len : reader.pos + length;
845
+ const message = createBaseTransactionsRequest();
846
+ while (reader.pos < end) {
847
+ const tag = reader.uint32();
848
+ switch (tag >>> 3) {
849
+ case 1: {
850
+ if (tag !== 10) {
851
+ break;
852
+ }
853
+ message.accountId = reader.string();
854
+ continue;
855
+ }
856
+ case 2: {
857
+ if (tag !== 16) {
858
+ break;
859
+ }
860
+ message.limit = reader.int32();
861
+ continue;
862
+ }
863
+ case 3: {
864
+ if (tag !== 26) {
865
+ break;
866
+ }
867
+ message.interval = Interval.decode(reader, reader.uint32());
868
+ continue;
869
+ }
870
+ }
871
+ if ((tag & 7) === 4 || tag === 0) {
872
+ break;
873
+ }
874
+ reader.skip(tag & 7);
875
+ }
876
+ return message;
877
+ },
878
+ fromJSON(object) {
879
+ return {
880
+ accountId: isSet(object.accountId)
881
+ ? globalThis.String(object.accountId)
882
+ : isSet(object.account_id)
883
+ ? globalThis.String(object.account_id)
884
+ : "",
885
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
886
+ interval: isSet(object.interval) ? Interval.fromJSON(object.interval) : undefined,
887
+ };
888
+ },
889
+ toJSON(message) {
890
+ const obj = {};
891
+ if (message.accountId !== "") {
892
+ obj.accountId = message.accountId;
893
+ }
894
+ if (message.limit !== 0) {
895
+ obj.limit = Math.round(message.limit);
896
+ }
897
+ if (message.interval !== undefined) {
898
+ obj.interval = Interval.toJSON(message.interval);
899
+ }
900
+ return obj;
901
+ },
902
+ create(base) {
903
+ return TransactionsRequest.fromPartial(base ?? {});
904
+ },
905
+ fromPartial(object) {
906
+ const message = createBaseTransactionsRequest();
907
+ message.accountId = object.accountId ?? "";
908
+ message.limit = object.limit ?? 0;
909
+ message.interval = (object.interval !== undefined && object.interval !== null)
910
+ ? Interval.fromPartial(object.interval)
911
+ : undefined;
912
+ return message;
913
+ },
914
+ };
915
+ function createBaseTransactionsResponse() {
916
+ return { transactions: [] };
917
+ }
918
+ export const TransactionsResponse = {
919
+ encode(message, writer = new BinaryWriter()) {
920
+ for (const v of message.transactions) {
921
+ Transaction.encode(v, writer.uint32(10).fork()).join();
922
+ }
923
+ return writer;
924
+ },
925
+ decode(input, length) {
926
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
927
+ const end = length === undefined ? reader.len : reader.pos + length;
928
+ const message = createBaseTransactionsResponse();
929
+ while (reader.pos < end) {
930
+ const tag = reader.uint32();
931
+ switch (tag >>> 3) {
932
+ case 1: {
933
+ if (tag !== 10) {
934
+ break;
935
+ }
936
+ message.transactions.push(Transaction.decode(reader, reader.uint32()));
937
+ continue;
938
+ }
939
+ }
940
+ if ((tag & 7) === 4 || tag === 0) {
941
+ break;
942
+ }
943
+ reader.skip(tag & 7);
944
+ }
945
+ return message;
946
+ },
947
+ fromJSON(object) {
948
+ return {
949
+ transactions: globalThis.Array.isArray(object?.transactions)
950
+ ? object.transactions.map((e) => Transaction.fromJSON(e))
951
+ : [],
952
+ };
953
+ },
954
+ toJSON(message) {
955
+ const obj = {};
956
+ if (message.transactions?.length) {
957
+ obj.transactions = message.transactions.map((e) => Transaction.toJSON(e));
958
+ }
959
+ return obj;
960
+ },
961
+ create(base) {
962
+ return TransactionsResponse.fromPartial(base ?? {});
963
+ },
964
+ fromPartial(object) {
965
+ const message = createBaseTransactionsResponse();
966
+ message.transactions = object.transactions?.map((e) => Transaction.fromPartial(e)) || [];
967
+ return message;
968
+ },
969
+ };
970
+ function createBasePosition() {
971
+ return {
972
+ symbol: "",
973
+ quantity: undefined,
974
+ averagePrice: undefined,
975
+ currentPrice: undefined,
976
+ maintenanceMargin: undefined,
977
+ dailyPnl: undefined,
978
+ unrealizedPnl: undefined,
979
+ };
980
+ }
981
+ export const Position = {
982
+ encode(message, writer = new BinaryWriter()) {
983
+ if (message.symbol !== "") {
984
+ writer.uint32(10).string(message.symbol);
985
+ }
986
+ if (message.quantity !== undefined) {
987
+ Decimal.encode(message.quantity, writer.uint32(18).fork()).join();
988
+ }
989
+ if (message.averagePrice !== undefined) {
990
+ Decimal.encode(message.averagePrice, writer.uint32(26).fork()).join();
991
+ }
992
+ if (message.currentPrice !== undefined) {
993
+ Decimal.encode(message.currentPrice, writer.uint32(34).fork()).join();
994
+ }
995
+ if (message.maintenanceMargin !== undefined) {
996
+ Decimal.encode(message.maintenanceMargin, writer.uint32(42).fork()).join();
997
+ }
998
+ if (message.dailyPnl !== undefined) {
999
+ Decimal.encode(message.dailyPnl, writer.uint32(50).fork()).join();
1000
+ }
1001
+ if (message.unrealizedPnl !== undefined) {
1002
+ Decimal.encode(message.unrealizedPnl, writer.uint32(58).fork()).join();
1003
+ }
1004
+ return writer;
1005
+ },
1006
+ decode(input, length) {
1007
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1008
+ const end = length === undefined ? reader.len : reader.pos + length;
1009
+ const message = createBasePosition();
1010
+ while (reader.pos < end) {
1011
+ const tag = reader.uint32();
1012
+ switch (tag >>> 3) {
1013
+ case 1: {
1014
+ if (tag !== 10) {
1015
+ break;
1016
+ }
1017
+ message.symbol = reader.string();
1018
+ continue;
1019
+ }
1020
+ case 2: {
1021
+ if (tag !== 18) {
1022
+ break;
1023
+ }
1024
+ message.quantity = Decimal.decode(reader, reader.uint32());
1025
+ continue;
1026
+ }
1027
+ case 3: {
1028
+ if (tag !== 26) {
1029
+ break;
1030
+ }
1031
+ message.averagePrice = Decimal.decode(reader, reader.uint32());
1032
+ continue;
1033
+ }
1034
+ case 4: {
1035
+ if (tag !== 34) {
1036
+ break;
1037
+ }
1038
+ message.currentPrice = Decimal.decode(reader, reader.uint32());
1039
+ continue;
1040
+ }
1041
+ case 5: {
1042
+ if (tag !== 42) {
1043
+ break;
1044
+ }
1045
+ message.maintenanceMargin = Decimal.decode(reader, reader.uint32());
1046
+ continue;
1047
+ }
1048
+ case 6: {
1049
+ if (tag !== 50) {
1050
+ break;
1051
+ }
1052
+ message.dailyPnl = Decimal.decode(reader, reader.uint32());
1053
+ continue;
1054
+ }
1055
+ case 7: {
1056
+ if (tag !== 58) {
1057
+ break;
1058
+ }
1059
+ message.unrealizedPnl = Decimal.decode(reader, reader.uint32());
1060
+ continue;
1061
+ }
1062
+ }
1063
+ if ((tag & 7) === 4 || tag === 0) {
1064
+ break;
1065
+ }
1066
+ reader.skip(tag & 7);
1067
+ }
1068
+ return message;
1069
+ },
1070
+ fromJSON(object) {
1071
+ return {
1072
+ symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "",
1073
+ quantity: isSet(object.quantity) ? Decimal.fromJSON(object.quantity) : undefined,
1074
+ averagePrice: isSet(object.averagePrice)
1075
+ ? Decimal.fromJSON(object.averagePrice)
1076
+ : isSet(object.average_price)
1077
+ ? Decimal.fromJSON(object.average_price)
1078
+ : undefined,
1079
+ currentPrice: isSet(object.currentPrice)
1080
+ ? Decimal.fromJSON(object.currentPrice)
1081
+ : isSet(object.current_price)
1082
+ ? Decimal.fromJSON(object.current_price)
1083
+ : undefined,
1084
+ maintenanceMargin: isSet(object.maintenanceMargin)
1085
+ ? Decimal.fromJSON(object.maintenanceMargin)
1086
+ : isSet(object.maintenance_margin)
1087
+ ? Decimal.fromJSON(object.maintenance_margin)
1088
+ : undefined,
1089
+ dailyPnl: isSet(object.dailyPnl)
1090
+ ? Decimal.fromJSON(object.dailyPnl)
1091
+ : isSet(object.daily_pnl)
1092
+ ? Decimal.fromJSON(object.daily_pnl)
1093
+ : undefined,
1094
+ unrealizedPnl: isSet(object.unrealizedPnl)
1095
+ ? Decimal.fromJSON(object.unrealizedPnl)
1096
+ : isSet(object.unrealized_pnl)
1097
+ ? Decimal.fromJSON(object.unrealized_pnl)
1098
+ : undefined,
1099
+ };
1100
+ },
1101
+ toJSON(message) {
1102
+ const obj = {};
1103
+ if (message.symbol !== "") {
1104
+ obj.symbol = message.symbol;
1105
+ }
1106
+ if (message.quantity !== undefined) {
1107
+ obj.quantity = Decimal.toJSON(message.quantity);
1108
+ }
1109
+ if (message.averagePrice !== undefined) {
1110
+ obj.averagePrice = Decimal.toJSON(message.averagePrice);
1111
+ }
1112
+ if (message.currentPrice !== undefined) {
1113
+ obj.currentPrice = Decimal.toJSON(message.currentPrice);
1114
+ }
1115
+ if (message.maintenanceMargin !== undefined) {
1116
+ obj.maintenanceMargin = Decimal.toJSON(message.maintenanceMargin);
1117
+ }
1118
+ if (message.dailyPnl !== undefined) {
1119
+ obj.dailyPnl = Decimal.toJSON(message.dailyPnl);
1120
+ }
1121
+ if (message.unrealizedPnl !== undefined) {
1122
+ obj.unrealizedPnl = Decimal.toJSON(message.unrealizedPnl);
1123
+ }
1124
+ return obj;
1125
+ },
1126
+ create(base) {
1127
+ return Position.fromPartial(base ?? {});
1128
+ },
1129
+ fromPartial(object) {
1130
+ const message = createBasePosition();
1131
+ message.symbol = object.symbol ?? "";
1132
+ message.quantity = (object.quantity !== undefined && object.quantity !== null)
1133
+ ? Decimal.fromPartial(object.quantity)
1134
+ : undefined;
1135
+ message.averagePrice = (object.averagePrice !== undefined && object.averagePrice !== null)
1136
+ ? Decimal.fromPartial(object.averagePrice)
1137
+ : undefined;
1138
+ message.currentPrice = (object.currentPrice !== undefined && object.currentPrice !== null)
1139
+ ? Decimal.fromPartial(object.currentPrice)
1140
+ : undefined;
1141
+ message.maintenanceMargin = (object.maintenanceMargin !== undefined && object.maintenanceMargin !== null)
1142
+ ? Decimal.fromPartial(object.maintenanceMargin)
1143
+ : undefined;
1144
+ message.dailyPnl = (object.dailyPnl !== undefined && object.dailyPnl !== null)
1145
+ ? Decimal.fromPartial(object.dailyPnl)
1146
+ : undefined;
1147
+ message.unrealizedPnl = (object.unrealizedPnl !== undefined && object.unrealizedPnl !== null)
1148
+ ? Decimal.fromPartial(object.unrealizedPnl)
1149
+ : undefined;
1150
+ return message;
1151
+ },
1152
+ };
1153
+ function createBaseTransaction() {
1154
+ return {
1155
+ id: "",
1156
+ category: "",
1157
+ timestamp: undefined,
1158
+ symbol: "",
1159
+ change: undefined,
1160
+ trade: undefined,
1161
+ transactionCategory: 0,
1162
+ transactionName: "",
1163
+ changeQty: undefined,
1164
+ };
1165
+ }
1166
+ export const Transaction = {
1167
+ encode(message, writer = new BinaryWriter()) {
1168
+ if (message.id !== "") {
1169
+ writer.uint32(10).string(message.id);
1170
+ }
1171
+ if (message.category !== "") {
1172
+ writer.uint32(18).string(message.category);
1173
+ }
1174
+ if (message.timestamp !== undefined) {
1175
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(34).fork()).join();
1176
+ }
1177
+ if (message.symbol !== "") {
1178
+ writer.uint32(42).string(message.symbol);
1179
+ }
1180
+ if (message.change !== undefined) {
1181
+ Money.encode(message.change, writer.uint32(50).fork()).join();
1182
+ }
1183
+ if (message.trade !== undefined) {
1184
+ Transaction_Trade.encode(message.trade, writer.uint32(58).fork()).join();
1185
+ }
1186
+ if (message.transactionCategory !== 0) {
1187
+ writer.uint32(64).int32(message.transactionCategory);
1188
+ }
1189
+ if (message.transactionName !== "") {
1190
+ writer.uint32(74).string(message.transactionName);
1191
+ }
1192
+ if (message.changeQty !== undefined) {
1193
+ Decimal.encode(message.changeQty, writer.uint32(82).fork()).join();
1194
+ }
1195
+ return writer;
1196
+ },
1197
+ decode(input, length) {
1198
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1199
+ const end = length === undefined ? reader.len : reader.pos + length;
1200
+ const message = createBaseTransaction();
1201
+ while (reader.pos < end) {
1202
+ const tag = reader.uint32();
1203
+ switch (tag >>> 3) {
1204
+ case 1: {
1205
+ if (tag !== 10) {
1206
+ break;
1207
+ }
1208
+ message.id = reader.string();
1209
+ continue;
1210
+ }
1211
+ case 2: {
1212
+ if (tag !== 18) {
1213
+ break;
1214
+ }
1215
+ message.category = reader.string();
1216
+ continue;
1217
+ }
1218
+ case 4: {
1219
+ if (tag !== 34) {
1220
+ break;
1221
+ }
1222
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1223
+ continue;
1224
+ }
1225
+ case 5: {
1226
+ if (tag !== 42) {
1227
+ break;
1228
+ }
1229
+ message.symbol = reader.string();
1230
+ continue;
1231
+ }
1232
+ case 6: {
1233
+ if (tag !== 50) {
1234
+ break;
1235
+ }
1236
+ message.change = Money.decode(reader, reader.uint32());
1237
+ continue;
1238
+ }
1239
+ case 7: {
1240
+ if (tag !== 58) {
1241
+ break;
1242
+ }
1243
+ message.trade = Transaction_Trade.decode(reader, reader.uint32());
1244
+ continue;
1245
+ }
1246
+ case 8: {
1247
+ if (tag !== 64) {
1248
+ break;
1249
+ }
1250
+ message.transactionCategory = reader.int32();
1251
+ continue;
1252
+ }
1253
+ case 9: {
1254
+ if (tag !== 74) {
1255
+ break;
1256
+ }
1257
+ message.transactionName = reader.string();
1258
+ continue;
1259
+ }
1260
+ case 10: {
1261
+ if (tag !== 82) {
1262
+ break;
1263
+ }
1264
+ message.changeQty = Decimal.decode(reader, reader.uint32());
1265
+ continue;
1266
+ }
1267
+ }
1268
+ if ((tag & 7) === 4 || tag === 0) {
1269
+ break;
1270
+ }
1271
+ reader.skip(tag & 7);
1272
+ }
1273
+ return message;
1274
+ },
1275
+ fromJSON(object) {
1276
+ return {
1277
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
1278
+ category: isSet(object.category) ? globalThis.String(object.category) : "",
1279
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
1280
+ symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "",
1281
+ change: isSet(object.change) ? Money.fromJSON(object.change) : undefined,
1282
+ trade: isSet(object.trade) ? Transaction_Trade.fromJSON(object.trade) : undefined,
1283
+ transactionCategory: isSet(object.transactionCategory)
1284
+ ? transaction_TransactionCategoryFromJSON(object.transactionCategory)
1285
+ : isSet(object.transaction_category)
1286
+ ? transaction_TransactionCategoryFromJSON(object.transaction_category)
1287
+ : 0,
1288
+ transactionName: isSet(object.transactionName)
1289
+ ? globalThis.String(object.transactionName)
1290
+ : isSet(object.transaction_name)
1291
+ ? globalThis.String(object.transaction_name)
1292
+ : "",
1293
+ changeQty: isSet(object.changeQty)
1294
+ ? Decimal.fromJSON(object.changeQty)
1295
+ : isSet(object.change_qty)
1296
+ ? Decimal.fromJSON(object.change_qty)
1297
+ : undefined,
1298
+ };
1299
+ },
1300
+ toJSON(message) {
1301
+ const obj = {};
1302
+ if (message.id !== "") {
1303
+ obj.id = message.id;
1304
+ }
1305
+ if (message.category !== "") {
1306
+ obj.category = message.category;
1307
+ }
1308
+ if (message.timestamp !== undefined) {
1309
+ obj.timestamp = message.timestamp.toISOString();
1310
+ }
1311
+ if (message.symbol !== "") {
1312
+ obj.symbol = message.symbol;
1313
+ }
1314
+ if (message.change !== undefined) {
1315
+ obj.change = Money.toJSON(message.change);
1316
+ }
1317
+ if (message.trade !== undefined) {
1318
+ obj.trade = Transaction_Trade.toJSON(message.trade);
1319
+ }
1320
+ if (message.transactionCategory !== 0) {
1321
+ obj.transactionCategory = transaction_TransactionCategoryToJSON(message.transactionCategory);
1322
+ }
1323
+ if (message.transactionName !== "") {
1324
+ obj.transactionName = message.transactionName;
1325
+ }
1326
+ if (message.changeQty !== undefined) {
1327
+ obj.changeQty = Decimal.toJSON(message.changeQty);
1328
+ }
1329
+ return obj;
1330
+ },
1331
+ create(base) {
1332
+ return Transaction.fromPartial(base ?? {});
1333
+ },
1334
+ fromPartial(object) {
1335
+ const message = createBaseTransaction();
1336
+ message.id = object.id ?? "";
1337
+ message.category = object.category ?? "";
1338
+ message.timestamp = object.timestamp ?? undefined;
1339
+ message.symbol = object.symbol ?? "";
1340
+ message.change = (object.change !== undefined && object.change !== null)
1341
+ ? Money.fromPartial(object.change)
1342
+ : undefined;
1343
+ message.trade = (object.trade !== undefined && object.trade !== null)
1344
+ ? Transaction_Trade.fromPartial(object.trade)
1345
+ : undefined;
1346
+ message.transactionCategory = object.transactionCategory ?? 0;
1347
+ message.transactionName = object.transactionName ?? "";
1348
+ message.changeQty = (object.changeQty !== undefined && object.changeQty !== null)
1349
+ ? Decimal.fromPartial(object.changeQty)
1350
+ : undefined;
1351
+ return message;
1352
+ },
1353
+ };
1354
+ function createBaseTransaction_Trade() {
1355
+ return { size: undefined, price: undefined, accruedInterest: undefined };
1356
+ }
1357
+ export const Transaction_Trade = {
1358
+ encode(message, writer = new BinaryWriter()) {
1359
+ if (message.size !== undefined) {
1360
+ Decimal.encode(message.size, writer.uint32(10).fork()).join();
1361
+ }
1362
+ if (message.price !== undefined) {
1363
+ Decimal.encode(message.price, writer.uint32(18).fork()).join();
1364
+ }
1365
+ if (message.accruedInterest !== undefined) {
1366
+ Decimal.encode(message.accruedInterest, writer.uint32(26).fork()).join();
1367
+ }
1368
+ return writer;
1369
+ },
1370
+ decode(input, length) {
1371
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1372
+ const end = length === undefined ? reader.len : reader.pos + length;
1373
+ const message = createBaseTransaction_Trade();
1374
+ while (reader.pos < end) {
1375
+ const tag = reader.uint32();
1376
+ switch (tag >>> 3) {
1377
+ case 1: {
1378
+ if (tag !== 10) {
1379
+ break;
1380
+ }
1381
+ message.size = Decimal.decode(reader, reader.uint32());
1382
+ continue;
1383
+ }
1384
+ case 2: {
1385
+ if (tag !== 18) {
1386
+ break;
1387
+ }
1388
+ message.price = Decimal.decode(reader, reader.uint32());
1389
+ continue;
1390
+ }
1391
+ case 3: {
1392
+ if (tag !== 26) {
1393
+ break;
1394
+ }
1395
+ message.accruedInterest = Decimal.decode(reader, reader.uint32());
1396
+ continue;
1397
+ }
1398
+ }
1399
+ if ((tag & 7) === 4 || tag === 0) {
1400
+ break;
1401
+ }
1402
+ reader.skip(tag & 7);
1403
+ }
1404
+ return message;
1405
+ },
1406
+ fromJSON(object) {
1407
+ return {
1408
+ size: isSet(object.size) ? Decimal.fromJSON(object.size) : undefined,
1409
+ price: isSet(object.price) ? Decimal.fromJSON(object.price) : undefined,
1410
+ accruedInterest: isSet(object.accruedInterest)
1411
+ ? Decimal.fromJSON(object.accruedInterest)
1412
+ : isSet(object.accrued_interest)
1413
+ ? Decimal.fromJSON(object.accrued_interest)
1414
+ : undefined,
1415
+ };
1416
+ },
1417
+ toJSON(message) {
1418
+ const obj = {};
1419
+ if (message.size !== undefined) {
1420
+ obj.size = Decimal.toJSON(message.size);
1421
+ }
1422
+ if (message.price !== undefined) {
1423
+ obj.price = Decimal.toJSON(message.price);
1424
+ }
1425
+ if (message.accruedInterest !== undefined) {
1426
+ obj.accruedInterest = Decimal.toJSON(message.accruedInterest);
1427
+ }
1428
+ return obj;
1429
+ },
1430
+ create(base) {
1431
+ return Transaction_Trade.fromPartial(base ?? {});
1432
+ },
1433
+ fromPartial(object) {
1434
+ const message = createBaseTransaction_Trade();
1435
+ message.size = (object.size !== undefined && object.size !== null) ? Decimal.fromPartial(object.size) : undefined;
1436
+ message.price = (object.price !== undefined && object.price !== null)
1437
+ ? Decimal.fromPartial(object.price)
1438
+ : undefined;
1439
+ message.accruedInterest = (object.accruedInterest !== undefined && object.accruedInterest !== null)
1440
+ ? Decimal.fromPartial(object.accruedInterest)
1441
+ : undefined;
1442
+ return message;
1443
+ },
1444
+ };
1445
+ export const AccountsServiceDefinition = {
1446
+ name: "AccountsService",
1447
+ fullName: "grpc.tradeapi.v1.accounts.AccountsService",
1448
+ methods: {
1449
+ /**
1450
+ * Get information about a specific account
1451
+ * Example HTTP request:
1452
+ * GET /v1/accounts/A12345
1453
+ * Authorization: <token>
1454
+ */
1455
+ getAccount: {
1456
+ name: "GetAccount",
1457
+ requestType: GetAccountRequest,
1458
+ requestStream: false,
1459
+ responseType: GetAccountResponse,
1460
+ responseStream: false,
1461
+ options: {
1462
+ _unknownFields: {
1463
+ 8338: [
1464
+ new Uint8Array([
1465
+ 21,
1466
+ 98,
1467
+ 19,
1468
+ 10,
1469
+ 17,
1470
+ 10,
1471
+ 13,
1472
+ 65,
1473
+ 117,
1474
+ 116,
1475
+ 104,
1476
+ 111,
1477
+ 114,
1478
+ 105,
1479
+ 122,
1480
+ 97,
1481
+ 116,
1482
+ 105,
1483
+ 111,
1484
+ 110,
1485
+ 18,
1486
+ 0,
1487
+ ]),
1488
+ ],
1489
+ 578365826: [
1490
+ new Uint8Array([
1491
+ 27,
1492
+ 18,
1493
+ 25,
1494
+ 47,
1495
+ 118,
1496
+ 49,
1497
+ 47,
1498
+ 97,
1499
+ 99,
1500
+ 99,
1501
+ 111,
1502
+ 117,
1503
+ 110,
1504
+ 116,
1505
+ 115,
1506
+ 47,
1507
+ 123,
1508
+ 97,
1509
+ 99,
1510
+ 99,
1511
+ 111,
1512
+ 117,
1513
+ 110,
1514
+ 116,
1515
+ 95,
1516
+ 105,
1517
+ 100,
1518
+ 125,
1519
+ ]),
1520
+ ],
1521
+ },
1522
+ },
1523
+ },
1524
+ /**
1525
+ * Get account trade history
1526
+ * Example HTTP request:
1527
+ * GET /v1/accounts/A12345/trades?limit=50&interval.start_time=2023-01-01T00:00:00Z&interval.end_time=2023-01-31T23:59:59Z
1528
+ * Authorization: <token>
1529
+ *
1530
+ * Parameters:
1531
+ * - account_id is passed in the URL path
1532
+ * - limit and interval are passed as query parameters
1533
+ */
1534
+ trades: {
1535
+ name: "Trades",
1536
+ requestType: TradesRequest,
1537
+ requestStream: false,
1538
+ responseType: TradesResponse,
1539
+ responseStream: false,
1540
+ options: {
1541
+ _unknownFields: {
1542
+ 8338: [
1543
+ new Uint8Array([
1544
+ 48,
1545
+ 74,
1546
+ 25,
1547
+ 10,
1548
+ 3,
1549
+ 52,
1550
+ 48,
1551
+ 48,
1552
+ 18,
1553
+ 18,
1554
+ 10,
1555
+ 16,
1556
+ 73,
1557
+ 110,
1558
+ 118,
1559
+ 97,
1560
+ 108,
1561
+ 105,
1562
+ 100,
1563
+ 32,
1564
+ 105,
1565
+ 110,
1566
+ 116,
1567
+ 101,
1568
+ 114,
1569
+ 118,
1570
+ 97,
1571
+ 108,
1572
+ 98,
1573
+ 19,
1574
+ 10,
1575
+ 17,
1576
+ 10,
1577
+ 13,
1578
+ 65,
1579
+ 117,
1580
+ 116,
1581
+ 104,
1582
+ 111,
1583
+ 114,
1584
+ 105,
1585
+ 122,
1586
+ 97,
1587
+ 116,
1588
+ 105,
1589
+ 111,
1590
+ 110,
1591
+ 18,
1592
+ 0,
1593
+ ]),
1594
+ ],
1595
+ 578365826: [
1596
+ new Uint8Array([
1597
+ 34,
1598
+ 18,
1599
+ 32,
1600
+ 47,
1601
+ 118,
1602
+ 49,
1603
+ 47,
1604
+ 97,
1605
+ 99,
1606
+ 99,
1607
+ 111,
1608
+ 117,
1609
+ 110,
1610
+ 116,
1611
+ 115,
1612
+ 47,
1613
+ 123,
1614
+ 97,
1615
+ 99,
1616
+ 99,
1617
+ 111,
1618
+ 117,
1619
+ 110,
1620
+ 116,
1621
+ 95,
1622
+ 105,
1623
+ 100,
1624
+ 125,
1625
+ 47,
1626
+ 116,
1627
+ 114,
1628
+ 97,
1629
+ 100,
1630
+ 101,
1631
+ 115,
1632
+ ]),
1633
+ ],
1634
+ },
1635
+ },
1636
+ },
1637
+ /**
1638
+ * Get account transactions
1639
+ * Example HTTP request:
1640
+ * GET /v1/accounts/A12345/transactions?limit=50&interval.start_time=2023-01-01T00:00:00Z&interval.end_time=2023-01-31T23:59:59Z
1641
+ * Authorization: <token>
1642
+ *
1643
+ * Parameters:
1644
+ * - account_id is passed in the URL path
1645
+ * - limit and interval are passed as query parameters
1646
+ */
1647
+ transactions: {
1648
+ name: "Transactions",
1649
+ requestType: TransactionsRequest,
1650
+ requestStream: false,
1651
+ responseType: TransactionsResponse,
1652
+ responseStream: false,
1653
+ options: {
1654
+ _unknownFields: {
1655
+ 8338: [
1656
+ new Uint8Array([
1657
+ 48,
1658
+ 74,
1659
+ 25,
1660
+ 10,
1661
+ 3,
1662
+ 52,
1663
+ 48,
1664
+ 48,
1665
+ 18,
1666
+ 18,
1667
+ 10,
1668
+ 16,
1669
+ 73,
1670
+ 110,
1671
+ 118,
1672
+ 97,
1673
+ 108,
1674
+ 105,
1675
+ 100,
1676
+ 32,
1677
+ 105,
1678
+ 110,
1679
+ 116,
1680
+ 101,
1681
+ 114,
1682
+ 118,
1683
+ 97,
1684
+ 108,
1685
+ 98,
1686
+ 19,
1687
+ 10,
1688
+ 17,
1689
+ 10,
1690
+ 13,
1691
+ 65,
1692
+ 117,
1693
+ 116,
1694
+ 104,
1695
+ 111,
1696
+ 114,
1697
+ 105,
1698
+ 122,
1699
+ 97,
1700
+ 116,
1701
+ 105,
1702
+ 111,
1703
+ 110,
1704
+ 18,
1705
+ 0,
1706
+ ]),
1707
+ ],
1708
+ 578365826: [
1709
+ new Uint8Array([
1710
+ 40,
1711
+ 18,
1712
+ 38,
1713
+ 47,
1714
+ 118,
1715
+ 49,
1716
+ 47,
1717
+ 97,
1718
+ 99,
1719
+ 99,
1720
+ 111,
1721
+ 117,
1722
+ 110,
1723
+ 116,
1724
+ 115,
1725
+ 47,
1726
+ 123,
1727
+ 97,
1728
+ 99,
1729
+ 99,
1730
+ 111,
1731
+ 117,
1732
+ 110,
1733
+ 116,
1734
+ 95,
1735
+ 105,
1736
+ 100,
1737
+ 125,
1738
+ 47,
1739
+ 116,
1740
+ 114,
1741
+ 97,
1742
+ 110,
1743
+ 115,
1744
+ 97,
1745
+ 99,
1746
+ 116,
1747
+ 105,
1748
+ 111,
1749
+ 110,
1750
+ 115,
1751
+ ]),
1752
+ ],
1753
+ },
1754
+ },
1755
+ },
1756
+ /** Subscribe to account information. Stream method */
1757
+ subscribeAccount: {
1758
+ name: "SubscribeAccount",
1759
+ requestType: GetAccountRequest,
1760
+ requestStream: false,
1761
+ responseType: GetAccountResponse,
1762
+ responseStream: true,
1763
+ options: {},
1764
+ },
1765
+ },
1766
+ };
1767
+ function toTimestamp(date) {
1768
+ const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
1769
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
1770
+ return { seconds, nanos };
1771
+ }
1772
+ function fromTimestamp(t) {
1773
+ let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;
1774
+ millis += (t.nanos || 0) / 1_000_000;
1775
+ return new globalThis.Date(millis);
1776
+ }
1777
+ function fromJsonTimestamp(o) {
1778
+ if (o instanceof globalThis.Date) {
1779
+ return o;
1780
+ }
1781
+ else if (typeof o === "string") {
1782
+ return new globalThis.Date(o);
1783
+ }
1784
+ else {
1785
+ return fromTimestamp(Timestamp.fromJSON(o));
1786
+ }
1787
+ }
1788
+ function isSet(value) {
1789
+ return value !== null && value !== undefined;
1790
+ }
1791
+ //# sourceMappingURL=accounts_service.js.map