@brokerize/client 1.11.0 → 1.12.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/README.md +45 -0
- package/dist/apiCtx.d.ts +10 -2
- package/dist/apiCtx.js +4 -4
- package/dist/authorizedApiContext.d.ts +5 -0
- package/dist/authorizedApiContext.js +11 -2
- package/dist/cjs/apiCtx.d.ts +10 -2
- package/dist/cjs/apiCtx.js +4 -4
- package/dist/cjs/authorizedApiContext.d.ts +5 -0
- package/dist/cjs/authorizedApiContext.js +10 -1
- package/dist/cjs/errors.d.ts +60 -0
- package/dist/cjs/errors.js +48 -1
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/modelExports.d.ts +2 -0
- package/dist/cjs/modelExports.js +3 -1
- package/dist/cjs/swagger/models/PortfolioOrderDetailsSyncInfo.d.ts +60 -0
- package/dist/cjs/swagger/models/PortfolioOrderDetailsSyncInfo.js +51 -0
- package/dist/cjs/swagger/models/PortfolioOrderDetailsSyncInfoStatus.d.ts +22 -0
- package/dist/cjs/swagger/models/PortfolioOrderDetailsSyncInfoStatus.js +35 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoComplete.d.ts +7 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoComplete.js +6 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoCompleteSpecifics.d.ts +7 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoCompleteSpecifics.js +5 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoIncomplete.d.ts +7 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoIncomplete.js +6 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoIncompleteSpecifics.d.ts +7 -0
- package/dist/cjs/swagger/models/PortfolioSyncInfoIncompleteSpecifics.js +5 -0
- package/dist/cjs/swagger/models/TradeWarningReason.d.ts +1 -0
- package/dist/cjs/swagger/models/TradeWarningReason.js +1 -0
- package/dist/cjs/swagger/models/index.d.ts +2 -0
- package/dist/cjs/swagger/models/index.js +2 -0
- package/dist/cjs/websocketClient.d.ts +109 -2
- package/dist/cjs/websocketClient.js +416 -74
- package/dist/cjs/websocketTypes.d.ts +10 -0
- package/dist/client.d.ts +247 -46
- package/dist/errors.d.ts +60 -0
- package/dist/errors.js +44 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/modelExports.d.ts +2 -0
- package/dist/modelExports.js +1 -0
- package/dist/swagger/models/PortfolioOrderDetailsSyncInfo.d.ts +60 -0
- package/dist/swagger/models/PortfolioOrderDetailsSyncInfo.js +45 -0
- package/dist/swagger/models/PortfolioOrderDetailsSyncInfoStatus.d.ts +22 -0
- package/dist/swagger/models/PortfolioOrderDetailsSyncInfoStatus.js +29 -0
- package/dist/swagger/models/PortfolioSyncInfoComplete.d.ts +7 -0
- package/dist/swagger/models/PortfolioSyncInfoComplete.js +6 -0
- package/dist/swagger/models/PortfolioSyncInfoCompleteSpecifics.d.ts +7 -0
- package/dist/swagger/models/PortfolioSyncInfoCompleteSpecifics.js +5 -0
- package/dist/swagger/models/PortfolioSyncInfoIncomplete.d.ts +7 -0
- package/dist/swagger/models/PortfolioSyncInfoIncomplete.js +6 -0
- package/dist/swagger/models/PortfolioSyncInfoIncompleteSpecifics.d.ts +7 -0
- package/dist/swagger/models/PortfolioSyncInfoIncompleteSpecifics.js +5 -0
- package/dist/swagger/models/TradeWarningReason.d.ts +1 -0
- package/dist/swagger/models/TradeWarningReason.js +1 -0
- package/dist/swagger/models/index.d.ts +2 -0
- package/dist/swagger/models/index.js +2 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/websocketClient.d.ts +109 -2
- package/dist/websocketClient.js +416 -74
- package/dist/websocketTypes.d.ts +10 -0
- package/package.json +10 -9
|
@@ -0,0 +1,60 @@
|
|
|
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 { PortfolioOrderDetailsSyncInfoStatus } from "./PortfolioOrderDetailsSyncInfoStatus";
|
|
12
|
+
/**
|
|
13
|
+
* Whether the *details* of the synced orders are already known — the executions, and with them the
|
|
14
|
+
* execution prices and the fees.
|
|
15
|
+
*
|
|
16
|
+
* This is a second, independent axis next to the sync status: a portfolio counts as `COMPLETE` as
|
|
17
|
+
* soon as every order has been loaded, but some brokers (flatex) report an order's executions only
|
|
18
|
+
* when that single order is fetched individually, which happens during the sync for recent orders
|
|
19
|
+
* only. The remaining ones are fetched in the background afterwards.
|
|
20
|
+
*
|
|
21
|
+
* It matters because every evaluation that reconstructs the past — the trade list, the trade
|
|
22
|
+
* statistics, the value history — is built from executions alone. An order whose details are still
|
|
23
|
+
* missing contributes nothing at all to them.
|
|
24
|
+
*
|
|
25
|
+
* Not reported on every endpoint; absent means "no statement", not "complete".
|
|
26
|
+
* @export
|
|
27
|
+
* @interface PortfolioOrderDetailsSyncInfo
|
|
28
|
+
*/
|
|
29
|
+
export interface PortfolioOrderDetailsSyncInfo {
|
|
30
|
+
/**
|
|
31
|
+
* Set while `status` is `PENDING`, absent once it is `COMPLETE`.
|
|
32
|
+
*
|
|
33
|
+
* Evaluations are complete for everything that happened after this point in time; before it,
|
|
34
|
+
* executions may still be missing. It is the timestamp of the newest order whose details are
|
|
35
|
+
* still outstanding — and it is that order, not the oldest one, because the reconstruction is
|
|
36
|
+
* anchored at the current holdings and works backwards: a gap only affects what lies before it.
|
|
37
|
+
*
|
|
38
|
+
* The boundary moves backwards as the background fetch works through the backlog, newest first.
|
|
39
|
+
* It is not a progress bar for the *amount* that is still missing: details fetched out of order
|
|
40
|
+
* (a user opening an old order in the app fetches it right away) close a gap behind the
|
|
41
|
+
* boundary and leave it where it is.
|
|
42
|
+
*
|
|
43
|
+
* Caveat: for an order whose details are missing, the broker has usually only told us when it
|
|
44
|
+
* was *created*, not when it executed — an order that executed considerably later than it was
|
|
45
|
+
* created can therefore sit slightly after this boundary.
|
|
46
|
+
* @type {Date}
|
|
47
|
+
* @memberof PortfolioOrderDetailsSyncInfo
|
|
48
|
+
*/
|
|
49
|
+
completeFrom?: Date;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @type {PortfolioOrderDetailsSyncInfoStatus}
|
|
53
|
+
* @memberof PortfolioOrderDetailsSyncInfo
|
|
54
|
+
*/
|
|
55
|
+
status: PortfolioOrderDetailsSyncInfoStatus;
|
|
56
|
+
}
|
|
57
|
+
export declare function PortfolioOrderDetailsSyncInfoFromJSON(json: any): PortfolioOrderDetailsSyncInfo;
|
|
58
|
+
export declare function PortfolioOrderDetailsSyncInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): PortfolioOrderDetailsSyncInfo;
|
|
59
|
+
export declare function PortfolioOrderDetailsSyncInfoToJSONRecursive(value?: PortfolioOrderDetailsSyncInfo | null, ignoreParent?: boolean): any;
|
|
60
|
+
export declare function PortfolioOrderDetailsSyncInfoToJSON(value?: PortfolioOrderDetailsSyncInfo | null): any;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
import { PortfolioOrderDetailsSyncInfoStatusFromJSON, PortfolioOrderDetailsSyncInfoStatusToJSON, } from "./PortfolioOrderDetailsSyncInfoStatus.js";
|
|
15
|
+
export function PortfolioOrderDetailsSyncInfoFromJSON(json) {
|
|
16
|
+
return PortfolioOrderDetailsSyncInfoFromJSONTyped(json, false);
|
|
17
|
+
}
|
|
18
|
+
export function PortfolioOrderDetailsSyncInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
19
|
+
if (json === undefined || json === null) {
|
|
20
|
+
return json;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
completeFrom: !exists(json, "completeFrom")
|
|
24
|
+
? undefined
|
|
25
|
+
: new Date(json["completeFrom"]),
|
|
26
|
+
status: PortfolioOrderDetailsSyncInfoStatusFromJSON(json["status"]),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function PortfolioOrderDetailsSyncInfoToJSONRecursive(value, ignoreParent = false) {
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (value === null) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
completeFrom: value.completeFrom === undefined
|
|
38
|
+
? undefined
|
|
39
|
+
: value.completeFrom.toISOString(),
|
|
40
|
+
status: PortfolioOrderDetailsSyncInfoStatusToJSON(value.status),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function PortfolioOrderDetailsSyncInfoToJSON(value) {
|
|
44
|
+
return PortfolioOrderDetailsSyncInfoToJSONRecursive(value, false);
|
|
45
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
*/
|
|
15
|
+
export declare const PortfolioOrderDetailsSyncInfoStatus: {
|
|
16
|
+
readonly Complete: "COMPLETE";
|
|
17
|
+
readonly Pending: "PENDING";
|
|
18
|
+
};
|
|
19
|
+
export type PortfolioOrderDetailsSyncInfoStatus = (typeof PortfolioOrderDetailsSyncInfoStatus)[keyof typeof PortfolioOrderDetailsSyncInfoStatus];
|
|
20
|
+
export declare function PortfolioOrderDetailsSyncInfoStatusFromJSON(json: any): PortfolioOrderDetailsSyncInfoStatus;
|
|
21
|
+
export declare function PortfolioOrderDetailsSyncInfoStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): PortfolioOrderDetailsSyncInfoStatus;
|
|
22
|
+
export declare function PortfolioOrderDetailsSyncInfoStatusToJSON(value?: PortfolioOrderDetailsSyncInfoStatus | null): any;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
*/
|
|
17
|
+
export const PortfolioOrderDetailsSyncInfoStatus = {
|
|
18
|
+
Complete: "COMPLETE",
|
|
19
|
+
Pending: "PENDING",
|
|
20
|
+
};
|
|
21
|
+
export function PortfolioOrderDetailsSyncInfoStatusFromJSON(json) {
|
|
22
|
+
return PortfolioOrderDetailsSyncInfoStatusFromJSONTyped(json, false);
|
|
23
|
+
}
|
|
24
|
+
export function PortfolioOrderDetailsSyncInfoStatusFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
return json;
|
|
26
|
+
}
|
|
27
|
+
export function PortfolioOrderDetailsSyncInfoStatusToJSON(value) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* https://openapi-generator.tech
|
|
9
9
|
* Do not edit the class manually.
|
|
10
10
|
*/
|
|
11
|
+
import { PortfolioOrderDetailsSyncInfo } from "./PortfolioOrderDetailsSyncInfo";
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
13
14
|
* @export
|
|
@@ -26,6 +27,12 @@ export interface PortfolioSyncInfoComplete {
|
|
|
26
27
|
* @memberof PortfolioSyncInfoComplete
|
|
27
28
|
*/
|
|
28
29
|
lastSync: Date;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {PortfolioOrderDetailsSyncInfo}
|
|
33
|
+
* @memberof PortfolioSyncInfoComplete
|
|
34
|
+
*/
|
|
35
|
+
orderDetails?: PortfolioOrderDetailsSyncInfo;
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* @export
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* https://openapi-generator.tech
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
|
+
import { exists } from "../runtime.js";
|
|
14
|
+
import { PortfolioOrderDetailsSyncInfoFromJSON, PortfolioOrderDetailsSyncInfoToJSON, } from "./PortfolioOrderDetailsSyncInfo.js";
|
|
13
15
|
/**
|
|
14
16
|
* @export
|
|
15
17
|
*/
|
|
@@ -26,6 +28,9 @@ export function PortfolioSyncInfoCompleteFromJSONTyped(json, ignoreDiscriminator
|
|
|
26
28
|
return {
|
|
27
29
|
status: json["status"],
|
|
28
30
|
lastSync: new Date(json["lastSync"]),
|
|
31
|
+
orderDetails: !exists(json, "orderDetails")
|
|
32
|
+
? undefined
|
|
33
|
+
: PortfolioOrderDetailsSyncInfoFromJSON(json["orderDetails"]),
|
|
29
34
|
};
|
|
30
35
|
}
|
|
31
36
|
export function PortfolioSyncInfoCompleteToJSONRecursive(value, ignoreParent = false) {
|
|
@@ -38,6 +43,7 @@ export function PortfolioSyncInfoCompleteToJSONRecursive(value, ignoreParent = f
|
|
|
38
43
|
return {
|
|
39
44
|
status: value.status,
|
|
40
45
|
lastSync: value.lastSync.toISOString(),
|
|
46
|
+
orderDetails: PortfolioOrderDetailsSyncInfoToJSON(value.orderDetails),
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
49
|
export function PortfolioSyncInfoCompleteToJSON(value) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* https://openapi-generator.tech
|
|
9
9
|
* Do not edit the class manually.
|
|
10
10
|
*/
|
|
11
|
+
import { PortfolioOrderDetailsSyncInfo } from "./PortfolioOrderDetailsSyncInfo";
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
13
14
|
* @export
|
|
@@ -20,6 +21,12 @@ export interface PortfolioSyncInfoCompleteSpecifics {
|
|
|
20
21
|
* @memberof PortfolioSyncInfoCompleteSpecifics
|
|
21
22
|
*/
|
|
22
23
|
lastSync?: Date;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {PortfolioOrderDetailsSyncInfo}
|
|
27
|
+
* @memberof PortfolioSyncInfoCompleteSpecifics
|
|
28
|
+
*/
|
|
29
|
+
orderDetails?: PortfolioOrderDetailsSyncInfo;
|
|
23
30
|
}
|
|
24
31
|
export declare function PortfolioSyncInfoCompleteSpecificsFromJSON(json: any): PortfolioSyncInfoCompleteSpecifics;
|
|
25
32
|
export declare function PortfolioSyncInfoCompleteSpecificsFromJSONTyped(json: any, ignoreDiscriminator: boolean): PortfolioSyncInfoCompleteSpecifics;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
13
|
import { exists } from "../runtime.js";
|
|
14
|
+
import { PortfolioOrderDetailsSyncInfoFromJSON, PortfolioOrderDetailsSyncInfoToJSON, } from "./PortfolioOrderDetailsSyncInfo.js";
|
|
14
15
|
export function PortfolioSyncInfoCompleteSpecificsFromJSON(json) {
|
|
15
16
|
return PortfolioSyncInfoCompleteSpecificsFromJSONTyped(json, false);
|
|
16
17
|
}
|
|
@@ -22,6 +23,9 @@ export function PortfolioSyncInfoCompleteSpecificsFromJSONTyped(json, ignoreDisc
|
|
|
22
23
|
lastSync: !exists(json, "lastSync")
|
|
23
24
|
? undefined
|
|
24
25
|
: new Date(json["lastSync"]),
|
|
26
|
+
orderDetails: !exists(json, "orderDetails")
|
|
27
|
+
? undefined
|
|
28
|
+
: PortfolioOrderDetailsSyncInfoFromJSON(json["orderDetails"]),
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
export function PortfolioSyncInfoCompleteSpecificsToJSONRecursive(value, ignoreParent = false) {
|
|
@@ -33,6 +37,7 @@ export function PortfolioSyncInfoCompleteSpecificsToJSONRecursive(value, ignoreP
|
|
|
33
37
|
}
|
|
34
38
|
return {
|
|
35
39
|
lastSync: value.lastSync === undefined ? undefined : value.lastSync.toISOString(),
|
|
40
|
+
orderDetails: PortfolioOrderDetailsSyncInfoToJSON(value.orderDetails),
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
export function PortfolioSyncInfoCompleteSpecificsToJSON(value) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* https://openapi-generator.tech
|
|
9
9
|
* Do not edit the class manually.
|
|
10
10
|
*/
|
|
11
|
+
import { PortfolioOrderDetailsSyncInfo } from "./PortfolioOrderDetailsSyncInfo";
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
13
14
|
* @export
|
|
@@ -26,6 +27,12 @@ export interface PortfolioSyncInfoIncomplete {
|
|
|
26
27
|
* @memberof PortfolioSyncInfoIncomplete
|
|
27
28
|
*/
|
|
28
29
|
lastSync: Date;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {PortfolioOrderDetailsSyncInfo}
|
|
33
|
+
* @memberof PortfolioSyncInfoIncomplete
|
|
34
|
+
*/
|
|
35
|
+
orderDetails?: PortfolioOrderDetailsSyncInfo;
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* @export
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* https://openapi-generator.tech
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
|
+
import { exists } from "../runtime.js";
|
|
14
|
+
import { PortfolioOrderDetailsSyncInfoFromJSON, PortfolioOrderDetailsSyncInfoToJSON, } from "./PortfolioOrderDetailsSyncInfo.js";
|
|
13
15
|
/**
|
|
14
16
|
* @export
|
|
15
17
|
*/
|
|
@@ -26,6 +28,9 @@ export function PortfolioSyncInfoIncompleteFromJSONTyped(json, ignoreDiscriminat
|
|
|
26
28
|
return {
|
|
27
29
|
status: json["status"],
|
|
28
30
|
lastSync: new Date(json["lastSync"]),
|
|
31
|
+
orderDetails: !exists(json, "orderDetails")
|
|
32
|
+
? undefined
|
|
33
|
+
: PortfolioOrderDetailsSyncInfoFromJSON(json["orderDetails"]),
|
|
29
34
|
};
|
|
30
35
|
}
|
|
31
36
|
export function PortfolioSyncInfoIncompleteToJSONRecursive(value, ignoreParent = false) {
|
|
@@ -38,6 +43,7 @@ export function PortfolioSyncInfoIncompleteToJSONRecursive(value, ignoreParent =
|
|
|
38
43
|
return {
|
|
39
44
|
status: value.status,
|
|
40
45
|
lastSync: value.lastSync.toISOString(),
|
|
46
|
+
orderDetails: PortfolioOrderDetailsSyncInfoToJSON(value.orderDetails),
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
49
|
export function PortfolioSyncInfoIncompleteToJSON(value) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* https://openapi-generator.tech
|
|
9
9
|
* Do not edit the class manually.
|
|
10
10
|
*/
|
|
11
|
+
import { PortfolioOrderDetailsSyncInfo } from "./PortfolioOrderDetailsSyncInfo";
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
13
14
|
* @export
|
|
@@ -20,6 +21,12 @@ export interface PortfolioSyncInfoIncompleteSpecifics {
|
|
|
20
21
|
* @memberof PortfolioSyncInfoIncompleteSpecifics
|
|
21
22
|
*/
|
|
22
23
|
lastSync?: Date;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {PortfolioOrderDetailsSyncInfo}
|
|
27
|
+
* @memberof PortfolioSyncInfoIncompleteSpecifics
|
|
28
|
+
*/
|
|
29
|
+
orderDetails?: PortfolioOrderDetailsSyncInfo;
|
|
23
30
|
}
|
|
24
31
|
export declare function PortfolioSyncInfoIncompleteSpecificsFromJSON(json: any): PortfolioSyncInfoIncompleteSpecifics;
|
|
25
32
|
export declare function PortfolioSyncInfoIncompleteSpecificsFromJSONTyped(json: any, ignoreDiscriminator: boolean): PortfolioSyncInfoIncompleteSpecifics;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Do not edit the class manually.
|
|
12
12
|
*/
|
|
13
13
|
import { exists } from "../runtime.js";
|
|
14
|
+
import { PortfolioOrderDetailsSyncInfoFromJSON, PortfolioOrderDetailsSyncInfoToJSON, } from "./PortfolioOrderDetailsSyncInfo.js";
|
|
14
15
|
export function PortfolioSyncInfoIncompleteSpecificsFromJSON(json) {
|
|
15
16
|
return PortfolioSyncInfoIncompleteSpecificsFromJSONTyped(json, false);
|
|
16
17
|
}
|
|
@@ -22,6 +23,9 @@ export function PortfolioSyncInfoIncompleteSpecificsFromJSONTyped(json, ignoreDi
|
|
|
22
23
|
lastSync: !exists(json, "lastSync")
|
|
23
24
|
? undefined
|
|
24
25
|
: new Date(json["lastSync"]),
|
|
26
|
+
orderDetails: !exists(json, "orderDetails")
|
|
27
|
+
? undefined
|
|
28
|
+
: PortfolioOrderDetailsSyncInfoFromJSON(json["orderDetails"]),
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
export function PortfolioSyncInfoIncompleteSpecificsToJSONRecursive(value, ignoreParent = false) {
|
|
@@ -33,6 +37,7 @@ export function PortfolioSyncInfoIncompleteSpecificsToJSONRecursive(value, ignor
|
|
|
33
37
|
}
|
|
34
38
|
return {
|
|
35
39
|
lastSync: value.lastSync === undefined ? undefined : value.lastSync.toISOString(),
|
|
40
|
+
orderDetails: PortfolioOrderDetailsSyncInfoToJSON(value.orderDetails),
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
export function PortfolioSyncInfoIncompleteSpecificsToJSON(value) {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
export declare const TradeWarningReason: {
|
|
34
34
|
readonly ExecutionsWithoutTimestamp: "executionsWithoutTimestamp";
|
|
35
35
|
readonly InconsistentOrderHistory: "inconsistentOrderHistory";
|
|
36
|
+
readonly OrderDetailsIncomplete: "orderDetailsIncomplete";
|
|
36
37
|
readonly PositionNotFullyExplained: "positionNotFullyExplained";
|
|
37
38
|
readonly MissingEodPrice: "missingEodPrice";
|
|
38
39
|
readonly MissingFxRate: "missingFxRate";
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
export const TradeWarningReason = {
|
|
36
36
|
ExecutionsWithoutTimestamp: "executionsWithoutTimestamp",
|
|
37
37
|
InconsistentOrderHistory: "inconsistentOrderHistory",
|
|
38
|
+
OrderDetailsIncomplete: "orderDetailsIncomplete",
|
|
38
39
|
PositionNotFullyExplained: "positionNotFullyExplained",
|
|
39
40
|
MissingEodPrice: "missingEodPrice",
|
|
40
41
|
MissingFxRate: "missingFxRate",
|
|
@@ -183,6 +183,8 @@ export * from "./PagesConfigurationResponse";
|
|
|
183
183
|
export * from "./Portfolio";
|
|
184
184
|
export * from "./PortfolioCalendarDateRange";
|
|
185
185
|
export * from "./PortfolioCalendarItem";
|
|
186
|
+
export * from "./PortfolioOrderDetailsSyncInfo";
|
|
187
|
+
export * from "./PortfolioOrderDetailsSyncInfoStatus";
|
|
186
188
|
export * from "./PortfolioQuotes";
|
|
187
189
|
export * from "./PortfolioSyncInfo";
|
|
188
190
|
export * from "./PortfolioSyncInfoComplete";
|
|
@@ -185,6 +185,8 @@ export * from "./PagesConfigurationResponse.js";
|
|
|
185
185
|
export * from "./Portfolio.js";
|
|
186
186
|
export * from "./PortfolioCalendarDateRange.js";
|
|
187
187
|
export * from "./PortfolioCalendarItem.js";
|
|
188
|
+
export * from "./PortfolioOrderDetailsSyncInfo.js";
|
|
189
|
+
export * from "./PortfolioOrderDetailsSyncInfoStatus.js";
|
|
188
190
|
export * from "./PortfolioQuotes.js";
|
|
189
191
|
export * from "./PortfolioSyncInfo.js";
|
|
190
192
|
export * from "./PortfolioSyncInfoComplete.js";
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Auth } from "./apiCtx";
|
|
2
2
|
import { AuthorizedApiContext } from "./authorizedApiContext";
|
|
3
3
|
import { WebSocket } from "./dependencyDefinitions/webSocket";
|
|
4
|
+
import { BrokerizeWebSocketError } from "./errors";
|
|
4
5
|
import type { SubscribeDecoupledOperation, SubscribeInvalidateDetails } from "./websocketTypes";
|
|
5
6
|
export declare class BrokerizeWebSocketClientImpl implements BrokerizeWebSocketClient {
|
|
6
7
|
private _url;
|
|
@@ -18,18 +19,70 @@ export declare class BrokerizeWebSocketClientImpl implements BrokerizeWebSocketC
|
|
|
18
19
|
private _lastNonFatalError;
|
|
19
20
|
private _errorCount;
|
|
20
21
|
private _apiCtx;
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* How often the server rejected our token in a row. Every retry forces a token refresh, and
|
|
24
|
+
* only `_maxConsecutiveAuthFailures` of them in a row are fatal. Reset on every successful
|
|
25
|
+
* authentication.
|
|
26
|
+
*/
|
|
27
|
+
private _authFailureCount;
|
|
28
|
+
private _maxConsecutiveAuthFailures;
|
|
29
|
+
private _forceTokenRefresh;
|
|
30
|
+
private _destroyed;
|
|
31
|
+
private _connectionState;
|
|
32
|
+
private _connectionStateCallbacks;
|
|
33
|
+
constructor(websocketUrl: string, auth: Auth, createWebSocket: (url: string) => WebSocket, options?: BrokerizeWebSocketClientOptions);
|
|
22
34
|
private _updateReconnectInterval;
|
|
23
35
|
/**
|
|
24
36
|
* Simple backoff behavior: first retry is fast (100ms), next 9 retries 1s, after that we only reconnect every 10s.
|
|
25
37
|
* Jitter is added to avoid a thundering herd when many clients reconnect simultaneously (e.g. after a server-side disconnect).
|
|
26
38
|
* The first retry uses a wider jitter window (~1s) because that's the scenario most prone to bursts of TLS handshakes.
|
|
39
|
+
*
|
|
40
|
+
* A token that keeps being rejected is retried far more slowly (`AUTH_RETRY_INTERVAL`), because
|
|
41
|
+
* every one of those attempts refreshes the token and a rejection is not something that tends to
|
|
42
|
+
* resolve within a second.
|
|
27
43
|
*/
|
|
28
44
|
private _computeReconnectIntervalInMilliseconds;
|
|
29
45
|
private _shouldConnect;
|
|
46
|
+
/**
|
|
47
|
+
* Invoke a subscriber callback. A callback that throws must not prevent the remaining
|
|
48
|
+
* subscribers from being notified, so everything is contained here.
|
|
49
|
+
*/
|
|
50
|
+
private _invokeCallback;
|
|
30
51
|
private subscribe;
|
|
31
52
|
subscribeInvalidate(subscribe: SubscribeInvalidateDetails, callback: Callback): Subscription;
|
|
32
53
|
subscribeDecoupledOperation(subscribe: Pick<SubscribeDecoupledOperation, "sessionId" | "decoupledOperationId">, callback: Callback): Subscription;
|
|
54
|
+
/**
|
|
55
|
+
* The current connection state. See `subscribeConnectionState`.
|
|
56
|
+
*/
|
|
57
|
+
getConnectionState(): WebSocketConnectionState;
|
|
58
|
+
/**
|
|
59
|
+
* Observe the state of the underlying websocket connection. The callback is invoked immediately
|
|
60
|
+
* with the current state and afterwards on every change.
|
|
61
|
+
*
|
|
62
|
+
* This is the only place where non-terminal errors are reported: the client recovers from them
|
|
63
|
+
* on its own, so they are not passed to the subscription callbacks, which would force
|
|
64
|
+
* applications to tear down subscriptions on every connection hiccup. Use this to show that
|
|
65
|
+
* live updates are currently unavailable.
|
|
66
|
+
*/
|
|
67
|
+
subscribeConnectionState(callback: ConnectionStateCallback): Subscription;
|
|
68
|
+
/**
|
|
69
|
+
* Recover from a fatal error (see `WebSocketConnectionState`). The client drops the fatal error
|
|
70
|
+
* state and connects again, retrieving a fresh token. Existing subscriptions were already
|
|
71
|
+
* terminated when the fatal error occurred, so applications have to subscribe again.
|
|
72
|
+
*
|
|
73
|
+
* Calling this without a fatal error forces a reconnect of the current connection.
|
|
74
|
+
*/
|
|
75
|
+
reconnect(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Release all resources: close the connection, drop all subscriptions and stop the reconnect and
|
|
78
|
+
* ping timers. A destroyed client cannot be revived with `reconnect()`.
|
|
79
|
+
*
|
|
80
|
+
* This is called by `AuthorizedApiContext.destroy()` for the client it created itself. A client
|
|
81
|
+
* that was passed in from outside is owned by the application and is not destroyed with the
|
|
82
|
+
* context.
|
|
83
|
+
*/
|
|
84
|
+
destroy(): void;
|
|
85
|
+
private _setConnectionState;
|
|
33
86
|
private _startSubscription;
|
|
34
87
|
private _fillInMessagesAfterConnectionInterruption;
|
|
35
88
|
private _endSubscription;
|
|
@@ -40,13 +93,26 @@ export declare class BrokerizeWebSocketClientImpl implements BrokerizeWebSocketC
|
|
|
40
93
|
_setAuthorizedApiContext(ctx: AuthorizedApiContext): void;
|
|
41
94
|
_startOrStopDisconnectTimeout(): void;
|
|
42
95
|
private _sendWs;
|
|
96
|
+
/**
|
|
97
|
+
* Close the current socket, if any, and detach its handlers so that a late `close` event of an
|
|
98
|
+
* outdated socket cannot interfere with a connection established in the meantime.
|
|
99
|
+
*/
|
|
100
|
+
private _closeSocket;
|
|
43
101
|
private _connect;
|
|
102
|
+
private _handleMessage;
|
|
103
|
+
/**
|
|
104
|
+
* The server rejected our token. The usual cause is an id token that expired between retrieving
|
|
105
|
+
* it and the server validating it, which a fresh token fixes, so retry once before giving up on
|
|
106
|
+
* this client.
|
|
107
|
+
*/
|
|
108
|
+
private _handleAuthenticationFailure;
|
|
44
109
|
/**
|
|
45
110
|
* Error happend when trying to connect, but it may be solved by trying a reconnect later.
|
|
46
111
|
*/
|
|
47
112
|
private _handleNonFatalError;
|
|
48
113
|
/**
|
|
49
|
-
* Fatal error: this means the client is unusable from now on and must be recreated
|
|
114
|
+
* Fatal error: this means the client is unusable from now on and must be recreated or revived
|
|
115
|
+
* with `reconnect()`.
|
|
50
116
|
*/
|
|
51
117
|
private _handleFatalError;
|
|
52
118
|
/**
|
|
@@ -59,10 +125,51 @@ export declare class BrokerizeWebSocketClientImpl implements BrokerizeWebSocketC
|
|
|
59
125
|
private _resetErrorState;
|
|
60
126
|
private _findSubscriptionEntry;
|
|
61
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Optional behavior of `BrokerizeWebSocketClientImpl`. The defaults are what an application
|
|
130
|
+
* wants; this exists for the rare case that they have to be tightened.
|
|
131
|
+
*/
|
|
132
|
+
export type BrokerizeWebSocketClientOptions = {
|
|
133
|
+
/**
|
|
134
|
+
* How often in a row the server may reject our token before the client gives up and goes
|
|
135
|
+
* `fatal`. Defaults to 10, which together with the backoff spans several minutes. Mainly here so
|
|
136
|
+
* that tests do not have to wait that long.
|
|
137
|
+
*/
|
|
138
|
+
maxConsecutiveAuthFailures?: number;
|
|
139
|
+
};
|
|
62
140
|
export interface BrokerizeWebSocketClient {
|
|
63
141
|
subscribeInvalidate: (subscribe: SubscribeInvalidateDetails, callback: Callback) => Subscription;
|
|
64
142
|
subscribeDecoupledOperation: (subscribe: Pick<SubscribeDecoupledOperation, "sessionId" | "decoupledOperationId">, callback: Callback) => Subscription;
|
|
143
|
+
subscribeConnectionState: (callback: ConnectionStateCallback) => Subscription;
|
|
144
|
+
getConnectionState: () => WebSocketConnectionState;
|
|
145
|
+
reconnect: () => void;
|
|
65
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* - `closed`: not connected, because nothing is subscribed.
|
|
149
|
+
* - `connecting`: the first connection attempt is in progress.
|
|
150
|
+
* - `open`: connected and authenticated, live updates are being delivered.
|
|
151
|
+
* - `reconnecting`: the connection failed or was lost and the client is retrying. `error` holds
|
|
152
|
+
* the error that caused it. Subscriptions stay alive and receive a synthetic invalidate once
|
|
153
|
+
* the connection is back.
|
|
154
|
+
*
|
|
155
|
+
* A rejected token lands here too, so an application can show that live updates are currently
|
|
156
|
+
* unavailable - and why - while the client works on getting back in, instead of having to
|
|
157
|
+
* rebuild everything over a token that expired in flight.
|
|
158
|
+
* - `fatal`: the client gave up and is unusable. All subscriptions were terminated with `error`.
|
|
159
|
+
* This only happens after the token has been rejected over and over for several minutes, i.e.
|
|
160
|
+
* when the session is gone rather than stale. Call `reconnect()` or create a new client.
|
|
161
|
+
*/
|
|
162
|
+
export type WebSocketConnectionStatus = "closed" | "connecting" | "open" | "reconnecting" | "fatal";
|
|
163
|
+
export type WebSocketConnectionState = {
|
|
164
|
+
status: WebSocketConnectionStatus;
|
|
165
|
+
error?: BrokerizeWebSocketError;
|
|
166
|
+
};
|
|
167
|
+
export type ConnectionStateCallback = (state: WebSocketConnectionState) => void;
|
|
168
|
+
/**
|
|
169
|
+
* Callback of a subscription. `err` is always a `BrokerizeWebSocketError` with
|
|
170
|
+
* `terminal === true`: the subscription is over and will not receive any further data. Errors the
|
|
171
|
+
* client recovers from on its own are reported via `subscribeConnectionState` instead.
|
|
172
|
+
*/
|
|
66
173
|
export type Callback<T = any> = (err: any, data: T) => void;
|
|
67
174
|
export type Subscription = {
|
|
68
175
|
unsubscribe: () => void;
|