@finatic/client 0.9.3 → 0.9.5
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/index.d.ts +80 -57
- package/dist/index.js +82 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -14
package/dist/index.js
CHANGED
|
@@ -63,6 +63,13 @@ async function retryApiCall(fn, options = {}, config) {
|
|
|
63
63
|
retryOnNetworkError: config?.retryOnNetworkError ?? options.retryOnNetworkError ?? true,
|
|
64
64
|
onFailedAttempt: options.onFailedAttempt,
|
|
65
65
|
};
|
|
66
|
+
const pRetryOptions = {
|
|
67
|
+
retries: opts.maxRetries,
|
|
68
|
+
minTimeout: opts.retryDelay,
|
|
69
|
+
maxTimeout: opts.retryMaxDelay,
|
|
70
|
+
factor: opts.retryMultiplier,
|
|
71
|
+
...(opts.onFailedAttempt && { onFailedAttempt: opts.onFailedAttempt }),
|
|
72
|
+
};
|
|
66
73
|
return await pRetry(async () => {
|
|
67
74
|
try {
|
|
68
75
|
return await fn();
|
|
@@ -81,13 +88,7 @@ async function retryApiCall(fn, options = {}, config) {
|
|
|
81
88
|
// Re-throw to trigger retry
|
|
82
89
|
throw error;
|
|
83
90
|
}
|
|
84
|
-
},
|
|
85
|
-
retries: opts.maxRetries,
|
|
86
|
-
minTimeout: opts.retryDelay,
|
|
87
|
-
maxTimeout: opts.retryMaxDelay,
|
|
88
|
-
factor: opts.retryMultiplier,
|
|
89
|
-
onFailedAttempt: opts.onFailedAttempt,
|
|
90
|
-
});
|
|
91
|
+
}, pRetryOptions);
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
/**
|
|
@@ -637,7 +638,11 @@ function coerceEnumValue(input, EnumObj, enumName) {
|
|
|
637
638
|
// Direct match by value (case-insensitive)
|
|
638
639
|
const valueMatch = values.find(v => v.toLowerCase() === normalized.toLowerCase());
|
|
639
640
|
if (valueMatch) {
|
|
640
|
-
|
|
641
|
+
// Find the enum key that has this value
|
|
642
|
+
const matchingKey = Object.keys(EnumObj).find(k => EnumObj[k] === valueMatch);
|
|
643
|
+
if (matchingKey) {
|
|
644
|
+
return EnumObj[matchingKey]; // Returns enum member (e.g., BrokerDataOrderStatusEnum.Filled)
|
|
645
|
+
}
|
|
641
646
|
}
|
|
642
647
|
// Match by key name (case-insensitive)
|
|
643
648
|
const keyMatch = Object.keys(EnumObj).find(k => String(k).toLowerCase() === normalized.toLowerCase());
|
|
@@ -785,34 +790,6 @@ exports.BrokerDataOrderSideEnum = void 0;
|
|
|
785
790
|
BrokerDataOrderSideEnum["Sell"] = "sell";
|
|
786
791
|
})(exports.BrokerDataOrderSideEnum || (exports.BrokerDataOrderSideEnum = {}));
|
|
787
792
|
|
|
788
|
-
/* tslint:disable */
|
|
789
|
-
/* eslint-disable */
|
|
790
|
-
/**
|
|
791
|
-
* Finatic FastAPI Backend
|
|
792
|
-
* FinaticAPI REST API
|
|
793
|
-
*
|
|
794
|
-
* The version of the OpenAPI document: 1.0.0
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
798
|
-
* https://openapi-generator.tech
|
|
799
|
-
* Do not edit the class manually.
|
|
800
|
-
*/
|
|
801
|
-
exports.BrokerDataOrderStatusEnum = void 0;
|
|
802
|
-
(function (BrokerDataOrderStatusEnum) {
|
|
803
|
-
BrokerDataOrderStatusEnum["Submitted"] = "submitted";
|
|
804
|
-
BrokerDataOrderStatusEnum["New"] = "new";
|
|
805
|
-
BrokerDataOrderStatusEnum["PartiallyFilled"] = "partially_filled";
|
|
806
|
-
BrokerDataOrderStatusEnum["Filled"] = "filled";
|
|
807
|
-
BrokerDataOrderStatusEnum["PendingCancel"] = "pending_cancel";
|
|
808
|
-
BrokerDataOrderStatusEnum["Cancelled"] = "cancelled";
|
|
809
|
-
BrokerDataOrderStatusEnum["Rejected"] = "rejected";
|
|
810
|
-
BrokerDataOrderStatusEnum["Expired"] = "expired";
|
|
811
|
-
BrokerDataOrderStatusEnum["Created"] = "created";
|
|
812
|
-
BrokerDataOrderStatusEnum["Received"] = "received";
|
|
813
|
-
BrokerDataOrderStatusEnum["Queued"] = "queued";
|
|
814
|
-
})(exports.BrokerDataOrderStatusEnum || (exports.BrokerDataOrderStatusEnum = {}));
|
|
815
|
-
|
|
816
793
|
/* tslint:disable */
|
|
817
794
|
/* eslint-disable */
|
|
818
795
|
/**
|
|
@@ -1396,6 +1373,23 @@ class PaginatedData {
|
|
|
1396
1373
|
toLocaleString() {
|
|
1397
1374
|
return this.items.toLocaleString();
|
|
1398
1375
|
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Convert to JSON - returns just the items array for serialization.
|
|
1378
|
+
* This allows clean serialization without exposing internal methods.
|
|
1379
|
+
*
|
|
1380
|
+
* @returns The items array
|
|
1381
|
+
*
|
|
1382
|
+
* @example
|
|
1383
|
+
* ```typescript
|
|
1384
|
+
* const orders = await sdk.getOrders();
|
|
1385
|
+
* console.log(orders); // Shows full PaginatedData with methods
|
|
1386
|
+
* console.log(orders.toJSON()); // Shows just the items array
|
|
1387
|
+
* JSON.stringify(orders); // Automatically uses toJSON()
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
toJSON() {
|
|
1391
|
+
return this.items;
|
|
1392
|
+
}
|
|
1399
1393
|
/**
|
|
1400
1394
|
* Get the next page of data.
|
|
1401
1395
|
* @returns Promise<PaginatedData<T>> - The next page (not wrapped in FinaticResponse)
|
|
@@ -1878,7 +1872,7 @@ class BrokersWrapper {
|
|
|
1878
1872
|
});
|
|
1879
1873
|
try {
|
|
1880
1874
|
const response = await retryApiCall(async () => {
|
|
1881
|
-
const apiResponse = await this.api.disconnectCompanyFromBrokerApiV1BrokersDisconnectCompanyConnectionIdDelete({ connectionId: resolvedParams.connectionId }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
1875
|
+
const apiResponse = await this.api.disconnectCompanyFromBrokerApiV1BrokersDisconnectCompanyConnectionIdDelete({ connectionId: resolvedParams.connectionId ?? null }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
1882
1876
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
1883
1877
|
}, {}, this.sdkConfig);
|
|
1884
1878
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -1982,9 +1976,9 @@ class BrokersWrapper {
|
|
|
1982
1976
|
* Returns orders from connections the company has read access to.
|
|
1983
1977
|
* @param params.brokerId {string} (optional) Filter by broker ID
|
|
1984
1978
|
* @param params.connectionId {string} (optional) Filter by connection ID
|
|
1985
|
-
* @param params.accountId {string} (optional) Filter by broker provided account ID
|
|
1979
|
+
* @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
|
|
1986
1980
|
* @param params.symbol {string} (optional) Filter by symbol
|
|
1987
|
-
* @param params.orderStatus {
|
|
1981
|
+
* @param params.orderStatus {string} (optional) Filter by order status (e.g., 'filled', 'pending_new', 'cancelled')
|
|
1988
1982
|
* @param params.side {BrokerDataOrderSideEnum} (optional) Filter by order side (e.g., 'buy', 'sell')
|
|
1989
1983
|
* @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
|
|
1990
1984
|
* @param params.limit {number} (optional) Maximum number of orders to return
|
|
@@ -2030,14 +2024,17 @@ class BrokersWrapper {
|
|
|
2030
2024
|
async getOrders(params) {
|
|
2031
2025
|
// Use params object (with default empty object)
|
|
2032
2026
|
const resolvedParams = params || {};
|
|
2033
|
-
if (params?.orderStatus !== undefined) {
|
|
2034
|
-
params.orderStatus = coerceEnumValue(params.orderStatus, exports.BrokerDataOrderStatusEnum, 'orderStatus');
|
|
2035
|
-
}
|
|
2036
2027
|
if (params?.side !== undefined) {
|
|
2037
|
-
|
|
2028
|
+
const coerced = coerceEnumValue(params.side, exports.BrokerDataOrderSideEnum, 'side');
|
|
2029
|
+
if (coerced !== undefined) {
|
|
2030
|
+
params.side = coerced;
|
|
2031
|
+
}
|
|
2038
2032
|
}
|
|
2039
2033
|
if (params?.assetType !== undefined) {
|
|
2040
|
-
|
|
2034
|
+
const coerced = coerceEnumValue(params.assetType, exports.BrokerDataAssetTypeEnum, 'assetType');
|
|
2035
|
+
if (coerced !== undefined) {
|
|
2036
|
+
params.assetType = coerced;
|
|
2037
|
+
}
|
|
2041
2038
|
} // Authentication check
|
|
2042
2039
|
if (!this.sessionId || !this.companyId) {
|
|
2043
2040
|
throw new Error('Session not initialized. Call startSession() first.');
|
|
@@ -2067,7 +2064,7 @@ class BrokersWrapper {
|
|
|
2067
2064
|
});
|
|
2068
2065
|
try {
|
|
2069
2066
|
const response = await retryApiCall(async () => {
|
|
2070
|
-
const apiResponse = await this.api.getOrdersApiV1BrokersDataOrdersGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, accountId: resolvedParams.accountId, symbol: resolvedParams.symbol, orderStatus: resolvedParams.orderStatus, side: resolvedParams.side, assetType: resolvedParams.assetType, limit: resolvedParams.limit, offset: resolvedParams.offset, createdAfter: resolvedParams.createdAfter, createdBefore: resolvedParams.createdBefore, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2067
|
+
const apiResponse = await this.api.getOrdersApiV1BrokersDataOrdersGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountId !== undefined ? { accountId: resolvedParams.accountId } : {}), ...(resolvedParams.symbol !== undefined ? { symbol: resolvedParams.symbol } : {}), ...(resolvedParams.orderStatus !== undefined ? { orderStatus: resolvedParams.orderStatus } : {}), ...(resolvedParams.side !== undefined ? { side: resolvedParams.side } : {}), ...(resolvedParams.assetType !== undefined ? { assetType: resolvedParams.assetType } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.createdAfter !== undefined ? { createdAfter: resolvedParams.createdAfter } : {}), ...(resolvedParams.createdBefore !== undefined ? { createdBefore: resolvedParams.createdBefore } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2071
2068
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
2072
2069
|
}, {}, this.sdkConfig);
|
|
2073
2070
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -2183,7 +2180,7 @@ class BrokersWrapper {
|
|
|
2183
2180
|
* Returns positions from connections the company has read access to.
|
|
2184
2181
|
* @param params.brokerId {string} (optional) Filter by broker ID
|
|
2185
2182
|
* @param params.connectionId {string} (optional) Filter by connection ID
|
|
2186
|
-
* @param params.accountId {string} (optional) Filter by broker provided account ID
|
|
2183
|
+
* @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
|
|
2187
2184
|
* @param params.symbol {string} (optional) Filter by symbol
|
|
2188
2185
|
* @param params.side {BrokerDataOrderSideEnum} (optional) Filter by position side (e.g., 'long', 'short')
|
|
2189
2186
|
* @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
|
|
@@ -2232,13 +2229,22 @@ class BrokersWrapper {
|
|
|
2232
2229
|
// Use params object (with default empty object)
|
|
2233
2230
|
const resolvedParams = params || {};
|
|
2234
2231
|
if (params?.side !== undefined) {
|
|
2235
|
-
|
|
2232
|
+
const coerced = coerceEnumValue(params.side, exports.BrokerDataOrderSideEnum, 'side');
|
|
2233
|
+
if (coerced !== undefined) {
|
|
2234
|
+
params.side = coerced;
|
|
2235
|
+
}
|
|
2236
2236
|
}
|
|
2237
2237
|
if (params?.assetType !== undefined) {
|
|
2238
|
-
|
|
2238
|
+
const coerced = coerceEnumValue(params.assetType, exports.BrokerDataAssetTypeEnum, 'assetType');
|
|
2239
|
+
if (coerced !== undefined) {
|
|
2240
|
+
params.assetType = coerced;
|
|
2241
|
+
}
|
|
2239
2242
|
}
|
|
2240
2243
|
if (params?.positionStatus !== undefined) {
|
|
2241
|
-
|
|
2244
|
+
const coerced = coerceEnumValue(params.positionStatus, exports.BrokerDataPositionStatusEnum, 'positionStatus');
|
|
2245
|
+
if (coerced !== undefined) {
|
|
2246
|
+
params.positionStatus = coerced;
|
|
2247
|
+
}
|
|
2242
2248
|
} // Authentication check
|
|
2243
2249
|
if (!this.sessionId || !this.companyId) {
|
|
2244
2250
|
throw new Error('Session not initialized. Call startSession() first.');
|
|
@@ -2268,7 +2274,7 @@ class BrokersWrapper {
|
|
|
2268
2274
|
});
|
|
2269
2275
|
try {
|
|
2270
2276
|
const response = await retryApiCall(async () => {
|
|
2271
|
-
const apiResponse = await this.api.getPositionsApiV1BrokersDataPositionsGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, accountId: resolvedParams.accountId, symbol: resolvedParams.symbol, side: resolvedParams.side, assetType: resolvedParams.assetType, positionStatus: resolvedParams.positionStatus, limit: resolvedParams.limit, offset: resolvedParams.offset, updatedAfter: resolvedParams.updatedAfter, updatedBefore: resolvedParams.updatedBefore, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2277
|
+
const apiResponse = await this.api.getPositionsApiV1BrokersDataPositionsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountId !== undefined ? { accountId: resolvedParams.accountId } : {}), ...(resolvedParams.symbol !== undefined ? { symbol: resolvedParams.symbol } : {}), ...(resolvedParams.side !== undefined ? { side: resolvedParams.side } : {}), ...(resolvedParams.assetType !== undefined ? { assetType: resolvedParams.assetType } : {}), ...(resolvedParams.positionStatus !== undefined ? { positionStatus: resolvedParams.positionStatus } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.updatedAfter !== undefined ? { updatedAfter: resolvedParams.updatedAfter } : {}), ...(resolvedParams.updatedBefore !== undefined ? { updatedBefore: resolvedParams.updatedBefore } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2272
2278
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
2273
2279
|
}, {}, this.sdkConfig);
|
|
2274
2280
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -2384,7 +2390,7 @@ class BrokersWrapper {
|
|
|
2384
2390
|
* Returns balances from connections the company has read access to.
|
|
2385
2391
|
* @param params.brokerId {string} (optional) Filter by broker ID
|
|
2386
2392
|
* @param params.connectionId {string} (optional) Filter by connection ID
|
|
2387
|
-
* @param params.accountId {string} (optional) Filter by broker provided account ID
|
|
2393
|
+
* @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
|
|
2388
2394
|
* @param params.isEndOfDaySnapshot {boolean} (optional) Filter by end-of-day snapshot status (true/false)
|
|
2389
2395
|
* @param params.limit {number} (optional) Maximum number of balances to return
|
|
2390
2396
|
* @param params.offset {number} (optional) Number of balances to skip for pagination
|
|
@@ -2457,7 +2463,7 @@ class BrokersWrapper {
|
|
|
2457
2463
|
});
|
|
2458
2464
|
try {
|
|
2459
2465
|
const response = await retryApiCall(async () => {
|
|
2460
|
-
const apiResponse = await this.api.getBalancesApiV1BrokersDataBalancesGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, accountId: resolvedParams.accountId, isEndOfDaySnapshot: resolvedParams.isEndOfDaySnapshot, limit: resolvedParams.limit, offset: resolvedParams.offset, balanceCreatedAfter: resolvedParams.balanceCreatedAfter, balanceCreatedBefore: resolvedParams.balanceCreatedBefore, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2466
|
+
const apiResponse = await this.api.getBalancesApiV1BrokersDataBalancesGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountId !== undefined ? { accountId: resolvedParams.accountId } : {}), ...(resolvedParams.isEndOfDaySnapshot !== undefined ? { isEndOfDaySnapshot: resolvedParams.isEndOfDaySnapshot } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.balanceCreatedAfter !== undefined ? { balanceCreatedAfter: resolvedParams.balanceCreatedAfter } : {}), ...(resolvedParams.balanceCreatedBefore !== undefined ? { balanceCreatedBefore: resolvedParams.balanceCreatedBefore } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2461
2467
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
2462
2468
|
}, {}, this.sdkConfig);
|
|
2463
2469
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -2618,7 +2624,10 @@ class BrokersWrapper {
|
|
|
2618
2624
|
// Use params object (with default empty object)
|
|
2619
2625
|
const resolvedParams = params || {};
|
|
2620
2626
|
if (params?.accountType !== undefined) {
|
|
2621
|
-
|
|
2627
|
+
const coerced = coerceEnumValue(params.accountType, exports.BrokerDataAccountTypeEnum, 'accountType');
|
|
2628
|
+
if (coerced !== undefined) {
|
|
2629
|
+
params.accountType = coerced;
|
|
2630
|
+
}
|
|
2622
2631
|
} // Authentication check
|
|
2623
2632
|
if (!this.sessionId || !this.companyId) {
|
|
2624
2633
|
throw new Error('Session not initialized. Call startSession() first.');
|
|
@@ -2648,7 +2657,7 @@ class BrokersWrapper {
|
|
|
2648
2657
|
});
|
|
2649
2658
|
try {
|
|
2650
2659
|
const response = await retryApiCall(async () => {
|
|
2651
|
-
const apiResponse = await this.api.getAccountsApiV1BrokersDataAccountsGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, accountType: resolvedParams.accountType, status: resolvedParams.status, currency: resolvedParams.currency, limit: resolvedParams.limit, offset: resolvedParams.offset, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2660
|
+
const apiResponse = await this.api.getAccountsApiV1BrokersDataAccountsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountType !== undefined ? { accountType: resolvedParams.accountType } : {}), ...(resolvedParams.status !== undefined ? { status: resolvedParams.status } : {}), ...(resolvedParams.currency !== undefined ? { currency: resolvedParams.currency } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2652
2661
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
2653
2662
|
}, {}, this.sdkConfig);
|
|
2654
2663
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -2837,7 +2846,7 @@ class BrokersWrapper {
|
|
|
2837
2846
|
});
|
|
2838
2847
|
try {
|
|
2839
2848
|
const response = await retryApiCall(async () => {
|
|
2840
|
-
const apiResponse = await this.api.getOrderFillsApiV1BrokersDataOrdersOrderIdFillsGet({ orderId: resolvedParams.orderId, connectionId: resolvedParams.connectionId, limit: resolvedParams.limit, offset: resolvedParams.offset, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2849
|
+
const apiResponse = await this.api.getOrderFillsApiV1BrokersDataOrdersOrderIdFillsGet({ orderId: resolvedParams.orderId ?? null, ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
2841
2850
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
2842
2851
|
}, {}, this.sdkConfig);
|
|
2843
2852
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3026,7 +3035,7 @@ class BrokersWrapper {
|
|
|
3026
3035
|
});
|
|
3027
3036
|
try {
|
|
3028
3037
|
const response = await retryApiCall(async () => {
|
|
3029
|
-
const apiResponse = await this.api.getOrderEventsApiV1BrokersDataOrdersOrderIdEventsGet({ orderId: resolvedParams.orderId, connectionId: resolvedParams.connectionId, limit: resolvedParams.limit, offset: resolvedParams.offset, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3038
|
+
const apiResponse = await this.api.getOrderEventsApiV1BrokersDataOrdersOrderIdEventsGet({ orderId: resolvedParams.orderId ?? null, ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3030
3039
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3031
3040
|
}, {}, this.sdkConfig);
|
|
3032
3041
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3212,7 +3221,7 @@ class BrokersWrapper {
|
|
|
3212
3221
|
});
|
|
3213
3222
|
try {
|
|
3214
3223
|
const response = await retryApiCall(async () => {
|
|
3215
|
-
const apiResponse = await this.api.getOrderGroupsApiV1BrokersDataOrdersGroupsGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, limit: resolvedParams.limit, offset: resolvedParams.offset, createdAfter: resolvedParams.createdAfter, createdBefore: resolvedParams.createdBefore, includeMetadata: resolvedParams.includeMetadata }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3224
|
+
const apiResponse = await this.api.getOrderGroupsApiV1BrokersDataOrdersGroupsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}), ...(resolvedParams.createdAfter !== undefined ? { createdAfter: resolvedParams.createdAfter } : {}), ...(resolvedParams.createdBefore !== undefined ? { createdBefore: resolvedParams.createdBefore } : {}), ...(resolvedParams.includeMetadata !== undefined ? { includeMetadata: resolvedParams.includeMetadata } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3216
3225
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3217
3226
|
}, {}, this.sdkConfig);
|
|
3218
3227
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3399,7 +3408,7 @@ class BrokersWrapper {
|
|
|
3399
3408
|
});
|
|
3400
3409
|
try {
|
|
3401
3410
|
const response = await retryApiCall(async () => {
|
|
3402
|
-
const apiResponse = await this.api.getPositionLotsApiV1BrokersDataPositionsLotsGet({ brokerId: resolvedParams.brokerId, connectionId: resolvedParams.connectionId, accountId: resolvedParams.accountId, symbol: resolvedParams.symbol, positionId: resolvedParams.positionId, limit: resolvedParams.limit, offset: resolvedParams.offset }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3411
|
+
const apiResponse = await this.api.getPositionLotsApiV1BrokersDataPositionsLotsGet({ ...(resolvedParams.brokerId !== undefined ? { brokerId: resolvedParams.brokerId } : {}), ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.accountId !== undefined ? { accountId: resolvedParams.accountId } : {}), ...(resolvedParams.symbol !== undefined ? { symbol: resolvedParams.symbol } : {}), ...(resolvedParams.positionId !== undefined ? { positionId: resolvedParams.positionId } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3403
3412
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3404
3413
|
}, {}, this.sdkConfig);
|
|
3405
3414
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3587,7 +3596,7 @@ class BrokersWrapper {
|
|
|
3587
3596
|
});
|
|
3588
3597
|
try {
|
|
3589
3598
|
const response = await retryApiCall(async () => {
|
|
3590
|
-
const apiResponse = await this.api.getPositionLotFillsApiV1BrokersDataPositionsLotsLotIdFillsGet({ lotId: resolvedParams.lotId, connectionId: resolvedParams.connectionId, limit: resolvedParams.limit, offset: resolvedParams.offset }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3599
|
+
const apiResponse = await this.api.getPositionLotFillsApiV1BrokersDataPositionsLotsLotIdFillsGet({ lotId: resolvedParams.lotId ?? null, ...(resolvedParams.connectionId !== undefined ? { connectionId: resolvedParams.connectionId } : {}), ...(resolvedParams.limit !== undefined ? { limit: resolvedParams.limit } : {}), ...(resolvedParams.offset !== undefined ? { offset: resolvedParams.offset } : {}) }, { headers: { 'x-request-id': requestId, ...(this.sessionId && this.companyId ? { 'x-session-id': this.sessionId, 'x-company-id': this.companyId, ...(this.csrfToken ? { 'x-csrf-token': this.csrfToken } : {}) } : {}) } });
|
|
3591
3600
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3592
3601
|
}, {}, this.sdkConfig);
|
|
3593
3602
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3785,7 +3794,7 @@ class CompanyWrapper {
|
|
|
3785
3794
|
});
|
|
3786
3795
|
try {
|
|
3787
3796
|
const response = await retryApiCall(async () => {
|
|
3788
|
-
const apiResponse = await this.api.getCompanyApiV1CompanyCompanyIdGet({ companyId: resolvedParams.companyId }, { headers: { 'x-request-id': requestId } });
|
|
3797
|
+
const apiResponse = await this.api.getCompanyApiV1CompanyCompanyIdGet({ companyId: resolvedParams.companyId ?? null }, { headers: { 'x-request-id': requestId } });
|
|
3789
3798
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3790
3799
|
}, {}, this.sdkConfig);
|
|
3791
3800
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -3967,7 +3976,7 @@ class SessionWrapper {
|
|
|
3967
3976
|
});
|
|
3968
3977
|
try {
|
|
3969
3978
|
const response = await retryApiCall(async () => {
|
|
3970
|
-
const apiResponse = await this.api.initSessionApiV1SessionInitPost({ xApiKey: resolvedParams.xApiKey }, { headers: { 'x-request-id': requestId } });
|
|
3979
|
+
const apiResponse = await this.api.initSessionApiV1SessionInitPost({ xApiKey: resolvedParams.xApiKey ?? null }, { headers: { 'x-request-id': requestId } });
|
|
3971
3980
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
3972
3981
|
}, {}, this.sdkConfig);
|
|
3973
3982
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -4111,7 +4120,7 @@ class SessionWrapper {
|
|
|
4111
4120
|
});
|
|
4112
4121
|
try {
|
|
4113
4122
|
const response = await retryApiCall(async () => {
|
|
4114
|
-
const apiResponse = await this.api.startSessionApiV1SessionStartPost({ oneTimeToken: resolvedParams.OneTimeToken, sessionStartRequest: resolvedParams.body }, { headers: { 'x-request-id': requestId } });
|
|
4123
|
+
const apiResponse = await this.api.startSessionApiV1SessionStartPost({ oneTimeToken: resolvedParams.OneTimeToken ?? null, sessionStartRequest: resolvedParams.body ?? null }, { headers: { 'x-request-id': requestId } });
|
|
4115
4124
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
4116
4125
|
}, {}, this.sdkConfig);
|
|
4117
4126
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -4423,7 +4432,7 @@ class SessionWrapper {
|
|
|
4423
4432
|
});
|
|
4424
4433
|
try {
|
|
4425
4434
|
const response = await retryApiCall(async () => {
|
|
4426
|
-
const apiResponse = await this.api.getSessionUserApiV1SessionSessionIdUserGet({ sessionId: resolvedParams.sessionId, xSessionId: resolvedParams.sessionId }, { headers: { 'x-request-id': requestId } });
|
|
4435
|
+
const apiResponse = await this.api.getSessionUserApiV1SessionSessionIdUserGet({ sessionId: resolvedParams.sessionId ?? null, xSessionId: resolvedParams.sessionId ?? null }, { headers: { 'x-request-id': requestId } });
|
|
4427
4436
|
return await applyResponseInterceptors(apiResponse, this.sdkConfig);
|
|
4428
4437
|
}, {}, this.sdkConfig);
|
|
4429
4438
|
// Unwrap axios response immediately - get FinaticResponse object
|
|
@@ -4537,7 +4546,7 @@ function validateParams(schema, params, config) {
|
|
|
4537
4546
|
}
|
|
4538
4547
|
catch (error) {
|
|
4539
4548
|
if (error instanceof z__namespace.ZodError) {
|
|
4540
|
-
const message = `Validation failed: ${error.
|
|
4549
|
+
const message = `Validation failed: ${error.issues.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`;
|
|
4541
4550
|
if (config?.validationStrict) {
|
|
4542
4551
|
throw new ValidationError(message);
|
|
4543
4552
|
}
|
|
@@ -5497,7 +5506,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
|
|
|
5497
5506
|
* @summary Get Balances
|
|
5498
5507
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
5499
5508
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
5500
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
5509
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
5501
5510
|
* @param {boolean | null} [isEndOfDaySnapshot] Filter by end-of-day snapshot status (true/false)
|
|
5502
5511
|
* @param {number} [limit] Maximum number of balances to return
|
|
5503
5512
|
* @param {number} [offset] Number of balances to skip for pagination
|
|
@@ -5734,9 +5743,9 @@ const BrokersApiAxiosParamCreator = function (configuration) {
|
|
|
5734
5743
|
* @summary Get Orders
|
|
5735
5744
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
5736
5745
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
5737
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
5746
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
5738
5747
|
* @param {string | null} [symbol] Filter by symbol
|
|
5739
|
-
* @param {
|
|
5748
|
+
* @param {string | null} [orderStatus] Filter by order status (e.g., \'filled\', \'pending_new\', \'cancelled\')
|
|
5740
5749
|
* @param {BrokerDataOrderSideEnum | null} [side] Filter by order side (e.g., \'buy\', \'sell\')
|
|
5741
5750
|
* @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \'stock\', \'option\', \'crypto\', \'future\')
|
|
5742
5751
|
* @param {number} [limit] Maximum number of orders to return
|
|
@@ -5905,7 +5914,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
|
|
|
5905
5914
|
* @summary Get Positions
|
|
5906
5915
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
5907
5916
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
5908
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
5917
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
5909
5918
|
* @param {string | null} [symbol] Filter by symbol
|
|
5910
5919
|
* @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \'long\', \'short\')
|
|
5911
5920
|
* @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \'stock\', \'option\', \'crypto\', \'future\')
|
|
@@ -6048,7 +6057,7 @@ const BrokersApiFp = function (configuration) {
|
|
|
6048
6057
|
* @summary Get Balances
|
|
6049
6058
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
6050
6059
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
6051
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
6060
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
6052
6061
|
* @param {boolean | null} [isEndOfDaySnapshot] Filter by end-of-day snapshot status (true/false)
|
|
6053
6062
|
* @param {number} [limit] Maximum number of balances to return
|
|
6054
6063
|
* @param {number} [offset] Number of balances to skip for pagination
|
|
@@ -6134,9 +6143,9 @@ const BrokersApiFp = function (configuration) {
|
|
|
6134
6143
|
* @summary Get Orders
|
|
6135
6144
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
6136
6145
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
6137
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
6146
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
6138
6147
|
* @param {string | null} [symbol] Filter by symbol
|
|
6139
|
-
* @param {
|
|
6148
|
+
* @param {string | null} [orderStatus] Filter by order status (e.g., \'filled\', \'pending_new\', \'cancelled\')
|
|
6140
6149
|
* @param {BrokerDataOrderSideEnum | null} [side] Filter by order side (e.g., \'buy\', \'sell\')
|
|
6141
6150
|
* @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \'stock\', \'option\', \'crypto\', \'future\')
|
|
6142
6151
|
* @param {number} [limit] Maximum number of orders to return
|
|
@@ -6193,7 +6202,7 @@ const BrokersApiFp = function (configuration) {
|
|
|
6193
6202
|
* @summary Get Positions
|
|
6194
6203
|
* @param {string | null} [brokerId] Filter by broker ID
|
|
6195
6204
|
* @param {string | null} [connectionId] Filter by connection ID
|
|
6196
|
-
* @param {string | null} [accountId] Filter by broker provided account ID
|
|
6205
|
+
* @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
|
|
6197
6206
|
* @param {string | null} [symbol] Filter by symbol
|
|
6198
6207
|
* @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \'long\', \'short\')
|
|
6199
6208
|
* @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \'stock\', \'option\', \'crypto\', \'future\')
|
|
@@ -6713,7 +6722,7 @@ let FinaticConnect$1 = class FinaticConnect extends EventEmitter {
|
|
|
6713
6722
|
logger.debug?.('Creating new FinaticConnect instance');
|
|
6714
6723
|
const connectOptions = {
|
|
6715
6724
|
token,
|
|
6716
|
-
sdkConfig
|
|
6725
|
+
...(sdkConfig !== undefined && { sdkConfig }),
|
|
6717
6726
|
};
|
|
6718
6727
|
instance = new FinaticConnect(connectOptions);
|
|
6719
6728
|
baseClass.instance = instance;
|