@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.
- package/dist/authorizedApiContext.js +2 -3
- package/dist/cjs/authorizedApiContext.js +1 -2
- package/dist/cjs/errors.d.ts +14 -0
- package/dist/cjs/errors.js +48 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +3 -4
- package/dist/cjs/modelExports.d.ts +2 -0
- package/dist/cjs/modelExports.js +5 -1
- package/dist/cjs/swagger/models/BrokerClientCfg.d.ts +7 -0
- package/dist/cjs/swagger/models/BrokerClientCfg.js +5 -0
- package/dist/cjs/swagger/models/BrokerMeta.d.ts +15 -0
- package/dist/cjs/swagger/models/BrokerMeta.js +2 -0
- package/dist/cjs/swagger/models/ClientConfigUpdateOAuthLoginForm.d.ts +12 -1
- package/dist/cjs/swagger/models/ClientConfigUpdateOAuthLoginForm.js +2 -0
- package/dist/cjs/swagger/models/OAuthLoginFormConfig.d.ts +12 -1
- package/dist/cjs/swagger/models/OAuthLoginFormConfig.js +2 -0
- package/dist/cjs/swagger/models/Order.d.ts +9 -1
- package/dist/cjs/swagger/models/OrderCreate.d.ts +2 -1
- package/dist/cjs/swagger/models/PrepareOAuthRedirectParams.d.ts +15 -0
- package/dist/cjs/swagger/models/PrepareOAuthRedirectParams.js +11 -0
- package/dist/cjs/swagger/models/SmartbrokerClientCfg.d.ts +27 -0
- package/dist/cjs/swagger/models/SmartbrokerClientCfg.js +46 -0
- package/dist/cjs/swagger/models/SummarizedTrade.d.ts +14 -0
- package/dist/cjs/swagger/models/SummarizedTrade.js +4 -0
- package/dist/cjs/swagger/models/TradeWarning.d.ts +31 -1
- package/dist/cjs/swagger/models/TradeWarning.js +13 -0
- package/dist/cjs/swagger/models/TradeWarningReason.d.ts +45 -0
- package/dist/cjs/swagger/models/TradeWarningReason.js +58 -0
- package/dist/cjs/swagger/models/index.d.ts +2 -0
- package/dist/cjs/swagger/models/index.js +2 -0
- package/dist/client.d.ts +209 -15
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +45 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -5
- package/dist/modelExports.d.ts +2 -0
- package/dist/modelExports.js +2 -0
- package/dist/swagger/models/BrokerClientCfg.d.ts +7 -0
- package/dist/swagger/models/BrokerClientCfg.js +5 -0
- package/dist/swagger/models/BrokerMeta.d.ts +15 -0
- package/dist/swagger/models/BrokerMeta.js +2 -0
- package/dist/swagger/models/ClientConfigUpdateOAuthLoginForm.d.ts +12 -1
- package/dist/swagger/models/ClientConfigUpdateOAuthLoginForm.js +2 -0
- package/dist/swagger/models/OAuthLoginFormConfig.d.ts +12 -1
- package/dist/swagger/models/OAuthLoginFormConfig.js +2 -0
- package/dist/swagger/models/Order.d.ts +9 -1
- package/dist/swagger/models/OrderCreate.d.ts +2 -1
- package/dist/swagger/models/PrepareOAuthRedirectParams.d.ts +15 -0
- package/dist/swagger/models/PrepareOAuthRedirectParams.js +10 -0
- package/dist/swagger/models/SmartbrokerClientCfg.d.ts +27 -0
- package/dist/swagger/models/SmartbrokerClientCfg.js +40 -0
- package/dist/swagger/models/SummarizedTrade.d.ts +14 -0
- package/dist/swagger/models/SummarizedTrade.js +4 -0
- package/dist/swagger/models/TradeWarning.d.ts +31 -1
- package/dist/swagger/models/TradeWarning.js +13 -0
- package/dist/swagger/models/TradeWarningReason.d.ts +45 -0
- package/dist/swagger/models/TradeWarningReason.js +52 -0
- package/dist/swagger/models/index.d.ts +2 -0
- package/dist/swagger/models/index.js +2 -0
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Subject } from "rxjs";
|
|
2
2
|
import { createConfiguration, withAcceptLanguage, } from "./apiCtx.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createErrorFromResponse } from "./errors.js";
|
|
4
4
|
import { createPollingSubscription } from "./pollingSubscription.js";
|
|
5
5
|
import * as openApiClient from "./swagger/index.js";
|
|
6
6
|
import { BrokerizeWebSocketClientImpl, } from "./websocketClient.js";
|
|
@@ -25,8 +25,7 @@ export class AuthorizedApiContext {
|
|
|
25
25
|
const postMiddleware = async (r) => {
|
|
26
26
|
const statusCode = r.response.status;
|
|
27
27
|
if (statusCode >= 400) {
|
|
28
|
-
const
|
|
29
|
-
const err = new BrokerizeError(statusCode, decJson);
|
|
28
|
+
const err = await createErrorFromResponse(r.response);
|
|
30
29
|
if (statusCode == 401) {
|
|
31
30
|
this._logoutSubject.error(err);
|
|
32
31
|
}
|
|
@@ -62,8 +62,7 @@ class AuthorizedApiContext {
|
|
|
62
62
|
const postMiddleware = async (r) => {
|
|
63
63
|
const statusCode = r.response.status;
|
|
64
64
|
if (statusCode >= 400) {
|
|
65
|
-
const
|
|
66
|
-
const err = new errors_1.BrokerizeError(statusCode, decJson);
|
|
65
|
+
const err = await (0, errors_1.createErrorFromResponse)(r.response);
|
|
67
66
|
if (statusCode == 401) {
|
|
68
67
|
this._logoutSubject.error(err);
|
|
69
68
|
}
|
package/dist/cjs/errors.d.ts
CHANGED
|
@@ -65,3 +65,17 @@ export declare class BrokerizeError extends Error {
|
|
|
65
65
|
httpStatusCode: number;
|
|
66
66
|
constructor(statusCode: number, body: ErrorResponse);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Thrown if a request to the brokerize API timed out (HTTP status 504). This is typically sent by
|
|
70
|
+
* a load balancer or gateway in front of the API, so the response body usually is not a regular
|
|
71
|
+
* `ErrorResponse`.
|
|
72
|
+
*/
|
|
73
|
+
export declare class BrokerizeTimeoutError extends BrokerizeError {
|
|
74
|
+
constructor(body: ErrorResponse);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create the error for a failed (status >= 400) API response. If the body is not a valid `ErrorResponse`
|
|
78
|
+
* (e.g. an HTML error page from a load balancer), a generic error body is used instead of failing with a
|
|
79
|
+
* JSON parse error.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createErrorFromResponse(response: Response): Promise<BrokerizeError>;
|
package/dist/cjs/errors.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BrokerizeError = exports.TradingError = void 0;
|
|
3
|
+
exports.BrokerizeTimeoutError = exports.BrokerizeError = exports.TradingError = void 0;
|
|
4
|
+
exports.createErrorFromResponse = createErrorFromResponse;
|
|
4
5
|
class TradingError extends Error {
|
|
5
6
|
constructor({ msg, code, brokerCode, brokerError, msgBrokerName, httpStatusCode, hint, }) {
|
|
6
7
|
super(msg);
|
|
@@ -28,3 +29,49 @@ class BrokerizeError extends Error {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
exports.BrokerizeError = BrokerizeError;
|
|
32
|
+
/**
|
|
33
|
+
* Thrown if a request to the brokerize API timed out (HTTP status 504). This is typically sent by
|
|
34
|
+
* a load balancer or gateway in front of the API, so the response body usually is not a regular
|
|
35
|
+
* `ErrorResponse`.
|
|
36
|
+
*/
|
|
37
|
+
class BrokerizeTimeoutError extends BrokerizeError {
|
|
38
|
+
constructor(body) {
|
|
39
|
+
super(504, body);
|
|
40
|
+
this.name = "BrokerizeTimeoutError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.BrokerizeTimeoutError = BrokerizeTimeoutError;
|
|
44
|
+
function isErrorResponse(x) {
|
|
45
|
+
return (!!x &&
|
|
46
|
+
typeof x === "object" &&
|
|
47
|
+
typeof x.msg === "string" &&
|
|
48
|
+
typeof x.code === "string");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create the error for a failed (status >= 400) API response. If the body is not a valid `ErrorResponse`
|
|
52
|
+
* (e.g. an HTML error page from a load balancer), a generic error body is used instead of failing with a
|
|
53
|
+
* JSON parse error.
|
|
54
|
+
*/
|
|
55
|
+
async function createErrorFromResponse(response) {
|
|
56
|
+
const statusCode = response.status;
|
|
57
|
+
let body;
|
|
58
|
+
try {
|
|
59
|
+
const parsed = JSON.parse(await response.text());
|
|
60
|
+
if (isErrorResponse(parsed)) {
|
|
61
|
+
body = parsed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (_a) {
|
|
65
|
+
/* not JSON, use the fallback below */
|
|
66
|
+
}
|
|
67
|
+
if (statusCode == 504) {
|
|
68
|
+
return new BrokerizeTimeoutError(body || {
|
|
69
|
+
msg: "The request timed out. Please try again.",
|
|
70
|
+
code: "TIMEOUT",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return new BrokerizeError(statusCode, body || {
|
|
74
|
+
msg: "The request failed with status " + statusCode + ".",
|
|
75
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
76
|
+
});
|
|
77
|
+
}
|
package/dist/cjs/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/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Brokerize = exports.BrokerizeError = exports.Utils = exports.WebSocketTypes = exports.Models = exports.AuthorizedApiContext = void 0;
|
|
36
|
+
exports.Brokerize = exports.BrokerizeTimeoutError = exports.BrokerizeError = exports.Utils = exports.WebSocketTypes = exports.Models = exports.AuthorizedApiContext = void 0;
|
|
37
37
|
/* Import/Export the DOM parts we rely on. Those are partial copies from the official TypeScript DOM library definitions (https://github.com/microsoft/TypeScript/blob/master/lib/lib.dom.d.ts),
|
|
38
38
|
but reduced to the parts actually used by bg-trading. */
|
|
39
39
|
const apiCtx_1 = require("./apiCtx");
|
|
@@ -41,6 +41,7 @@ const authorizedApiContext_1 = require("./authorizedApiContext");
|
|
|
41
41
|
Object.defineProperty(exports, "AuthorizedApiContext", { enumerable: true, get: function () { return authorizedApiContext_1.AuthorizedApiContext; } });
|
|
42
42
|
const errors_1 = require("./errors");
|
|
43
43
|
Object.defineProperty(exports, "BrokerizeError", { enumerable: true, get: function () { return errors_1.BrokerizeError; } });
|
|
44
|
+
Object.defineProperty(exports, "BrokerizeTimeoutError", { enumerable: true, get: function () { return errors_1.BrokerizeTimeoutError; } });
|
|
44
45
|
const openApiClient = __importStar(require("./swagger"));
|
|
45
46
|
const Models = __importStar(require("./modelExports"));
|
|
46
47
|
exports.Models = Models;
|
|
@@ -78,9 +79,7 @@ class Brokerize {
|
|
|
78
79
|
const postMiddleware = async (r) => {
|
|
79
80
|
const statusCode = r.response.status;
|
|
80
81
|
if (statusCode >= 400) {
|
|
81
|
-
|
|
82
|
-
const err = new errors_1.BrokerizeError(statusCode, decJson);
|
|
83
|
-
throw err;
|
|
82
|
+
throw await (0, errors_1.createErrorFromResponse)(r.response);
|
|
84
83
|
}
|
|
85
84
|
};
|
|
86
85
|
this._userApi = new openApiClient.UserApi((0, apiCtx_1.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";
|
package/dist/cjs/modelExports.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OrderIntent = exports.TrailingDistanceModeEnum = exports.SessionSyncInfoStatus = exports.PortfolioSyncInfoStatus = exports.OrderValidityType = exports.OrderStatus = exports.OrderModel = exports.OrderExtension = exports.LoginResponseState = exports.GenericTableRowValueType = exports.GenericTableRowValueLinkValueType = exports.GenericTableRowType = exports.EnableSessionTanParamsKind = exports.Direction = exports.DecoupledOperationState = exports.CashQuotation = exports.CancelOrderParamsMode = exports.BrokerEnvFilterType = exports.AuthMethodFlow = void 0;
|
|
4
|
+
exports.TradeWarningReason = exports.OrderIntent = exports.TrailingDistanceModeEnum = exports.SessionSyncInfoStatus = exports.PrepareOAuthRedirectParamsAppearanceEnum = exports.PortfolioSyncInfoStatus = exports.OrderValidityType = exports.OrderStatus = exports.OrderModel = exports.OrderExtension = exports.LoginResponseState = exports.GenericTableRowValueType = exports.GenericTableRowValueLinkValueType = exports.GenericTableRowType = exports.EnableSessionTanParamsKind = exports.Direction = exports.DecoupledOperationState = exports.CashQuotation = exports.CancelOrderParamsMode = exports.BrokerEnvFilterType = exports.AuthMethodFlow = void 0;
|
|
5
5
|
var AuthMethodFlow_1 = require("./swagger/models/AuthMethodFlow");
|
|
6
6
|
Object.defineProperty(exports, "AuthMethodFlow", { enumerable: true, get: function () { return AuthMethodFlow_1.AuthMethodFlow; } });
|
|
7
7
|
var BrokerEnvFilterType_1 = require("./swagger/models/BrokerEnvFilterType");
|
|
@@ -34,9 +34,13 @@ var OrderValidityType_1 = require("./swagger/models/OrderValidityType");
|
|
|
34
34
|
Object.defineProperty(exports, "OrderValidityType", { enumerable: true, get: function () { return OrderValidityType_1.OrderValidityType; } });
|
|
35
35
|
var PortfolioSyncInfoStatus_1 = require("./swagger/models/PortfolioSyncInfoStatus");
|
|
36
36
|
Object.defineProperty(exports, "PortfolioSyncInfoStatus", { enumerable: true, get: function () { return PortfolioSyncInfoStatus_1.PortfolioSyncInfoStatus; } });
|
|
37
|
+
var PrepareOAuthRedirectParams_1 = require("./swagger/models/PrepareOAuthRedirectParams");
|
|
38
|
+
Object.defineProperty(exports, "PrepareOAuthRedirectParamsAppearanceEnum", { enumerable: true, get: function () { return PrepareOAuthRedirectParams_1.PrepareOAuthRedirectParamsAppearanceEnum; } });
|
|
37
39
|
var SessionSyncInfoStatus_1 = require("./swagger/models/SessionSyncInfoStatus");
|
|
38
40
|
Object.defineProperty(exports, "SessionSyncInfoStatus", { enumerable: true, get: function () { return SessionSyncInfoStatus_1.SessionSyncInfoStatus; } });
|
|
39
41
|
var TrailingDistance_1 = require("./swagger/models/TrailingDistance");
|
|
40
42
|
Object.defineProperty(exports, "TrailingDistanceModeEnum", { enumerable: true, get: function () { return TrailingDistance_1.TrailingDistanceModeEnum; } });
|
|
41
43
|
var OrderIntent_1 = require("./swagger/models/OrderIntent");
|
|
42
44
|
Object.defineProperty(exports, "OrderIntent", { enumerable: true, get: function () { return OrderIntent_1.OrderIntent; } });
|
|
45
|
+
var TradeWarningReason_1 = require("./swagger/models/TradeWarningReason");
|
|
46
|
+
Object.defineProperty(exports, "TradeWarningReason", { enumerable: true, get: function () { return TradeWarningReason_1.TradeWarningReason; } });
|
|
@@ -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;
|
|
@@ -19,6 +19,7 @@ exports.BrokerClientCfgToJSON = BrokerClientCfgToJSON;
|
|
|
19
19
|
const runtime_1 = require("../runtime");
|
|
20
20
|
const BitpandaClientCfg_1 = require("./BitpandaClientCfg");
|
|
21
21
|
const CoinbaseClientCfg_1 = require("./CoinbaseClientCfg");
|
|
22
|
+
const SmartbrokerClientCfg_1 = require("./SmartbrokerClientCfg");
|
|
22
23
|
function BrokerClientCfgFromJSON(json) {
|
|
23
24
|
return BrokerClientCfgFromJSONTyped(json, false);
|
|
24
25
|
}
|
|
@@ -33,6 +34,9 @@ function BrokerClientCfgFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
33
34
|
coinbase: !(0, runtime_1.exists)(json, "coinbase")
|
|
34
35
|
? undefined
|
|
35
36
|
: (0, CoinbaseClientCfg_1.CoinbaseClientCfgFromJSON)(json["coinbase"]),
|
|
37
|
+
smartbroker: !(0, runtime_1.exists)(json, "smartbroker")
|
|
38
|
+
? undefined
|
|
39
|
+
: (0, SmartbrokerClientCfg_1.SmartbrokerClientCfgFromJSON)(json["smartbroker"]),
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
function BrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
|
|
@@ -45,6 +49,7 @@ function BrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
|
|
|
45
49
|
return {
|
|
46
50
|
bitpanda: (0, BitpandaClientCfg_1.BitpandaClientCfgToJSON)(value.bitpanda),
|
|
47
51
|
coinbase: (0, CoinbaseClientCfg_1.CoinbaseClientCfgToJSON)(value.coinbase),
|
|
52
|
+
smartbroker: (0, SmartbrokerClientCfg_1.SmartbrokerClientCfgToJSON)(value.smartbroker),
|
|
48
53
|
};
|
|
49
54
|
}
|
|
50
55
|
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}
|
|
@@ -38,6 +38,7 @@ function BrokerMetaFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
38
38
|
loginForm: !(0, runtime_1.exists)(json, "loginForm")
|
|
39
39
|
? undefined
|
|
40
40
|
: (0, BrokerLoginForm_1.BrokerLoginFormFromJSON)(json["loginForm"]),
|
|
41
|
+
supportedExchangeIds: json["supportedExchangeIds"],
|
|
41
42
|
supportsOAuthLogin: !(0, runtime_1.exists)(json, "supportsOAuthLogin")
|
|
42
43
|
? undefined
|
|
43
44
|
: json["supportsOAuthLogin"],
|
|
@@ -58,6 +59,7 @@ function BrokerMetaToJSONRecursive(value, ignoreParent = false) {
|
|
|
58
59
|
features: (0, BrokerMetaFeatures_1.BrokerMetaFeaturesToJSON)(value.features),
|
|
59
60
|
images: (0, BrokerMetaImages_1.BrokerMetaImagesToJSON)(value.images),
|
|
60
61
|
loginForm: (0, BrokerLoginForm_1.BrokerLoginFormToJSON)(value.loginForm),
|
|
62
|
+
supportedExchangeIds: value.supportedExchangeIds,
|
|
61
63
|
supportsOAuthLogin: value.supportsOAuthLogin,
|
|
62
64
|
};
|
|
63
65
|
}
|
|
@@ -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;
|
|
@@ -25,6 +25,7 @@ exports.ClientConfigUpdateOAuthLoginFormRedirectStyleEnum = {
|
|
|
25
25
|
Meta: "meta",
|
|
26
26
|
Js: "js",
|
|
27
27
|
Link: "link",
|
|
28
|
+
Http: "http",
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
* @export
|
|
@@ -33,6 +34,7 @@ exports.ClientConfigUpdateOAuthLoginFormRedirectStyleBitpandaEnum = {
|
|
|
33
34
|
Meta: "meta",
|
|
34
35
|
Js: "js",
|
|
35
36
|
Link: "link",
|
|
37
|
+
Http: "http",
|
|
36
38
|
};
|
|
37
39
|
function ClientConfigUpdateOAuthLoginFormFromJSON(json) {
|
|
38
40
|
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;
|
|
@@ -25,6 +25,7 @@ exports.OAuthLoginFormConfigRedirectStyleEnum = {
|
|
|
25
25
|
Meta: "meta",
|
|
26
26
|
Js: "js",
|
|
27
27
|
Link: "link",
|
|
28
|
+
Http: "http",
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
* @export
|
|
@@ -33,6 +34,7 @@ exports.OAuthLoginFormConfigRedirectStyleBitpandaEnum = {
|
|
|
33
34
|
Meta: "meta",
|
|
34
35
|
Js: "js",
|
|
35
36
|
Link: "link",
|
|
37
|
+
Http: "http",
|
|
36
38
|
};
|
|
37
39
|
function OAuthLoginFormConfigFromJSON(json) {
|
|
38
40
|
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
|
|
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;
|
|
@@ -12,10 +12,19 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PrepareOAuthRedirectParamsAppearanceEnum = void 0;
|
|
15
16
|
exports.PrepareOAuthRedirectParamsFromJSON = PrepareOAuthRedirectParamsFromJSON;
|
|
16
17
|
exports.PrepareOAuthRedirectParamsFromJSONTyped = PrepareOAuthRedirectParamsFromJSONTyped;
|
|
17
18
|
exports.PrepareOAuthRedirectParamsToJSONRecursive = PrepareOAuthRedirectParamsToJSONRecursive;
|
|
18
19
|
exports.PrepareOAuthRedirectParamsToJSON = PrepareOAuthRedirectParamsToJSON;
|
|
20
|
+
const runtime_1 = require("../runtime");
|
|
21
|
+
/**
|
|
22
|
+
* @export
|
|
23
|
+
*/
|
|
24
|
+
exports.PrepareOAuthRedirectParamsAppearanceEnum = {
|
|
25
|
+
Light: "light",
|
|
26
|
+
Dark: "dark",
|
|
27
|
+
};
|
|
19
28
|
function PrepareOAuthRedirectParamsFromJSON(json) {
|
|
20
29
|
return PrepareOAuthRedirectParamsFromJSONTyped(json, false);
|
|
21
30
|
}
|
|
@@ -24,6 +33,7 @@ function PrepareOAuthRedirectParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
24
33
|
return json;
|
|
25
34
|
}
|
|
26
35
|
return {
|
|
36
|
+
appearance: !(0, runtime_1.exists)(json, "appearance") ? undefined : json["appearance"],
|
|
27
37
|
brokerName: json["brokerName"],
|
|
28
38
|
env: json["env"],
|
|
29
39
|
returnToUrl: json["returnToUrl"],
|
|
@@ -37,6 +47,7 @@ function PrepareOAuthRedirectParamsToJSONRecursive(value, ignoreParent = false)
|
|
|
37
47
|
return null;
|
|
38
48
|
}
|
|
39
49
|
return {
|
|
50
|
+
appearance: value.appearance,
|
|
40
51
|
brokerName: value.brokerName,
|
|
41
52
|
env: value.env,
|
|
42
53
|
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,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* brokerize
|
|
6
|
+
* The brokerize API allows clients to implement multi-brokerage with a unified interface. For more information, visit brokerize.com
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SmartbrokerClientCfgFromJSON = SmartbrokerClientCfgFromJSON;
|
|
16
|
+
exports.SmartbrokerClientCfgFromJSONTyped = SmartbrokerClientCfgFromJSONTyped;
|
|
17
|
+
exports.SmartbrokerClientCfgToJSONRecursive = SmartbrokerClientCfgToJSONRecursive;
|
|
18
|
+
exports.SmartbrokerClientCfgToJSON = SmartbrokerClientCfgToJSON;
|
|
19
|
+
const runtime_1 = require("../runtime");
|
|
20
|
+
function SmartbrokerClientCfgFromJSON(json) {
|
|
21
|
+
return SmartbrokerClientCfgFromJSONTyped(json, false);
|
|
22
|
+
}
|
|
23
|
+
function SmartbrokerClientCfgFromJSONTyped(json, ignoreDiscriminator) {
|
|
24
|
+
if (json === undefined || json === null) {
|
|
25
|
+
return json;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
clientIdProd: !(0, runtime_1.exists)(json, "clientIdProd")
|
|
29
|
+
? undefined
|
|
30
|
+
: json["clientIdProd"],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function SmartbrokerClientCfgToJSONRecursive(value, ignoreParent = false) {
|
|
34
|
+
if (value === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (value === null) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
clientIdProd: value.clientIdProd,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function SmartbrokerClientCfgToJSON(value) {
|
|
45
|
+
return SmartbrokerClientCfgToJSONRecursive(value, false);
|
|
46
|
+
}
|
|
@@ -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}
|
|
@@ -29,6 +29,9 @@ function SummarizedTradeFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
29
29
|
return {
|
|
30
30
|
closeAvgQuotation: (0, Amount_1.AmountFromJSON)(json["closeAvgQuotation"]),
|
|
31
31
|
closeDateTime: new Date(json["closeDateTime"]),
|
|
32
|
+
closedByKnockOut: !(0, runtime_1.exists)(json, "closedByKnockOut")
|
|
33
|
+
? undefined
|
|
34
|
+
: json["closedByKnockOut"],
|
|
32
35
|
details: json["details"],
|
|
33
36
|
fees: !(0, runtime_1.exists)(json, "fees") ? undefined : (0, Amount_1.AmountFromJSON)(json["fees"]),
|
|
34
37
|
id: json["id"],
|
|
@@ -63,6 +66,7 @@ function SummarizedTradeToJSONRecursive(value, ignoreParent = false) {
|
|
|
63
66
|
return {
|
|
64
67
|
closeAvgQuotation: (0, Amount_1.AmountToJSON)(value.closeAvgQuotation),
|
|
65
68
|
closeDateTime: value.closeDateTime.toISOString(),
|
|
69
|
+
closedByKnockOut: value.closedByKnockOut,
|
|
66
70
|
details: value.details,
|
|
67
71
|
fees: (0, Amount_1.AmountToJSON)(value.fees),
|
|
68
72
|
id: value.id,
|