@brokerize/client 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/authorizedApiContext.js +2 -3
  2. package/dist/cjs/authorizedApiContext.js +1 -2
  3. package/dist/cjs/errors.d.ts +14 -0
  4. package/dist/cjs/errors.js +48 -1
  5. package/dist/cjs/index.d.ts +2 -2
  6. package/dist/cjs/index.js +3 -4
  7. package/dist/cjs/modelExports.d.ts +2 -0
  8. package/dist/cjs/modelExports.js +5 -1
  9. package/dist/cjs/swagger/models/BrokerClientCfg.d.ts +7 -0
  10. package/dist/cjs/swagger/models/BrokerClientCfg.js +5 -0
  11. package/dist/cjs/swagger/models/BrokerMeta.d.ts +15 -0
  12. package/dist/cjs/swagger/models/BrokerMeta.js +2 -0
  13. package/dist/cjs/swagger/models/ClientConfigUpdateOAuthLoginForm.d.ts +12 -1
  14. package/dist/cjs/swagger/models/ClientConfigUpdateOAuthLoginForm.js +2 -0
  15. package/dist/cjs/swagger/models/OAuthLoginFormConfig.d.ts +12 -1
  16. package/dist/cjs/swagger/models/OAuthLoginFormConfig.js +2 -0
  17. package/dist/cjs/swagger/models/Order.d.ts +9 -1
  18. package/dist/cjs/swagger/models/OrderCreate.d.ts +2 -1
  19. package/dist/cjs/swagger/models/PrepareOAuthRedirectParams.d.ts +15 -0
  20. package/dist/cjs/swagger/models/PrepareOAuthRedirectParams.js +11 -0
  21. package/dist/cjs/swagger/models/SmartbrokerClientCfg.d.ts +27 -0
  22. package/dist/cjs/swagger/models/SmartbrokerClientCfg.js +46 -0
  23. package/dist/cjs/swagger/models/SummarizedTrade.d.ts +14 -0
  24. package/dist/cjs/swagger/models/SummarizedTrade.js +4 -0
  25. package/dist/cjs/swagger/models/TradeWarning.d.ts +31 -1
  26. package/dist/cjs/swagger/models/TradeWarning.js +13 -0
  27. package/dist/cjs/swagger/models/TradeWarningReason.d.ts +45 -0
  28. package/dist/cjs/swagger/models/TradeWarningReason.js +58 -0
  29. package/dist/cjs/swagger/models/index.d.ts +2 -0
  30. package/dist/cjs/swagger/models/index.js +2 -0
  31. package/dist/client.d.ts +209 -15
  32. package/dist/errors.d.ts +14 -0
  33. package/dist/errors.js +45 -0
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.js +3 -5
  36. package/dist/modelExports.d.ts +2 -0
  37. package/dist/modelExports.js +2 -0
  38. package/dist/swagger/models/BrokerClientCfg.d.ts +7 -0
  39. package/dist/swagger/models/BrokerClientCfg.js +5 -0
  40. package/dist/swagger/models/BrokerMeta.d.ts +15 -0
  41. package/dist/swagger/models/BrokerMeta.js +2 -0
  42. package/dist/swagger/models/ClientConfigUpdateOAuthLoginForm.d.ts +12 -1
  43. package/dist/swagger/models/ClientConfigUpdateOAuthLoginForm.js +2 -0
  44. package/dist/swagger/models/OAuthLoginFormConfig.d.ts +12 -1
  45. package/dist/swagger/models/OAuthLoginFormConfig.js +2 -0
  46. package/dist/swagger/models/Order.d.ts +9 -1
  47. package/dist/swagger/models/OrderCreate.d.ts +2 -1
  48. package/dist/swagger/models/PrepareOAuthRedirectParams.d.ts +15 -0
  49. package/dist/swagger/models/PrepareOAuthRedirectParams.js +10 -0
  50. package/dist/swagger/models/SmartbrokerClientCfg.d.ts +27 -0
  51. package/dist/swagger/models/SmartbrokerClientCfg.js +40 -0
  52. package/dist/swagger/models/SummarizedTrade.d.ts +14 -0
  53. package/dist/swagger/models/SummarizedTrade.js +4 -0
  54. package/dist/swagger/models/TradeWarning.d.ts +31 -1
  55. package/dist/swagger/models/TradeWarning.js +13 -0
  56. package/dist/swagger/models/TradeWarningReason.d.ts +45 -0
  57. package/dist/swagger/models/TradeWarningReason.js +52 -0
  58. package/dist/swagger/models/index.d.ts +2 -0
  59. package/dist/swagger/models/index.js +2 -0
  60. package/package.json +4 -4
package/dist/errors.js CHANGED
@@ -23,3 +23,48 @@ export class BrokerizeError extends Error {
23
23
  this.msgBrokerName = body.msgBrokerName;
24
24
  }
25
25
  }
26
+ /**
27
+ * Thrown if a request to the brokerize API timed out (HTTP status 504). This is typically sent by
28
+ * a load balancer or gateway in front of the API, so the response body usually is not a regular
29
+ * `ErrorResponse`.
30
+ */
31
+ export class BrokerizeTimeoutError extends BrokerizeError {
32
+ constructor(body) {
33
+ super(504, body);
34
+ this.name = "BrokerizeTimeoutError";
35
+ }
36
+ }
37
+ function isErrorResponse(x) {
38
+ return (!!x &&
39
+ typeof x === "object" &&
40
+ typeof x.msg === "string" &&
41
+ typeof x.code === "string");
42
+ }
43
+ /**
44
+ * Create the error for a failed (status >= 400) API response. If the body is not a valid `ErrorResponse`
45
+ * (e.g. an HTML error page from a load balancer), a generic error body is used instead of failing with a
46
+ * JSON parse error.
47
+ */
48
+ export async function createErrorFromResponse(response) {
49
+ const statusCode = response.status;
50
+ let body;
51
+ try {
52
+ const parsed = JSON.parse(await response.text());
53
+ if (isErrorResponse(parsed)) {
54
+ body = parsed;
55
+ }
56
+ }
57
+ catch (_a) {
58
+ /* not JSON, use the fallback below */
59
+ }
60
+ if (statusCode == 504) {
61
+ return new BrokerizeTimeoutError(body || {
62
+ msg: "The request timed out. Please try again.",
63
+ code: "TIMEOUT",
64
+ });
65
+ }
66
+ return new BrokerizeError(statusCode, body || {
67
+ msg: "The request failed with status " + statusCode + ".",
68
+ code: "INTERNAL_SERVER_ERROR",
69
+ });
70
+ }
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Auth, AuthContextConfiguration, BrokerizeConfig, CognitoConfig, CognitoFacade, CognitoPoolConfig, GuestAuthContextConfiguration, RegisteredUserAuthContextConfiguration, TokenSet } from "./apiCtx";
2
2
  import { AuthorizedApiContext } from "./authorizedApiContext";
3
- import { BrokerizeError } from "./errors";
3
+ import { BrokerizeError, BrokerizeTimeoutError } from "./errors";
4
4
  import * as openApiClient from "./swagger";
5
5
  import * as Models from "./modelExports";
6
6
  import { BrokerizeWebSocketClient, Callback, Subscription } from "./websocketClient";
7
7
  import * as WebSocketTypes from "./websocketTypes";
8
8
  import * as Utils from "./utils";
9
- export { BrokerizeConfig, AuthContextConfiguration, AuthorizedApiContext, BrokerizeWebSocketClient, Models, WebSocketTypes, Subscription, Callback, Utils, BrokerizeError, Auth, TokenSet, };
9
+ export { BrokerizeConfig, AuthContextConfiguration, AuthorizedApiContext, BrokerizeWebSocketClient, Models, WebSocketTypes, Subscription, Callback, Utils, BrokerizeError, BrokerizeTimeoutError, Auth, TokenSet, };
10
10
  export { CognitoPoolConfig, RegisteredUserAuthContextConfiguration };
11
11
  export { CognitoConfig, CognitoFacade };
12
12
  export declare class Brokerize {
package/dist/index.js CHANGED
@@ -2,13 +2,13 @@
2
2
  but reduced to the parts actually used by bg-trading. */
3
3
  import { createAuth, createConfiguration, withAcceptLanguage, } from "./apiCtx.js";
4
4
  import { AuthorizedApiContext, getWebSocketURLByBasePath, } from "./authorizedApiContext.js";
5
- import { BrokerizeError } from "./errors.js";
5
+ import { BrokerizeError, BrokerizeTimeoutError, createErrorFromResponse, } from "./errors.js";
6
6
  import * as openApiClient from "./swagger/index.js";
7
7
  import * as Models from "./modelExports.js";
8
8
  import { BrokerizeWebSocketClientImpl, } from "./websocketClient.js";
9
9
  import * as WebSocketTypes from "./websocketTypes.js";
10
10
  import * as Utils from "./utils.js";
11
- export { AuthorizedApiContext, Models, WebSocketTypes, Utils, BrokerizeError, };
11
+ export { AuthorizedApiContext, Models, WebSocketTypes, Utils, BrokerizeError, BrokerizeTimeoutError, };
12
12
  export class Brokerize {
13
13
  constructor(cfg) {
14
14
  if (!cfg.fetch) {
@@ -38,9 +38,7 @@ export class Brokerize {
38
38
  const postMiddleware = async (r) => {
39
39
  const statusCode = r.response.status;
40
40
  if (statusCode >= 400) {
41
- const decJson = (await r.response.json());
42
- const err = new BrokerizeError(statusCode, decJson);
43
- throw err;
41
+ throw await createErrorFromResponse(r.response);
44
42
  }
45
43
  };
46
44
  this._userApi = new openApiClient.UserApi(createConfiguration(cfg)).withPostMiddleware(postMiddleware);
@@ -124,6 +124,7 @@ export { PortfoliosResponse } from "./swagger/models/PortfoliosResponse";
124
124
  export { Position } from "./swagger/models/Position";
125
125
  export { PositionValuation } from "./swagger/models/PositionValuation";
126
126
  export { PrepareOAuthRedirectParams } from "./swagger/models/PrepareOAuthRedirectParams";
127
+ export { PrepareOAuthRedirectParamsAppearanceEnum } from "./swagger/models/PrepareOAuthRedirectParams";
127
128
  export { PrepareOAuthRedirectResponse } from "./swagger/models/PrepareOAuthRedirectResponse";
128
129
  export { PrepareTradeResponse } from "./swagger/models/PrepareTradeResponse";
129
130
  export { PreparedTrade } from "./swagger/models/PreparedTrade";
@@ -156,6 +157,7 @@ export { OrderIntent } from "./swagger/models/OrderIntent";
156
157
  export { OrderIntentAvailability } from "./swagger/models/OrderIntentAvailability";
157
158
  export { SummarizedTrade } from "./swagger/models/SummarizedTrade";
158
159
  export { TradeWarning } from "./swagger/models/TradeWarning";
160
+ export { TradeWarningReason } from "./swagger/models/TradeWarningReason";
159
161
  export { GetPortfolioTradesResponse } from "./swagger/models/GetPortfolioTradesResponse";
160
162
  export { GetPortfolioTradeStatisticsResponse } from "./swagger/models/GetPortfolioTradeStatisticsResponse";
161
163
  export { TradeStatisticsItem } from "./swagger/models/TradeStatisticsItem";
@@ -15,6 +15,8 @@ export { OrderModel } from "./swagger/models/OrderModel.js";
15
15
  export { OrderStatus } from "./swagger/models/OrderStatus.js";
16
16
  export { OrderValidityType } from "./swagger/models/OrderValidityType.js";
17
17
  export { PortfolioSyncInfoStatus } from "./swagger/models/PortfolioSyncInfoStatus.js";
18
+ export { PrepareOAuthRedirectParamsAppearanceEnum } from "./swagger/models/PrepareOAuthRedirectParams.js";
18
19
  export { SessionSyncInfoStatus } from "./swagger/models/SessionSyncInfoStatus.js";
19
20
  export { TrailingDistanceModeEnum, } from "./swagger/models/TrailingDistance.js";
20
21
  export { OrderIntent } from "./swagger/models/OrderIntent.js";
22
+ export { TradeWarningReason } from "./swagger/models/TradeWarningReason.js";
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import { BitpandaClientCfg } from "./BitpandaClientCfg";
12
12
  import { CoinbaseClientCfg } from "./CoinbaseClientCfg";
13
+ import { SmartbrokerClientCfg } from "./SmartbrokerClientCfg";
13
14
  /**
14
15
  *
15
16
  * @export
@@ -28,6 +29,12 @@ export interface BrokerClientCfg {
28
29
  * @memberof BrokerClientCfg
29
30
  */
30
31
  coinbase?: CoinbaseClientCfg;
32
+ /**
33
+ *
34
+ * @type {SmartbrokerClientCfg}
35
+ * @memberof BrokerClientCfg
36
+ */
37
+ smartbroker?: SmartbrokerClientCfg;
31
38
  }
32
39
  export declare function BrokerClientCfgFromJSON(json: any): BrokerClientCfg;
33
40
  export declare function BrokerClientCfgFromJSONTyped(json: any, ignoreDiscriminator: boolean): BrokerClientCfg;
@@ -13,6 +13,7 @@
13
13
  import { exists } from "../runtime.js";
14
14
  import { BitpandaClientCfgFromJSON, BitpandaClientCfgToJSON, } from "./BitpandaClientCfg.js";
15
15
  import { CoinbaseClientCfgFromJSON, CoinbaseClientCfgToJSON, } from "./CoinbaseClientCfg.js";
16
+ import { SmartbrokerClientCfgFromJSON, SmartbrokerClientCfgToJSON, } from "./SmartbrokerClientCfg.js";
16
17
  export function BrokerClientCfgFromJSON(json) {
17
18
  return BrokerClientCfgFromJSONTyped(json, false);
18
19
  }
@@ -27,6 +28,9 @@ export function BrokerClientCfgFromJSONTyped(json, ignoreDiscriminator) {
27
28
  coinbase: !exists(json, "coinbase")
28
29
  ? undefined
29
30
  : CoinbaseClientCfgFromJSON(json["coinbase"]),
31
+ smartbroker: !exists(json, "smartbroker")
32
+ ? undefined
33
+ : SmartbrokerClientCfgFromJSON(json["smartbroker"]),
30
34
  };
31
35
  }
32
36
  export function BrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
@@ -39,6 +43,7 @@ export function BrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
39
43
  return {
40
44
  bitpanda: BitpandaClientCfgToJSON(value.bitpanda),
41
45
  coinbase: CoinbaseClientCfgToJSON(value.coinbase),
46
+ smartbroker: SmartbrokerClientCfgToJSON(value.smartbroker),
42
47
  };
43
48
  }
44
49
  export function BrokerClientCfgToJSON(value) {
@@ -61,6 +61,21 @@ export interface BrokerMeta {
61
61
  * @memberof BrokerMeta
62
62
  */
63
63
  loginForm?: BrokerLoginForm;
64
+ /**
65
+ * All brokerize exchange ids this broker's exchanges are mapped to, ascending. Use it to tell
66
+ * upfront which brokers may be relevant for a given exchange, e.g. to preselect brokers for a
67
+ * security that is traded there.
68
+ *
69
+ * This is a static, broker-wide list: it means that brokerize knows how to translate between
70
+ * this broker's exchanges and the listed ids, not that every security can be traded at every
71
+ * one of them. The authoritative, security-specific list of tradable exchanges remains the
72
+ * `exchanges` field of a prepared trade.
73
+ *
74
+ * Every id is contained in the `GetExchanges` response, so it can always be resolved to a name.
75
+ * @type {Array<number>}
76
+ * @memberof BrokerMeta
77
+ */
78
+ supportedExchangeIds: Array<number>;
64
79
  /**
65
80
  * If true, the user can login at the broker via OAuth (this involves browser redirects). Use `prepareOAuthRedirect` to obtain a URL to redirect to.
66
81
  * @type {boolean}
@@ -32,6 +32,7 @@ export function BrokerMetaFromJSONTyped(json, ignoreDiscriminator) {
32
32
  loginForm: !exists(json, "loginForm")
33
33
  ? undefined
34
34
  : BrokerLoginFormFromJSON(json["loginForm"]),
35
+ supportedExchangeIds: json["supportedExchangeIds"],
35
36
  supportsOAuthLogin: !exists(json, "supportsOAuthLogin")
36
37
  ? undefined
37
38
  : json["supportsOAuthLogin"],
@@ -52,6 +53,7 @@ export function BrokerMetaToJSONRecursive(value, ignoreParent = false) {
52
53
  features: BrokerMetaFeaturesToJSON(value.features),
53
54
  images: BrokerMetaImagesToJSON(value.images),
54
55
  loginForm: BrokerLoginFormToJSON(value.loginForm),
56
+ supportedExchangeIds: value.supportedExchangeIds,
55
57
  supportsOAuthLogin: value.supportsOAuthLogin,
56
58
  };
57
59
  }
@@ -33,13 +33,22 @@ export interface ClientConfigUpdateOAuthLoginForm {
33
33
  */
34
34
  logoUrlLight?: string;
35
35
  /**
36
+ * How the browser is sent back to the `returnTo` URL after a successful broker login.
36
37
  *
38
+ * `meta`, `js` and `link` render the interstitial callback screen and redirect from there (via a
39
+ * meta refresh, via JavaScript, or by revealing a link the user clicks). `http` skips the screen
40
+ * and answers the callback with a plain HTTP 302 instead.
41
+ *
42
+ * `http` only applies to `http`/`https` `returnTo` URLs. A `returnTo` in a custom app scheme
43
+ * still gets the interstitial, because browsers handle a 302 into an app scheme inconsistently.
44
+ *
45
+ * Default is `meta`.
37
46
  * @type {string}
38
47
  * @memberof ClientConfigUpdateOAuthLoginForm
39
48
  */
40
49
  redirectStyle?: ClientConfigUpdateOAuthLoginFormRedirectStyleEnum;
41
50
  /**
42
- *
51
+ * Overrides `redirectStyle` for logins at bitpanda.
43
52
  * @type {string}
44
53
  * @memberof ClientConfigUpdateOAuthLoginForm
45
54
  */
@@ -52,6 +61,7 @@ export declare const ClientConfigUpdateOAuthLoginFormRedirectStyleEnum: {
52
61
  readonly Meta: "meta";
53
62
  readonly Js: "js";
54
63
  readonly Link: "link";
64
+ readonly Http: "http";
55
65
  };
56
66
  export type ClientConfigUpdateOAuthLoginFormRedirectStyleEnum = (typeof ClientConfigUpdateOAuthLoginFormRedirectStyleEnum)[keyof typeof ClientConfigUpdateOAuthLoginFormRedirectStyleEnum];
57
67
  /**
@@ -61,6 +71,7 @@ export declare const ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum:
61
71
  readonly Meta: "meta";
62
72
  readonly Js: "js";
63
73
  readonly Link: "link";
74
+ readonly Http: "http";
64
75
  };
65
76
  export type ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum = (typeof ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum)[keyof typeof ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum];
66
77
  export declare function ClientConfigUpdateOAuthLoginFormFromJSON(json: any): ClientConfigUpdateOAuthLoginForm;
@@ -18,6 +18,7 @@ export const ClientConfigUpdateOAuthLoginFormRedirectStyleEnum = {
18
18
  Meta: "meta",
19
19
  Js: "js",
20
20
  Link: "link",
21
+ Http: "http",
21
22
  };
22
23
  /**
23
24
  * @export
@@ -26,6 +27,7 @@ export const ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum = {
26
27
  Meta: "meta",
27
28
  Js: "js",
28
29
  Link: "link",
30
+ Http: "http",
29
31
  };
30
32
  export function ClientConfigUpdateOAuthLoginFormFromJSON(json) {
31
33
  return ClientConfigUpdateOAuthLoginFormFromJSONTyped(json, false);
@@ -33,13 +33,22 @@ export interface OAuthLoginFormConfig {
33
33
  */
34
34
  logoUrlLight?: string;
35
35
  /**
36
+ * How the browser is sent back to the `returnTo` URL after a successful broker login.
36
37
  *
38
+ * `meta`, `js` and `link` render the interstitial callback screen and redirect from there (via a
39
+ * meta refresh, via JavaScript, or by revealing a link the user clicks). `http` skips the screen
40
+ * and answers the callback with a plain HTTP 302 instead.
41
+ *
42
+ * `http` only applies to `http`/`https` `returnTo` URLs. A `returnTo` in a custom app scheme
43
+ * still gets the interstitial, because browsers handle a 302 into an app scheme inconsistently.
44
+ *
45
+ * Default is `meta`.
37
46
  * @type {string}
38
47
  * @memberof OAuthLoginFormConfig
39
48
  */
40
49
  redirectStyle?: OAuthLoginFormConfigRedirectStyleEnum;
41
50
  /**
42
- *
51
+ * Overrides `redirectStyle` for logins at bitpanda.
43
52
  * @type {string}
44
53
  * @memberof OAuthLoginFormConfig
45
54
  */
@@ -52,6 +61,7 @@ export declare const OAuthLoginFormConfigRedirectStyleEnum: {
52
61
  readonly Meta: "meta";
53
62
  readonly Js: "js";
54
63
  readonly Link: "link";
64
+ readonly Http: "http";
55
65
  };
56
66
  export type OAuthLoginFormConfigRedirectStyleEnum = (typeof OAuthLoginFormConfigRedirectStyleEnum)[keyof typeof OAuthLoginFormConfigRedirectStyleEnum];
57
67
  /**
@@ -61,6 +71,7 @@ export declare const OAuthLoginFormConfigRedirectStyleBitpandaEnum: {
61
71
  readonly Meta: "meta";
62
72
  readonly Js: "js";
63
73
  readonly Link: "link";
74
+ readonly Http: "http";
64
75
  };
65
76
  export type OAuthLoginFormConfigRedirectStyleBitpandaEnum = (typeof OAuthLoginFormConfigRedirectStyleBitpandaEnum)[keyof typeof OAuthLoginFormConfigRedirectStyleBitpandaEnum];
66
77
  export declare function OAuthLoginFormConfigFromJSON(json: any): OAuthLoginFormConfig;
@@ -18,6 +18,7 @@ export const OAuthLoginFormConfigRedirectStyleEnum = {
18
18
  Meta: "meta",
19
19
  Js: "js",
20
20
  Link: "link",
21
+ Http: "http",
21
22
  };
22
23
  /**
23
24
  * @export
@@ -26,6 +27,7 @@ export const OAuthLoginFormConfigRedirectStyleBitpandaEnum = {
26
27
  Meta: "meta",
27
28
  Js: "js",
28
29
  Link: "link",
30
+ Http: "http",
29
31
  };
30
32
  export function OAuthLoginFormConfigFromJSON(json) {
31
33
  return OAuthLoginFormConfigFromJSONTyped(json, false);
@@ -92,7 +92,14 @@ export interface Order {
92
92
  */
93
93
  bondCurrencyIso?: string;
94
94
  /**
95
+ * The id of the exchange, as defined by the *broker*.
95
96
  *
97
+ * When reading an order this **can be an empty string**: not every order is traded on an exchange -- a securities
98
+ * account transfer, for example, is booked into or out of the custody account and has no trading venue, so the
99
+ * broker reports no exchange for it. Clients must handle the empty string.
100
+ *
101
+ * Note that this field will become optional in a future version of the API, so clients should not rely on it
102
+ * being present at all. For creating an order it stays required, see `OrderCreate`.
96
103
  * @type {string}
97
104
  * @memberof Order
98
105
  */
@@ -176,7 +183,8 @@ export interface Order {
176
183
  */
177
184
  exchangeName?: string;
178
185
  /**
179
- * For fully executed orders: the timestamp of the *latest* execution.
186
+ * For orders with at least one execution (`executed`, `open_executed`, `canceled_executed`):
187
+ * the timestamp of the *latest* execution.
180
188
  * @type {Date}
181
189
  * @memberof Order
182
190
  */
@@ -21,7 +21,8 @@ import { TrailingDistance } from "./TrailingDistance";
21
21
  */
22
22
  export interface OrderCreate {
23
23
  /**
24
- *
24
+ * The id of the exchange, as defined by the *broker*. Always required to create an order, and never empty --
25
+ * unlike when reading an order, where the broker may report no exchange (see `OrderBase.brokerExchangeId`).
25
26
  * @type {string}
26
27
  * @memberof OrderCreate
27
28
  */
@@ -14,6 +14,13 @@
14
14
  * @interface PrepareOAuthRedirectParams
15
15
  */
16
16
  export interface PrepareOAuthRedirectParams {
17
+ /**
18
+ * Preferred appearance for login screens. Note that this can only be set explicitly for some selected brokers.
19
+ * If the broker does not support it, this is silently ignored and the default broker appearance is used.
20
+ * @type {string}
21
+ * @memberof PrepareOAuthRedirectParams
22
+ */
23
+ appearance?: PrepareOAuthRedirectParamsAppearanceEnum;
17
24
  /**
18
25
  *
19
26
  * @type {string}
@@ -33,6 +40,14 @@ export interface PrepareOAuthRedirectParams {
33
40
  */
34
41
  returnToUrl: string;
35
42
  }
43
+ /**
44
+ * @export
45
+ */
46
+ export declare const PrepareOAuthRedirectParamsAppearanceEnum: {
47
+ readonly Light: "light";
48
+ readonly Dark: "dark";
49
+ };
50
+ export type PrepareOAuthRedirectParamsAppearanceEnum = (typeof PrepareOAuthRedirectParamsAppearanceEnum)[keyof typeof PrepareOAuthRedirectParamsAppearanceEnum];
36
51
  export declare function PrepareOAuthRedirectParamsFromJSON(json: any): PrepareOAuthRedirectParams;
37
52
  export declare function PrepareOAuthRedirectParamsFromJSONTyped(json: any, ignoreDiscriminator: boolean): PrepareOAuthRedirectParams;
38
53
  export declare function PrepareOAuthRedirectParamsToJSONRecursive(value?: PrepareOAuthRedirectParams | null, ignoreParent?: boolean): any;
@@ -10,6 +10,14 @@
10
10
  * https://openapi-generator.tech
11
11
  * Do not edit the class manually.
12
12
  */
13
+ import { exists } from "../runtime.js";
14
+ /**
15
+ * @export
16
+ */
17
+ export const PrepareOAuthRedirectParamsAppearanceEnum = {
18
+ Light: "light",
19
+ Dark: "dark",
20
+ };
13
21
  export function PrepareOAuthRedirectParamsFromJSON(json) {
14
22
  return PrepareOAuthRedirectParamsFromJSONTyped(json, false);
15
23
  }
@@ -18,6 +26,7 @@ export function PrepareOAuthRedirectParamsFromJSONTyped(json, ignoreDiscriminato
18
26
  return json;
19
27
  }
20
28
  return {
29
+ appearance: !exists(json, "appearance") ? undefined : json["appearance"],
21
30
  brokerName: json["brokerName"],
22
31
  env: json["env"],
23
32
  returnToUrl: json["returnToUrl"],
@@ -31,6 +40,7 @@ export function PrepareOAuthRedirectParamsToJSONRecursive(value, ignoreParent =
31
40
  return null;
32
41
  }
33
42
  return {
43
+ appearance: value.appearance,
34
44
  brokerName: value.brokerName,
35
45
  env: value.env,
36
46
  returnToUrl: value.returnToUrl,
@@ -0,0 +1,27 @@
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 SmartbrokerClientCfg
15
+ */
16
+ export interface SmartbrokerClientCfg {
17
+ /**
18
+ * If the client must use a different broker-provided clientId, it can be configured here.
19
+ * @type {string}
20
+ * @memberof SmartbrokerClientCfg
21
+ */
22
+ clientIdProd?: string;
23
+ }
24
+ export declare function SmartbrokerClientCfgFromJSON(json: any): SmartbrokerClientCfg;
25
+ export declare function SmartbrokerClientCfgFromJSONTyped(json: any, ignoreDiscriminator: boolean): SmartbrokerClientCfg;
26
+ export declare function SmartbrokerClientCfgToJSONRecursive(value?: SmartbrokerClientCfg | null, ignoreParent?: boolean): any;
27
+ export declare function SmartbrokerClientCfgToJSON(value?: SmartbrokerClientCfg | 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 { exists } from "../runtime.js";
14
+ export function SmartbrokerClientCfgFromJSON(json) {
15
+ return SmartbrokerClientCfgFromJSONTyped(json, false);
16
+ }
17
+ export function SmartbrokerClientCfgFromJSONTyped(json, ignoreDiscriminator) {
18
+ if (json === undefined || json === null) {
19
+ return json;
20
+ }
21
+ return {
22
+ clientIdProd: !exists(json, "clientIdProd")
23
+ ? undefined
24
+ : json["clientIdProd"],
25
+ };
26
+ }
27
+ export function SmartbrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
28
+ if (value === undefined) {
29
+ return undefined;
30
+ }
31
+ if (value === null) {
32
+ return null;
33
+ }
34
+ return {
35
+ clientIdProd: value.clientIdProd,
36
+ };
37
+ }
38
+ export function SmartbrokerClientCfgToJSON(value) {
39
+ return SmartbrokerClientCfgToJSONRecursive(value, false);
40
+ }
@@ -28,6 +28,20 @@ export interface SummarizedTrade {
28
28
  * @memberof SummarizedTrade
29
29
  */
30
30
  closeDateTime: Date;
31
+ /**
32
+ * True if this trade was not closed by a sale but by the instrument being booked out — it knocked
33
+ * out or expired, and the issuer removed the position from the depot without a sell order ever
34
+ * reaching the order archive.
35
+ *
36
+ * The closing execution is therefore synthetic: brokerize derives it from the knock-out date and
37
+ * prices it with the instrument's closing price on that day (0 where none is known, which is the
38
+ * floor rather than a claim — the issuer's buy-back, if there was one, is not in the archive). The
39
+ * P/L is otherwise computed exactly like any other trade's, FIFO-matched against the position's own
40
+ * buys. Absent on an ordinary trade.
41
+ * @type {boolean}
42
+ * @memberof SummarizedTrade
43
+ */
44
+ closedByKnockOut?: boolean;
31
45
  /**
32
46
  *
33
47
  * @type {string}
@@ -23,6 +23,9 @@ export function SummarizedTradeFromJSONTyped(json, ignoreDiscriminator) {
23
23
  return {
24
24
  closeAvgQuotation: AmountFromJSON(json["closeAvgQuotation"]),
25
25
  closeDateTime: new Date(json["closeDateTime"]),
26
+ closedByKnockOut: !exists(json, "closedByKnockOut")
27
+ ? undefined
28
+ : json["closedByKnockOut"],
26
29
  details: json["details"],
27
30
  fees: !exists(json, "fees") ? undefined : AmountFromJSON(json["fees"]),
28
31
  id: json["id"],
@@ -57,6 +60,7 @@ export function SummarizedTradeToJSONRecursive(value, ignoreParent = false) {
57
60
  return {
58
61
  closeAvgQuotation: AmountToJSON(value.closeAvgQuotation),
59
62
  closeDateTime: value.closeDateTime.toISOString(),
63
+ closedByKnockOut: value.closedByKnockOut,
60
64
  details: value.details,
61
65
  fees: AmountToJSON(value.fees),
62
66
  id: value.id,
@@ -8,6 +8,8 @@
8
8
  * https://openapi-generator.tech
9
9
  * Do not edit the class manually.
10
10
  */
11
+ import { Security } from "./Security";
12
+ import { TradeWarningReason } from "./TradeWarningReason";
11
13
  /**
12
14
  *
13
15
  * @export
@@ -15,11 +17,39 @@
15
17
  */
16
18
  export interface TradeWarning {
17
19
  /**
18
- *
20
+ * Date in the format YYYY-MM-DD for validityType: 'GTD'
21
+ * Date in the format Date ISO string YYYY-MM-DDThh:mm:ss.fffZ for validityType: 'GTDT'
22
+ * @type {string}
23
+ * @memberof TradeWarning
24
+ */
25
+ fromDate?: string;
26
+ /**
27
+ * Human-readable description, currently German or English depending on where it originates. Meant
28
+ * as a fallback for displaying something at all — a client that knows `reason` should build its
29
+ * own text from the structured fields instead.
19
30
  * @type {string}
20
31
  * @memberof TradeWarning
21
32
  */
22
33
  message: string;
34
+ /**
35
+ *
36
+ * @type {TradeWarningReason}
37
+ * @memberof TradeWarning
38
+ */
39
+ reason: TradeWarningReason;
40
+ /**
41
+ *
42
+ * @type {Security}
43
+ * @memberof TradeWarning
44
+ */
45
+ security?: Security;
46
+ /**
47
+ * Date in the format YYYY-MM-DD for validityType: 'GTD'
48
+ * Date in the format Date ISO string YYYY-MM-DDThh:mm:ss.fffZ for validityType: 'GTDT'
49
+ * @type {string}
50
+ * @memberof TradeWarning
51
+ */
52
+ toDate?: string;
23
53
  }
24
54
  export declare function TradeWarningFromJSON(json: any): TradeWarning;
25
55
  export declare function TradeWarningFromJSONTyped(json: any, ignoreDiscriminator: boolean): TradeWarning;
@@ -10,6 +10,9 @@
10
10
  * https://openapi-generator.tech
11
11
  * Do not edit the class manually.
12
12
  */
13
+ import { exists } from "../runtime.js";
14
+ import { SecurityFromJSON, SecurityToJSON, } from "./Security.js";
15
+ import { TradeWarningReasonFromJSON, TradeWarningReasonToJSON, } from "./TradeWarningReason.js";
13
16
  export function TradeWarningFromJSON(json) {
14
17
  return TradeWarningFromJSONTyped(json, false);
15
18
  }
@@ -18,7 +21,13 @@ export function TradeWarningFromJSONTyped(json, ignoreDiscriminator) {
18
21
  return json;
19
22
  }
20
23
  return {
24
+ fromDate: !exists(json, "fromDate") ? undefined : json["fromDate"],
21
25
  message: json["message"],
26
+ reason: TradeWarningReasonFromJSON(json["reason"]),
27
+ security: !exists(json, "security")
28
+ ? undefined
29
+ : SecurityFromJSON(json["security"]),
30
+ toDate: !exists(json, "toDate") ? undefined : json["toDate"],
22
31
  };
23
32
  }
24
33
  export function TradeWarningToJSONRecursive(value, ignoreParent = false) {
@@ -29,7 +38,11 @@ export function TradeWarningToJSONRecursive(value, ignoreParent = false) {
29
38
  return null;
30
39
  }
31
40
  return {
41
+ fromDate: value.fromDate,
32
42
  message: value.message,
43
+ reason: TradeWarningReasonToJSON(value.reason),
44
+ security: SecurityToJSON(value.security),
45
+ toDate: value.toDate,
33
46
  };
34
47
  }
35
48
  export function TradeWarningToJSON(value) {
@@ -0,0 +1,45 @@
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
+ * Why a trade or portfolio-history computation could not give a complete answer. Clients switch on
13
+ * this instead of parsing `TradeWarning.message`, which is free text and may change at any time.
14
+ *
15
+ * - `executionsWithoutTimestamp`: order executions carry no execution time, so they cannot be placed
16
+ * on a timeline and were ignored altogether.
17
+ * - `inconsistentOrderHistory`: the executions of one security contradict each other or the reported
18
+ * holding (more sold than ever bought, a quantity that goes negative). Nothing can be reconstructed
19
+ * from them, so the security is left out of the value history and its trades are not reported.
20
+ * - `positionNotFullyExplained`: the order archive covers only part of a position — typical for
21
+ * brokers that return just the most recent weeks. What is held today is known, but its history
22
+ * reaches further back than the executions do.
23
+ * - `missingEodPrice`: no closing price was available for the security on some days; it was valued
24
+ * with the last price known before them.
25
+ * - `missingFxRate`: no exchange rate to the portfolio currency exists for the security's currency, so
26
+ * its amounts are *not* converted and the totals they enter are off by the conversion.
27
+ * - `unknownBuyPrice`: no purchase price could be determined for a position, so it is missing from the
28
+ * buy value (and from the profit it implies).
29
+ * - `realizedPnlUnavailable`: the completed trades could not be computed at all, which leaves the
30
+ * realized profit/loss empty rather than wrong.
31
+ * @export
32
+ */
33
+ export declare const TradeWarningReason: {
34
+ readonly ExecutionsWithoutTimestamp: "executionsWithoutTimestamp";
35
+ readonly InconsistentOrderHistory: "inconsistentOrderHistory";
36
+ readonly PositionNotFullyExplained: "positionNotFullyExplained";
37
+ readonly MissingEodPrice: "missingEodPrice";
38
+ readonly MissingFxRate: "missingFxRate";
39
+ readonly UnknownBuyPrice: "unknownBuyPrice";
40
+ readonly RealizedPnlUnavailable: "realizedPnlUnavailable";
41
+ };
42
+ export type TradeWarningReason = (typeof TradeWarningReason)[keyof typeof TradeWarningReason];
43
+ export declare function TradeWarningReasonFromJSON(json: any): TradeWarningReason;
44
+ export declare function TradeWarningReasonFromJSONTyped(json: any, ignoreDiscriminator: boolean): TradeWarningReason;
45
+ export declare function TradeWarningReasonToJSON(value?: TradeWarningReason | null): any;