@brokerize/client 1.1.1 → 1.1.3

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 (37) hide show
  1. package/README.md +4 -2
  2. package/dist/authorizedApiContext.d.ts +3 -0
  3. package/dist/authorizedApiContext.js +9 -0
  4. package/dist/client.d.ts +487 -79
  5. package/dist/modelExports.d.ts +6 -0
  6. package/dist/swagger/apis/DefaultApi.d.ts +37 -3
  7. package/dist/swagger/apis/DefaultApi.js +121 -2
  8. package/dist/swagger/models/ClientConfig.d.ts +7 -0
  9. package/dist/swagger/models/ClientConfig.js +4 -0
  10. package/dist/swagger/models/ClientConfigUpdate.d.ts +6 -0
  11. package/dist/swagger/models/ClientConfigUpdate.js +4 -0
  12. package/dist/swagger/models/GetPortfolioTradeStatisticsResponse.d.ts +28 -0
  13. package/dist/swagger/models/GetPortfolioTradeStatisticsResponse.js +38 -0
  14. package/dist/swagger/models/GetPortfolioTradesResponse.d.ts +34 -0
  15. package/dist/swagger/models/GetPortfolioTradesResponse.js +40 -0
  16. package/dist/swagger/models/SummarizedTrade.d.ts +77 -0
  17. package/dist/swagger/models/SummarizedTrade.js +56 -0
  18. package/dist/swagger/models/TokenResponse.d.ts +51 -0
  19. package/dist/swagger/models/{ObtainToken200Response.js → TokenResponse.js} +6 -6
  20. package/dist/swagger/models/TradeDraftUpdateParams.d.ts +2 -3
  21. package/dist/swagger/models/TradeDraftUpdateParams.js +2 -5
  22. package/dist/swagger/models/TradeStatistics.d.ts +65 -0
  23. package/dist/swagger/models/TradeStatistics.js +50 -0
  24. package/dist/swagger/models/TradeStatisticsDateRange.d.ts +39 -0
  25. package/dist/swagger/models/TradeStatisticsDateRange.js +41 -0
  26. package/dist/swagger/models/TradeStatisticsHoldingPeriodInDays.d.ts +39 -0
  27. package/dist/swagger/models/TradeStatisticsHoldingPeriodInDays.js +41 -0
  28. package/dist/swagger/models/TradeStatisticsItem.d.ts +35 -0
  29. package/dist/swagger/models/TradeStatisticsItem.js +41 -0
  30. package/dist/swagger/models/TradeWarning.d.ts +27 -0
  31. package/dist/swagger/models/TradeWarning.js +37 -0
  32. package/dist/swagger/models/index.d.ts +9 -2
  33. package/dist/swagger/models/index.js +9 -2
  34. package/package.json +1 -1
  35. package/dist/swagger/models/ObtainToken200Response.d.ts +0 -51
  36. package/dist/swagger/models/TradeDraftUpdateParamsOrderId.d.ts +0 -21
  37. package/dist/swagger/models/TradeDraftUpdateParamsOrderId.js +0 -24
@@ -152,3 +152,9 @@ export { SecurityQuotes } from "./swagger/models/SecurityQuotes";
152
152
  export { SecurityQuote } from "./swagger/models/SecurityQuote";
153
153
  export { OrderIntent } from "./swagger/models/OrderIntent";
154
154
  export { OrderIntentAvailability } from "./swagger/models/OrderIntentAvailability";
155
+ export { SummarizedTrade } from "./swagger/models/SummarizedTrade";
156
+ export { TradeWarning } from "./swagger/models/TradeWarning";
157
+ export { GetPortfolioTradesResponse } from "./swagger/models/GetPortfolioTradesResponse";
158
+ export { GetPortfolioTradeStatisticsResponse } from "./swagger/models/GetPortfolioTradeStatisticsResponse";
159
+ export { TradeStatisticsItem } from "./swagger/models/TradeStatisticsItem";
160
+ export { TradeStatistics } from "./swagger/models/TradeStatistics";
@@ -9,7 +9,7 @@
9
9
  * Do not edit the class manually.
10
10
  */
11
11
  import * as runtime from "../runtime";
12
- import { Challenge, CreateGuestUserResponse, CreateTanChallengeParams, DecoupledOperationStatus, EnableSessionTanParams, EnableSessionTanResponse, EndSessionTanResponse, GetAuthInfoResponse, GetOrderResponse, GetPortfolioOrdersResponse, GetPortfolioPositionsResponse, GetPortfolioQuotesResponse, GetUserResponse, ObtainToken200Response, OkResponseBody, PortfoliosResponse, RenamePortfolioRequest, SessionResponse } from "../models";
12
+ import { Challenge, CreateGuestUserResponse, CreateTanChallengeParams, DecoupledOperationStatus, EnableSessionTanParams, EnableSessionTanResponse, EndSessionTanResponse, GetAuthInfoResponse, GetOrderResponse, GetPortfolioOrdersResponse, GetPortfolioPositionsResponse, GetPortfolioQuotesResponse, GetPortfolioTradeStatisticsResponse, GetPortfolioTradesResponse, GetUserResponse, OkResponseBody, PortfoliosResponse, RenamePortfolioRequest, SessionResponse, TokenResponse, TradeWarning } from "../models";
13
13
  export interface CancelDecoupledOperationRequest {
14
14
  sessionId: string;
15
15
  decoupledOperationId: string;
@@ -57,6 +57,18 @@ export interface GetPortfolioPositionsRequest {
57
57
  export interface GetPortfolioQuotesRequest {
58
58
  portfolioId: string;
59
59
  }
60
+ export interface GetPortfolioTradeStatisticsRequest {
61
+ portfolioId: string;
62
+ dateRanges: string;
63
+ }
64
+ export interface GetPortfolioTradeWarningsRequest {
65
+ portfolioId: string;
66
+ }
67
+ export interface GetPortfolioTradesRequest {
68
+ portfolioId: string;
69
+ take?: number;
70
+ skip?: number;
71
+ }
60
72
  export interface LogoutSessionRequest {
61
73
  sessionId: string;
62
74
  }
@@ -163,6 +175,28 @@ export declare class DefaultApi extends runtime.BaseAPI {
163
175
  /**
164
176
  */
165
177
  getPortfolioQuotes(requestParameters: GetPortfolioQuotesRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetPortfolioQuotesResponse>;
178
+ /**
179
+ * Load statistics based on the trade list for selected date ranges. The statistics (such as `longestWinningStreak` or `tradeCount`) are computed for each of the requested date ranges.
180
+ */
181
+ getPortfolioTradeStatisticsRaw(requestParameters: GetPortfolioTradeStatisticsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<GetPortfolioTradeStatisticsResponse>>;
182
+ /**
183
+ * Load statistics based on the trade list for selected date ranges. The statistics (such as `longestWinningStreak` or `tradeCount`) are computed for each of the requested date ranges.
184
+ */
185
+ getPortfolioTradeStatistics(requestParameters: GetPortfolioTradeStatisticsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetPortfolioTradeStatisticsResponse>;
186
+ /**
187
+ */
188
+ getPortfolioTradeWarningsRaw(requestParameters: GetPortfolioTradeWarningsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<Array<TradeWarning>>>;
189
+ /**
190
+ */
191
+ getPortfolioTradeWarnings(requestParameters: GetPortfolioTradeWarningsRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<Array<TradeWarning>>;
192
+ /**
193
+ * Load a list of completed trades in a portfolio. A completed trade corresponds to *one* closing of a position. Technically each closing of a position corresponds to one execution of an order with `intent=close` (usually those are sell orders, but in the case of short selling, opening a position is a sell order with intent=open). The analysis follows the FIFO (First In, First Out) principle to accurately summarize trades. Each time a position is closed (note that partial executions are possible. In this case, each individual execution is regarded as a transaction), the system identifies the earliest corresponding \"open position execution\" that contributed to that closing. The result includes a single entry for each closing transaction, detailing key metrics such as profit/loss and holding period, based on the matched opening transactions. This could be a real world example: - 2020-01-01: buy 5 stock1 for 100 USD each - 2021-06-01: buy 3 stock1 for 200 USD each - 2021-06-06: sell 6 stock1 for 300 USD each In this case, the result would be one completed trade (corresponding to the last sell) with a profit of `(300*6)-(100*5+1*200)=1800-700=1100 USD`. There is an open position remaining (2 units of stock1, which correspond to the second buy transaction). When we add this sell: - 2021-06-07: sell 2 stock1 for 400 USD each It would add a second complete trade with a profit of `(400*2)-(200*2)=800-400=400 USD`. For some brokers, the order history may be incomplete (e.g. only reveals the latest 90 days), so that we do not know if there could be older transactions. Thus, our implementation might detect (given the current set of open positions together with the list of order executions) that we cannot figure out the corresponding opening transactions for a closing transaction. Affected trades will be ignored for this analysis and might appear as warning items in the `/warnings` endpoint. Frontends should show those warnings so that users can understand why the analysis is incomplete.
194
+ */
195
+ getPortfolioTradesRaw(requestParameters: GetPortfolioTradesRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<GetPortfolioTradesResponse>>;
196
+ /**
197
+ * Load a list of completed trades in a portfolio. A completed trade corresponds to *one* closing of a position. Technically each closing of a position corresponds to one execution of an order with `intent=close` (usually those are sell orders, but in the case of short selling, opening a position is a sell order with intent=open). The analysis follows the FIFO (First In, First Out) principle to accurately summarize trades. Each time a position is closed (note that partial executions are possible. In this case, each individual execution is regarded as a transaction), the system identifies the earliest corresponding \"open position execution\" that contributed to that closing. The result includes a single entry for each closing transaction, detailing key metrics such as profit/loss and holding period, based on the matched opening transactions. This could be a real world example: - 2020-01-01: buy 5 stock1 for 100 USD each - 2021-06-01: buy 3 stock1 for 200 USD each - 2021-06-06: sell 6 stock1 for 300 USD each In this case, the result would be one completed trade (corresponding to the last sell) with a profit of `(300*6)-(100*5+1*200)=1800-700=1100 USD`. There is an open position remaining (2 units of stock1, which correspond to the second buy transaction). When we add this sell: - 2021-06-07: sell 2 stock1 for 400 USD each It would add a second complete trade with a profit of `(400*2)-(200*2)=800-400=400 USD`. For some brokers, the order history may be incomplete (e.g. only reveals the latest 90 days), so that we do not know if there could be older transactions. Thus, our implementation might detect (given the current set of open positions together with the list of order executions) that we cannot figure out the corresponding opening transactions for a closing transaction. Affected trades will be ignored for this analysis and might appear as warning items in the `/warnings` endpoint. Frontends should show those warnings so that users can understand why the analysis is incomplete.
198
+ */
199
+ getPortfolioTrades(requestParameters: GetPortfolioTradesRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<GetPortfolioTradesResponse>;
166
200
  /**
167
201
  */
168
202
  getPortfoliosRaw(initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<PortfoliosResponse>>;
@@ -196,11 +230,11 @@ export declare class DefaultApi extends runtime.BaseAPI {
196
230
  /**
197
231
  * Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
198
232
  */
199
- obtainTokenRaw(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<ObtainToken200Response>>;
233
+ obtainTokenRaw(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<runtime.ApiResponse<TokenResponse>>;
200
234
  /**
201
235
  * Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
202
236
  */
203
- obtainToken(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<ObtainToken200Response>;
237
+ obtainToken(requestParameters: ObtainTokenRequest, initOverrides?: RequestInit | runtime.InitOverideFunction): Promise<TokenResponse>;
204
238
  /**
205
239
  * This endpoint can be used to rename the display name of a specified portfolio. To restore the original portfolio name, send a rename request with an empty string as the new name. **Note**: This does not change the original portfolio name at your broker.
206
240
  */
@@ -11,7 +11,7 @@
11
11
  * Do not edit the class manually.
12
12
  */
13
13
  import * as runtime from "../runtime";
14
- import { ChallengeFromJSON, CreateGuestUserResponseFromJSON, CreateTanChallengeParamsToJSON, DecoupledOperationStatusFromJSON, EnableSessionTanParamsToJSON, EnableSessionTanResponseFromJSON, EndSessionTanResponseFromJSON, GetAuthInfoResponseFromJSON, GetOrderResponseFromJSON, GetPortfolioOrdersResponseFromJSON, GetPortfolioPositionsResponseFromJSON, GetPortfolioQuotesResponseFromJSON, GetUserResponseFromJSON, ObtainToken200ResponseFromJSON, OkResponseBodyFromJSON, PortfoliosResponseFromJSON, RenamePortfolioRequestToJSON, SessionResponseFromJSON, } from "../models";
14
+ import { ChallengeFromJSON, CreateGuestUserResponseFromJSON, CreateTanChallengeParamsToJSON, DecoupledOperationStatusFromJSON, EnableSessionTanParamsToJSON, EnableSessionTanResponseFromJSON, EndSessionTanResponseFromJSON, GetAuthInfoResponseFromJSON, GetOrderResponseFromJSON, GetPortfolioOrdersResponseFromJSON, GetPortfolioPositionsResponseFromJSON, GetPortfolioQuotesResponseFromJSON, GetPortfolioTradeStatisticsResponseFromJSON, GetPortfolioTradesResponseFromJSON, GetUserResponseFromJSON, OkResponseBodyFromJSON, PortfoliosResponseFromJSON, RenamePortfolioRequestToJSON, SessionResponseFromJSON, TokenResponseFromJSON, TradeWarningFromJSON, } from "../models";
15
15
  /**
16
16
  *
17
17
  */
@@ -504,6 +504,125 @@ export class DefaultApi extends runtime.BaseAPI {
504
504
  const response = await this.getPortfolioQuotesRaw(requestParameters, initOverrides);
505
505
  return await response.value();
506
506
  }
507
+ /**
508
+ * Load statistics based on the trade list for selected date ranges. The statistics (such as `longestWinningStreak` or `tradeCount`) are computed for each of the requested date ranges.
509
+ */
510
+ async getPortfolioTradeStatisticsRaw(requestParameters, initOverrides) {
511
+ if (requestParameters.portfolioId === null ||
512
+ requestParameters.portfolioId === undefined) {
513
+ throw new runtime.RequiredError("portfolioId", "Required parameter requestParameters.portfolioId was null or undefined when calling getPortfolioTradeStatistics.");
514
+ }
515
+ if (requestParameters.dateRanges === null ||
516
+ requestParameters.dateRanges === undefined) {
517
+ throw new runtime.RequiredError("dateRanges", "Required parameter requestParameters.dateRanges was null or undefined when calling getPortfolioTradeStatistics.");
518
+ }
519
+ const queryParameters = {};
520
+ if (requestParameters.dateRanges !== undefined) {
521
+ queryParameters["dateRanges"] = requestParameters.dateRanges;
522
+ }
523
+ const headerParameters = {};
524
+ if (this.configuration && this.configuration.apiKey) {
525
+ headerParameters["x-brkrz-client-id"] =
526
+ this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
527
+ }
528
+ if (this.configuration && this.configuration.accessToken) {
529
+ const token = this.configuration.accessToken;
530
+ const tokenString = await token("idToken", []);
531
+ if (tokenString) {
532
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
533
+ }
534
+ }
535
+ const response = await this.request({
536
+ path: `/portfolios/{portfolioId}/trades/statistics`.replace(`{${"portfolioId"}}`, encodeURIComponent(String(requestParameters.portfolioId))),
537
+ method: "GET",
538
+ headers: headerParameters,
539
+ query: queryParameters,
540
+ }, initOverrides);
541
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetPortfolioTradeStatisticsResponseFromJSON(jsonValue));
542
+ }
543
+ /**
544
+ * Load statistics based on the trade list for selected date ranges. The statistics (such as `longestWinningStreak` or `tradeCount`) are computed for each of the requested date ranges.
545
+ */
546
+ async getPortfolioTradeStatistics(requestParameters, initOverrides) {
547
+ const response = await this.getPortfolioTradeStatisticsRaw(requestParameters, initOverrides);
548
+ return await response.value();
549
+ }
550
+ /**
551
+ */
552
+ async getPortfolioTradeWarningsRaw(requestParameters, initOverrides) {
553
+ if (requestParameters.portfolioId === null ||
554
+ requestParameters.portfolioId === undefined) {
555
+ throw new runtime.RequiredError("portfolioId", "Required parameter requestParameters.portfolioId was null or undefined when calling getPortfolioTradeWarnings.");
556
+ }
557
+ const queryParameters = {};
558
+ const headerParameters = {};
559
+ if (this.configuration && this.configuration.apiKey) {
560
+ headerParameters["x-brkrz-client-id"] =
561
+ this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
562
+ }
563
+ if (this.configuration && this.configuration.accessToken) {
564
+ const token = this.configuration.accessToken;
565
+ const tokenString = await token("idToken", []);
566
+ if (tokenString) {
567
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
568
+ }
569
+ }
570
+ const response = await this.request({
571
+ path: `/portfolios/{portfolioId}/trades/warnings`.replace(`{${"portfolioId"}}`, encodeURIComponent(String(requestParameters.portfolioId))),
572
+ method: "GET",
573
+ headers: headerParameters,
574
+ query: queryParameters,
575
+ }, initOverrides);
576
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(TradeWarningFromJSON));
577
+ }
578
+ /**
579
+ */
580
+ async getPortfolioTradeWarnings(requestParameters, initOverrides) {
581
+ const response = await this.getPortfolioTradeWarningsRaw(requestParameters, initOverrides);
582
+ return await response.value();
583
+ }
584
+ /**
585
+ * Load a list of completed trades in a portfolio. A completed trade corresponds to *one* closing of a position. Technically each closing of a position corresponds to one execution of an order with `intent=close` (usually those are sell orders, but in the case of short selling, opening a position is a sell order with intent=open). The analysis follows the FIFO (First In, First Out) principle to accurately summarize trades. Each time a position is closed (note that partial executions are possible. In this case, each individual execution is regarded as a transaction), the system identifies the earliest corresponding \"open position execution\" that contributed to that closing. The result includes a single entry for each closing transaction, detailing key metrics such as profit/loss and holding period, based on the matched opening transactions. This could be a real world example: - 2020-01-01: buy 5 stock1 for 100 USD each - 2021-06-01: buy 3 stock1 for 200 USD each - 2021-06-06: sell 6 stock1 for 300 USD each In this case, the result would be one completed trade (corresponding to the last sell) with a profit of `(300*6)-(100*5+1*200)=1800-700=1100 USD`. There is an open position remaining (2 units of stock1, which correspond to the second buy transaction). When we add this sell: - 2021-06-07: sell 2 stock1 for 400 USD each It would add a second complete trade with a profit of `(400*2)-(200*2)=800-400=400 USD`. For some brokers, the order history may be incomplete (e.g. only reveals the latest 90 days), so that we do not know if there could be older transactions. Thus, our implementation might detect (given the current set of open positions together with the list of order executions) that we cannot figure out the corresponding opening transactions for a closing transaction. Affected trades will be ignored for this analysis and might appear as warning items in the `/warnings` endpoint. Frontends should show those warnings so that users can understand why the analysis is incomplete.
586
+ */
587
+ async getPortfolioTradesRaw(requestParameters, initOverrides) {
588
+ if (requestParameters.portfolioId === null ||
589
+ requestParameters.portfolioId === undefined) {
590
+ throw new runtime.RequiredError("portfolioId", "Required parameter requestParameters.portfolioId was null or undefined when calling getPortfolioTrades.");
591
+ }
592
+ const queryParameters = {};
593
+ if (requestParameters.take !== undefined) {
594
+ queryParameters["take"] = requestParameters.take;
595
+ }
596
+ if (requestParameters.skip !== undefined) {
597
+ queryParameters["skip"] = requestParameters.skip;
598
+ }
599
+ const headerParameters = {};
600
+ if (this.configuration && this.configuration.apiKey) {
601
+ headerParameters["x-brkrz-client-id"] =
602
+ this.configuration.apiKey("x-brkrz-client-id"); // clientId authentication
603
+ }
604
+ if (this.configuration && this.configuration.accessToken) {
605
+ const token = this.configuration.accessToken;
606
+ const tokenString = await token("idToken", []);
607
+ if (tokenString) {
608
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
609
+ }
610
+ }
611
+ const response = await this.request({
612
+ path: `/portfolios/{portfolioId}/trades`.replace(`{${"portfolioId"}}`, encodeURIComponent(String(requestParameters.portfolioId))),
613
+ method: "GET",
614
+ headers: headerParameters,
615
+ query: queryParameters,
616
+ }, initOverrides);
617
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetPortfolioTradesResponseFromJSON(jsonValue));
618
+ }
619
+ /**
620
+ * Load a list of completed trades in a portfolio. A completed trade corresponds to *one* closing of a position. Technically each closing of a position corresponds to one execution of an order with `intent=close` (usually those are sell orders, but in the case of short selling, opening a position is a sell order with intent=open). The analysis follows the FIFO (First In, First Out) principle to accurately summarize trades. Each time a position is closed (note that partial executions are possible. In this case, each individual execution is regarded as a transaction), the system identifies the earliest corresponding \"open position execution\" that contributed to that closing. The result includes a single entry for each closing transaction, detailing key metrics such as profit/loss and holding period, based on the matched opening transactions. This could be a real world example: - 2020-01-01: buy 5 stock1 for 100 USD each - 2021-06-01: buy 3 stock1 for 200 USD each - 2021-06-06: sell 6 stock1 for 300 USD each In this case, the result would be one completed trade (corresponding to the last sell) with a profit of `(300*6)-(100*5+1*200)=1800-700=1100 USD`. There is an open position remaining (2 units of stock1, which correspond to the second buy transaction). When we add this sell: - 2021-06-07: sell 2 stock1 for 400 USD each It would add a second complete trade with a profit of `(400*2)-(200*2)=800-400=400 USD`. For some brokers, the order history may be incomplete (e.g. only reveals the latest 90 days), so that we do not know if there could be older transactions. Thus, our implementation might detect (given the current set of open positions together with the list of order executions) that we cannot figure out the corresponding opening transactions for a closing transaction. Affected trades will be ignored for this analysis and might appear as warning items in the `/warnings` endpoint. Frontends should show those warnings so that users can understand why the analysis is incomplete.
621
+ */
622
+ async getPortfolioTrades(requestParameters, initOverrides) {
623
+ const response = await this.getPortfolioTradesRaw(requestParameters, initOverrides);
624
+ return await response.value();
625
+ }
507
626
  /**
508
627
  */
509
628
  async getPortfoliosRaw(initOverrides) {
@@ -678,7 +797,7 @@ export class DefaultApi extends runtime.BaseAPI {
678
797
  query: queryParameters,
679
798
  body: formParams,
680
799
  }, initOverrides);
681
- return new runtime.JSONApiResponse(response, (jsonValue) => ObtainToken200ResponseFromJSON(jsonValue));
800
+ return new runtime.JSONApiResponse(response, (jsonValue) => TokenResponseFromJSON(jsonValue));
682
801
  }
683
802
  /**
684
803
  * Obtain a new access token using a refresh token as specified in https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4. If `CreateGuestUser` has provided a `refresh_token`, this endpoint may be used to obtain a new `access_token` after the original token has expired.
@@ -50,6 +50,13 @@ export interface ClientConfig {
50
50
  * @memberof ClientConfig
51
51
  */
52
52
  cognitoClientIds: Array<string>;
53
+ /**
54
+ * If this is true, crypto trading is allowed for this client. If this is true, clients must send
55
+ * some requests to the crypto trading service (for crypto orders) which is controlled by the flag `tradingViaCryptoService`.
56
+ * @type {boolean}
57
+ * @memberof ClientConfig
58
+ */
59
+ cryptoTradingAllowed?: boolean;
53
60
  /**
54
61
  *
55
62
  * @type {boolean}
@@ -30,6 +30,9 @@ export function ClientConfigFromJSONTyped(json, ignoreDiscriminator) {
30
30
  : json["allowedOriginsRegularExpressions"],
31
31
  brokerEnvFilter: mapValues(json["brokerEnvFilter"], BrokerEnvFilterTypeFromJSON),
32
32
  cognitoClientIds: json["cognitoClientIds"],
33
+ cryptoTradingAllowed: !exists(json, "cryptoTradingAllowed")
34
+ ? undefined
35
+ : json["cryptoTradingAllowed"],
33
36
  enabled: json["enabled"],
34
37
  guestUserInactivityTimeoutSeconds: !exists(json, "guestUserInactivityTimeoutSeconds")
35
38
  ? undefined
@@ -63,6 +66,7 @@ export function ClientConfigToJSONRecursive(value, ignoreParent = false) {
63
66
  allowedOriginsRegularExpressions: value.allowedOriginsRegularExpressions,
64
67
  brokerEnvFilter: mapValues(value.brokerEnvFilter, BrokerEnvFilterTypeToJSON),
65
68
  cognitoClientIds: value.cognitoClientIds,
69
+ cryptoTradingAllowed: value.cryptoTradingAllowed,
66
70
  enabled: value.enabled,
67
71
  guestUserInactivityTimeoutSeconds: value.guestUserInactivityTimeoutSeconds,
68
72
  guestUserLifetime: GuestUserLifetimeToJSON(value.guestUserLifetime),
@@ -65,6 +65,12 @@ export interface ClientConfigUpdate {
65
65
  * @memberof ClientConfigUpdate
66
66
  */
67
67
  cognitoClientIds?: Array<string>;
68
+ /**
69
+ * If this is true, crypto trading is allowed for this client.
70
+ * @type {boolean}
71
+ * @memberof ClientConfigUpdate
72
+ */
73
+ cryptoTradingAllowed?: boolean;
68
74
  /**
69
75
  *
70
76
  * @type {boolean}
@@ -47,6 +47,9 @@ export function ClientConfigUpdateFromJSONTyped(json, ignoreDiscriminator) {
47
47
  cognitoClientIds: !exists(json, "cognitoClientIds")
48
48
  ? undefined
49
49
  : json["cognitoClientIds"],
50
+ cryptoTradingAllowed: !exists(json, "cryptoTradingAllowed")
51
+ ? undefined
52
+ : json["cryptoTradingAllowed"],
50
53
  enabled: !exists(json, "enabled") ? undefined : json["enabled"],
51
54
  guestUserInactivityTimeoutSeconds: !exists(json, "guestUserInactivityTimeoutSeconds")
52
55
  ? undefined
@@ -101,6 +104,7 @@ export function ClientConfigUpdateToJSONRecursive(value, ignoreParent = false) {
101
104
  : mapValues(value.brokerEnvFilter, BrokerEnvFilterTypeToJSON),
102
105
  clientSecrets: value.clientSecrets,
103
106
  cognitoClientIds: value.cognitoClientIds,
107
+ cryptoTradingAllowed: value.cryptoTradingAllowed,
104
108
  enabled: value.enabled,
105
109
  guestUserInactivityTimeoutSeconds: value.guestUserInactivityTimeoutSeconds,
106
110
  guestUserLifetime: GuestUserLifetimeToJSON(value.guestUserLifetime),
@@ -0,0 +1,28 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { TradeStatisticsItem } from "./TradeStatisticsItem";
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface GetPortfolioTradeStatisticsResponse
16
+ */
17
+ export interface GetPortfolioTradeStatisticsResponse {
18
+ /**
19
+ *
20
+ * @type {Array<TradeStatisticsItem>}
21
+ * @memberof GetPortfolioTradeStatisticsResponse
22
+ */
23
+ data: Array<TradeStatisticsItem>;
24
+ }
25
+ export declare function GetPortfolioTradeStatisticsResponseFromJSON(json: any): GetPortfolioTradeStatisticsResponse;
26
+ export declare function GetPortfolioTradeStatisticsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetPortfolioTradeStatisticsResponse;
27
+ export declare function GetPortfolioTradeStatisticsResponseToJSONRecursive(value?: GetPortfolioTradeStatisticsResponse | null, ignoreParent?: boolean): any;
28
+ export declare function GetPortfolioTradeStatisticsResponseToJSON(value?: GetPortfolioTradeStatisticsResponse | null): any;
@@ -0,0 +1,38 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * brokerize
5
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
6
+ *
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ import { TradeStatisticsItemFromJSON, TradeStatisticsItemToJSON, } from "./TradeStatisticsItem";
14
+ export function GetPortfolioTradeStatisticsResponseFromJSON(json) {
15
+ return GetPortfolioTradeStatisticsResponseFromJSONTyped(json, false);
16
+ }
17
+ export function GetPortfolioTradeStatisticsResponseFromJSONTyped(json, ignoreDiscriminator) {
18
+ if (json === undefined || json === null) {
19
+ return json;
20
+ }
21
+ return {
22
+ data: json["data"].map(TradeStatisticsItemFromJSON),
23
+ };
24
+ }
25
+ export function GetPortfolioTradeStatisticsResponseToJSONRecursive(value, ignoreParent = false) {
26
+ if (value === undefined) {
27
+ return undefined;
28
+ }
29
+ if (value === null) {
30
+ return null;
31
+ }
32
+ return {
33
+ data: value.data.map(TradeStatisticsItemToJSON),
34
+ };
35
+ }
36
+ export function GetPortfolioTradeStatisticsResponseToJSON(value) {
37
+ return GetPortfolioTradeStatisticsResponseToJSONRecursive(value, false);
38
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { SummarizedTrade } from "./SummarizedTrade";
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface GetPortfolioTradesResponse
16
+ */
17
+ export interface GetPortfolioTradesResponse {
18
+ /**
19
+ *
20
+ * @type {number}
21
+ * @memberof GetPortfolioTradesResponse
22
+ */
23
+ totalCount: number;
24
+ /**
25
+ *
26
+ * @type {Array<SummarizedTrade>}
27
+ * @memberof GetPortfolioTradesResponse
28
+ */
29
+ trades: Array<SummarizedTrade>;
30
+ }
31
+ export declare function GetPortfolioTradesResponseFromJSON(json: any): GetPortfolioTradesResponse;
32
+ export declare function GetPortfolioTradesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetPortfolioTradesResponse;
33
+ export declare function GetPortfolioTradesResponseToJSONRecursive(value?: GetPortfolioTradesResponse | null, ignoreParent?: boolean): any;
34
+ export declare function GetPortfolioTradesResponseToJSON(value?: GetPortfolioTradesResponse | null): any;
@@ -0,0 +1,40 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * brokerize
5
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
6
+ *
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ import { SummarizedTradeFromJSON, SummarizedTradeToJSON, } from "./SummarizedTrade";
14
+ export function GetPortfolioTradesResponseFromJSON(json) {
15
+ return GetPortfolioTradesResponseFromJSONTyped(json, false);
16
+ }
17
+ export function GetPortfolioTradesResponseFromJSONTyped(json, ignoreDiscriminator) {
18
+ if (json === undefined || json === null) {
19
+ return json;
20
+ }
21
+ return {
22
+ totalCount: json["totalCount"],
23
+ trades: json["trades"].map(SummarizedTradeFromJSON),
24
+ };
25
+ }
26
+ export function GetPortfolioTradesResponseToJSONRecursive(value, ignoreParent = false) {
27
+ if (value === undefined) {
28
+ return undefined;
29
+ }
30
+ if (value === null) {
31
+ return null;
32
+ }
33
+ return {
34
+ totalCount: value.totalCount,
35
+ trades: value.trades.map(SummarizedTradeToJSON),
36
+ };
37
+ }
38
+ export function GetPortfolioTradesResponseToJSON(value) {
39
+ return GetPortfolioTradesResponseToJSONRecursive(value, false);
40
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ import { Amount } from "./Amount";
12
+ import { Security } from "./Security";
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface SummarizedTrade
17
+ */
18
+ export interface SummarizedTrade {
19
+ /**
20
+ *
21
+ * @type {Date}
22
+ * @memberof SummarizedTrade
23
+ */
24
+ closeDateTime: Date;
25
+ /**
26
+ *
27
+ * @type {string}
28
+ * @memberof SummarizedTrade
29
+ */
30
+ details: string;
31
+ /**
32
+ *
33
+ * @type {Amount}
34
+ * @memberof SummarizedTrade
35
+ */
36
+ fees?: Amount;
37
+ /**
38
+ *
39
+ * @type {string}
40
+ * @memberof SummarizedTrade
41
+ */
42
+ id: string;
43
+ /**
44
+ *
45
+ * @type {Date}
46
+ * @memberof SummarizedTrade
47
+ */
48
+ openDateTime: Date;
49
+ /**
50
+ *
51
+ * @type {Amount}
52
+ * @memberof SummarizedTrade
53
+ */
54
+ profitLossAbs: Amount;
55
+ /**
56
+ *
57
+ * @type {number}
58
+ * @memberof SummarizedTrade
59
+ */
60
+ profitLossRel: number;
61
+ /**
62
+ *
63
+ * @type {Security}
64
+ * @memberof SummarizedTrade
65
+ */
66
+ security: Security;
67
+ /**
68
+ *
69
+ * @type {Amount}
70
+ * @memberof SummarizedTrade
71
+ */
72
+ size: Amount;
73
+ }
74
+ export declare function SummarizedTradeFromJSON(json: any): SummarizedTrade;
75
+ export declare function SummarizedTradeFromJSONTyped(json: any, ignoreDiscriminator: boolean): SummarizedTrade;
76
+ export declare function SummarizedTradeToJSONRecursive(value?: SummarizedTrade | null, ignoreParent?: boolean): any;
77
+ export declare function SummarizedTradeToJSON(value?: SummarizedTrade | null): any;
@@ -0,0 +1,56 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * brokerize
5
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
6
+ *
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ import { exists } from "../runtime";
14
+ import { AmountFromJSON, AmountToJSON, } from "./Amount";
15
+ import { SecurityFromJSON, SecurityToJSON, } from "./Security";
16
+ export function SummarizedTradeFromJSON(json) {
17
+ return SummarizedTradeFromJSONTyped(json, false);
18
+ }
19
+ export function SummarizedTradeFromJSONTyped(json, ignoreDiscriminator) {
20
+ if (json === undefined || json === null) {
21
+ return json;
22
+ }
23
+ return {
24
+ closeDateTime: new Date(json["closeDateTime"]),
25
+ details: json["details"],
26
+ fees: !exists(json, "fees") ? undefined : AmountFromJSON(json["fees"]),
27
+ id: json["id"],
28
+ openDateTime: new Date(json["openDateTime"]),
29
+ profitLossAbs: AmountFromJSON(json["profitLossAbs"]),
30
+ profitLossRel: json["profitLossRel"],
31
+ security: SecurityFromJSON(json["security"]),
32
+ size: AmountFromJSON(json["size"]),
33
+ };
34
+ }
35
+ export function SummarizedTradeToJSONRecursive(value, ignoreParent = false) {
36
+ if (value === undefined) {
37
+ return undefined;
38
+ }
39
+ if (value === null) {
40
+ return null;
41
+ }
42
+ return {
43
+ closeDateTime: value.closeDateTime.toISOString(),
44
+ details: value.details,
45
+ fees: AmountToJSON(value.fees),
46
+ id: value.id,
47
+ openDateTime: value.openDateTime.toISOString(),
48
+ profitLossAbs: AmountToJSON(value.profitLossAbs),
49
+ profitLossRel: value.profitLossRel,
50
+ security: SecurityToJSON(value.security),
51
+ size: AmountToJSON(value.size),
52
+ };
53
+ }
54
+ export function SummarizedTradeToJSON(value) {
55
+ return SummarizedTradeToJSONRecursive(value, false);
56
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * brokerize
3
+ * The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
4
+ *
5
+ *
6
+ *
7
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
+ * https://openapi-generator.tech
9
+ * Do not edit the class manually.
10
+ */
11
+ /**
12
+ *
13
+ * @export
14
+ * @interface TokenResponse
15
+ */
16
+ export interface TokenResponse {
17
+ /**
18
+ *
19
+ * @type {string}
20
+ * @memberof TokenResponse
21
+ */
22
+ accessToken: string;
23
+ /**
24
+ *
25
+ * @type {number}
26
+ * @memberof TokenResponse
27
+ */
28
+ expiresIn: number;
29
+ /**
30
+ *
31
+ * @type {string}
32
+ * @memberof TokenResponse
33
+ */
34
+ refreshToken: string;
35
+ /**
36
+ *
37
+ * @type {number}
38
+ * @memberof TokenResponse
39
+ */
40
+ refreshTokenExpiresIn: number;
41
+ /**
42
+ * token_type, it should always be "bearer"
43
+ * @type {string}
44
+ * @memberof TokenResponse
45
+ */
46
+ tokenType: string;
47
+ }
48
+ export declare function TokenResponseFromJSON(json: any): TokenResponse;
49
+ export declare function TokenResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenResponse;
50
+ export declare function TokenResponseToJSONRecursive(value?: TokenResponse | null, ignoreParent?: boolean): any;
51
+ export declare function TokenResponseToJSON(value?: TokenResponse | null): any;