@finatic/client 0.9.3 → 0.9.4

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.mjs CHANGED
@@ -616,7 +616,11 @@ function coerceEnumValue(input, EnumObj, enumName) {
616
616
  // Direct match by value (case-insensitive)
617
617
  const valueMatch = values.find(v => v.toLowerCase() === normalized.toLowerCase());
618
618
  if (valueMatch) {
619
- return valueMatch;
619
+ // Find the enum key that has this value
620
+ const matchingKey = Object.keys(EnumObj).find(k => EnumObj[k] === valueMatch);
621
+ if (matchingKey) {
622
+ return EnumObj[matchingKey]; // Returns enum member (e.g., BrokerDataOrderStatusEnum.Filled)
623
+ }
620
624
  }
621
625
  // Match by key name (case-insensitive)
622
626
  const keyMatch = Object.keys(EnumObj).find(k => String(k).toLowerCase() === normalized.toLowerCase());
@@ -764,34 +768,6 @@ var BrokerDataOrderSideEnum;
764
768
  BrokerDataOrderSideEnum["Sell"] = "sell";
765
769
  })(BrokerDataOrderSideEnum || (BrokerDataOrderSideEnum = {}));
766
770
 
767
- /* tslint:disable */
768
- /* eslint-disable */
769
- /**
770
- * Finatic FastAPI Backend
771
- * FinaticAPI REST API
772
- *
773
- * The version of the OpenAPI document: 1.0.0
774
- *
775
- *
776
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
777
- * https://openapi-generator.tech
778
- * Do not edit the class manually.
779
- */
780
- var BrokerDataOrderStatusEnum;
781
- (function (BrokerDataOrderStatusEnum) {
782
- BrokerDataOrderStatusEnum["Submitted"] = "submitted";
783
- BrokerDataOrderStatusEnum["New"] = "new";
784
- BrokerDataOrderStatusEnum["PartiallyFilled"] = "partially_filled";
785
- BrokerDataOrderStatusEnum["Filled"] = "filled";
786
- BrokerDataOrderStatusEnum["PendingCancel"] = "pending_cancel";
787
- BrokerDataOrderStatusEnum["Cancelled"] = "cancelled";
788
- BrokerDataOrderStatusEnum["Rejected"] = "rejected";
789
- BrokerDataOrderStatusEnum["Expired"] = "expired";
790
- BrokerDataOrderStatusEnum["Created"] = "created";
791
- BrokerDataOrderStatusEnum["Received"] = "received";
792
- BrokerDataOrderStatusEnum["Queued"] = "queued";
793
- })(BrokerDataOrderStatusEnum || (BrokerDataOrderStatusEnum = {}));
794
-
795
771
  /* tslint:disable */
796
772
  /* eslint-disable */
797
773
  /**
@@ -1375,6 +1351,23 @@ class PaginatedData {
1375
1351
  toLocaleString() {
1376
1352
  return this.items.toLocaleString();
1377
1353
  }
1354
+ /**
1355
+ * Convert to JSON - returns just the items array for serialization.
1356
+ * This allows clean serialization without exposing internal methods.
1357
+ *
1358
+ * @returns The items array
1359
+ *
1360
+ * @example
1361
+ * ```typescript
1362
+ * const orders = await sdk.getOrders();
1363
+ * console.log(orders); // Shows full PaginatedData with methods
1364
+ * console.log(orders.toJSON()); // Shows just the items array
1365
+ * JSON.stringify(orders); // Automatically uses toJSON()
1366
+ * ```
1367
+ */
1368
+ toJSON() {
1369
+ return this.items;
1370
+ }
1378
1371
  /**
1379
1372
  * Get the next page of data.
1380
1373
  * @returns Promise<PaginatedData<T>> - The next page (not wrapped in FinaticResponse)
@@ -1857,7 +1850,7 @@ class BrokersWrapper {
1857
1850
  });
1858
1851
  try {
1859
1852
  const response = await retryApiCall(async () => {
1860
- 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 } : {}) } : {}) } });
1853
+ 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 } : {}) } : {}) } });
1861
1854
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
1862
1855
  }, {}, this.sdkConfig);
1863
1856
  // Unwrap axios response immediately - get FinaticResponse object
@@ -1961,9 +1954,9 @@ class BrokersWrapper {
1961
1954
  * Returns orders from connections the company has read access to.
1962
1955
  * @param params.brokerId {string} (optional) Filter by broker ID
1963
1956
  * @param params.connectionId {string} (optional) Filter by connection ID
1964
- * @param params.accountId {string} (optional) Filter by broker provided account ID
1957
+ * @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
1965
1958
  * @param params.symbol {string} (optional) Filter by symbol
1966
- * @param params.orderStatus {BrokerDataOrderStatusEnum} (optional) Filter by order status (e.g., 'filled', 'pending_new', 'cancelled')
1959
+ * @param params.orderStatus {string} (optional) Filter by order status (e.g., 'filled', 'pending_new', 'cancelled')
1967
1960
  * @param params.side {BrokerDataOrderSideEnum} (optional) Filter by order side (e.g., 'buy', 'sell')
1968
1961
  * @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
1969
1962
  * @param params.limit {number} (optional) Maximum number of orders to return
@@ -2009,14 +2002,17 @@ class BrokersWrapper {
2009
2002
  async getOrders(params) {
2010
2003
  // Use params object (with default empty object)
2011
2004
  const resolvedParams = params || {};
2012
- if (params?.orderStatus !== undefined) {
2013
- params.orderStatus = coerceEnumValue(params.orderStatus, BrokerDataOrderStatusEnum, 'orderStatus');
2014
- }
2015
2005
  if (params?.side !== undefined) {
2016
- params.side = coerceEnumValue(params.side, BrokerDataOrderSideEnum, 'side');
2006
+ const coerced = coerceEnumValue(params.side, BrokerDataOrderSideEnum, 'side');
2007
+ if (coerced !== undefined) {
2008
+ params.side = coerced;
2009
+ }
2017
2010
  }
2018
2011
  if (params?.assetType !== undefined) {
2019
- params.assetType = coerceEnumValue(params.assetType, BrokerDataAssetTypeEnum, 'assetType');
2012
+ const coerced = coerceEnumValue(params.assetType, BrokerDataAssetTypeEnum, 'assetType');
2013
+ if (coerced !== undefined) {
2014
+ params.assetType = coerced;
2015
+ }
2020
2016
  } // Authentication check
2021
2017
  if (!this.sessionId || !this.companyId) {
2022
2018
  throw new Error('Session not initialized. Call startSession() first.');
@@ -2046,7 +2042,7 @@ class BrokersWrapper {
2046
2042
  });
2047
2043
  try {
2048
2044
  const response = await retryApiCall(async () => {
2049
- 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 } : {}) } : {}) } });
2045
+ 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 } : {}) } : {}) } });
2050
2046
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2051
2047
  }, {}, this.sdkConfig);
2052
2048
  // Unwrap axios response immediately - get FinaticResponse object
@@ -2162,7 +2158,7 @@ class BrokersWrapper {
2162
2158
  * Returns positions from connections the company has read access to.
2163
2159
  * @param params.brokerId {string} (optional) Filter by broker ID
2164
2160
  * @param params.connectionId {string} (optional) Filter by connection ID
2165
- * @param params.accountId {string} (optional) Filter by broker provided account ID
2161
+ * @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
2166
2162
  * @param params.symbol {string} (optional) Filter by symbol
2167
2163
  * @param params.side {BrokerDataOrderSideEnum} (optional) Filter by position side (e.g., 'long', 'short')
2168
2164
  * @param params.assetType {BrokerDataAssetTypeEnum} (optional) Filter by asset type (e.g., 'stock', 'option', 'crypto', 'future')
@@ -2211,13 +2207,22 @@ class BrokersWrapper {
2211
2207
  // Use params object (with default empty object)
2212
2208
  const resolvedParams = params || {};
2213
2209
  if (params?.side !== undefined) {
2214
- params.side = coerceEnumValue(params.side, BrokerDataOrderSideEnum, 'side');
2210
+ const coerced = coerceEnumValue(params.side, BrokerDataOrderSideEnum, 'side');
2211
+ if (coerced !== undefined) {
2212
+ params.side = coerced;
2213
+ }
2215
2214
  }
2216
2215
  if (params?.assetType !== undefined) {
2217
- params.assetType = coerceEnumValue(params.assetType, BrokerDataAssetTypeEnum, 'assetType');
2216
+ const coerced = coerceEnumValue(params.assetType, BrokerDataAssetTypeEnum, 'assetType');
2217
+ if (coerced !== undefined) {
2218
+ params.assetType = coerced;
2219
+ }
2218
2220
  }
2219
2221
  if (params?.positionStatus !== undefined) {
2220
- params.positionStatus = coerceEnumValue(params.positionStatus, BrokerDataPositionStatusEnum, 'positionStatus');
2222
+ const coerced = coerceEnumValue(params.positionStatus, BrokerDataPositionStatusEnum, 'positionStatus');
2223
+ if (coerced !== undefined) {
2224
+ params.positionStatus = coerced;
2225
+ }
2221
2226
  } // Authentication check
2222
2227
  if (!this.sessionId || !this.companyId) {
2223
2228
  throw new Error('Session not initialized. Call startSession() first.');
@@ -2247,7 +2252,7 @@ class BrokersWrapper {
2247
2252
  });
2248
2253
  try {
2249
2254
  const response = await retryApiCall(async () => {
2250
- 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 } : {}) } : {}) } });
2255
+ 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 } : {}) } : {}) } });
2251
2256
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2252
2257
  }, {}, this.sdkConfig);
2253
2258
  // Unwrap axios response immediately - get FinaticResponse object
@@ -2363,7 +2368,7 @@ class BrokersWrapper {
2363
2368
  * Returns balances from connections the company has read access to.
2364
2369
  * @param params.brokerId {string} (optional) Filter by broker ID
2365
2370
  * @param params.connectionId {string} (optional) Filter by connection ID
2366
- * @param params.accountId {string} (optional) Filter by broker provided account ID
2371
+ * @param params.accountId {string} (optional) Filter by broker provided account ID or internal account UUID
2367
2372
  * @param params.isEndOfDaySnapshot {boolean} (optional) Filter by end-of-day snapshot status (true/false)
2368
2373
  * @param params.limit {number} (optional) Maximum number of balances to return
2369
2374
  * @param params.offset {number} (optional) Number of balances to skip for pagination
@@ -2436,7 +2441,7 @@ class BrokersWrapper {
2436
2441
  });
2437
2442
  try {
2438
2443
  const response = await retryApiCall(async () => {
2439
- 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 } : {}) } : {}) } });
2444
+ 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 } : {}) } : {}) } });
2440
2445
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2441
2446
  }, {}, this.sdkConfig);
2442
2447
  // Unwrap axios response immediately - get FinaticResponse object
@@ -2597,7 +2602,10 @@ class BrokersWrapper {
2597
2602
  // Use params object (with default empty object)
2598
2603
  const resolvedParams = params || {};
2599
2604
  if (params?.accountType !== undefined) {
2600
- params.accountType = coerceEnumValue(params.accountType, BrokerDataAccountTypeEnum, 'accountType');
2605
+ const coerced = coerceEnumValue(params.accountType, BrokerDataAccountTypeEnum, 'accountType');
2606
+ if (coerced !== undefined) {
2607
+ params.accountType = coerced;
2608
+ }
2601
2609
  } // Authentication check
2602
2610
  if (!this.sessionId || !this.companyId) {
2603
2611
  throw new Error('Session not initialized. Call startSession() first.');
@@ -2627,7 +2635,7 @@ class BrokersWrapper {
2627
2635
  });
2628
2636
  try {
2629
2637
  const response = await retryApiCall(async () => {
2630
- 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 } : {}) } : {}) } });
2638
+ 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 } : {}) } : {}) } });
2631
2639
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2632
2640
  }, {}, this.sdkConfig);
2633
2641
  // Unwrap axios response immediately - get FinaticResponse object
@@ -2816,7 +2824,7 @@ class BrokersWrapper {
2816
2824
  });
2817
2825
  try {
2818
2826
  const response = await retryApiCall(async () => {
2819
- 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 } : {}) } : {}) } });
2827
+ 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 } : {}) } : {}) } });
2820
2828
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
2821
2829
  }, {}, this.sdkConfig);
2822
2830
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3005,7 +3013,7 @@ class BrokersWrapper {
3005
3013
  });
3006
3014
  try {
3007
3015
  const response = await retryApiCall(async () => {
3008
- 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 } : {}) } : {}) } });
3016
+ 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 } : {}) } : {}) } });
3009
3017
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3010
3018
  }, {}, this.sdkConfig);
3011
3019
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3191,7 +3199,7 @@ class BrokersWrapper {
3191
3199
  });
3192
3200
  try {
3193
3201
  const response = await retryApiCall(async () => {
3194
- 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 } : {}) } : {}) } });
3202
+ 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 } : {}) } : {}) } });
3195
3203
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3196
3204
  }, {}, this.sdkConfig);
3197
3205
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3378,7 +3386,7 @@ class BrokersWrapper {
3378
3386
  });
3379
3387
  try {
3380
3388
  const response = await retryApiCall(async () => {
3381
- 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 } : {}) } : {}) } });
3389
+ 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 } : {}) } : {}) } });
3382
3390
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3383
3391
  }, {}, this.sdkConfig);
3384
3392
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3566,7 +3574,7 @@ class BrokersWrapper {
3566
3574
  });
3567
3575
  try {
3568
3576
  const response = await retryApiCall(async () => {
3569
- 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 } : {}) } : {}) } });
3577
+ 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 } : {}) } : {}) } });
3570
3578
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3571
3579
  }, {}, this.sdkConfig);
3572
3580
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3764,7 +3772,7 @@ class CompanyWrapper {
3764
3772
  });
3765
3773
  try {
3766
3774
  const response = await retryApiCall(async () => {
3767
- const apiResponse = await this.api.getCompanyApiV1CompanyCompanyIdGet({ companyId: resolvedParams.companyId }, { headers: { 'x-request-id': requestId } });
3775
+ const apiResponse = await this.api.getCompanyApiV1CompanyCompanyIdGet({ companyId: resolvedParams.companyId ?? null }, { headers: { 'x-request-id': requestId } });
3768
3776
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3769
3777
  }, {}, this.sdkConfig);
3770
3778
  // Unwrap axios response immediately - get FinaticResponse object
@@ -3946,7 +3954,7 @@ class SessionWrapper {
3946
3954
  });
3947
3955
  try {
3948
3956
  const response = await retryApiCall(async () => {
3949
- const apiResponse = await this.api.initSessionApiV1SessionInitPost({ xApiKey: resolvedParams.xApiKey }, { headers: { 'x-request-id': requestId } });
3957
+ const apiResponse = await this.api.initSessionApiV1SessionInitPost({ xApiKey: resolvedParams.xApiKey ?? null }, { headers: { 'x-request-id': requestId } });
3950
3958
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
3951
3959
  }, {}, this.sdkConfig);
3952
3960
  // Unwrap axios response immediately - get FinaticResponse object
@@ -4090,7 +4098,7 @@ class SessionWrapper {
4090
4098
  });
4091
4099
  try {
4092
4100
  const response = await retryApiCall(async () => {
4093
- const apiResponse = await this.api.startSessionApiV1SessionStartPost({ oneTimeToken: resolvedParams.OneTimeToken, sessionStartRequest: resolvedParams.body }, { headers: { 'x-request-id': requestId } });
4101
+ const apiResponse = await this.api.startSessionApiV1SessionStartPost({ oneTimeToken: resolvedParams.OneTimeToken ?? null, sessionStartRequest: resolvedParams.body ?? null }, { headers: { 'x-request-id': requestId } });
4094
4102
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
4095
4103
  }, {}, this.sdkConfig);
4096
4104
  // Unwrap axios response immediately - get FinaticResponse object
@@ -4402,7 +4410,7 @@ class SessionWrapper {
4402
4410
  });
4403
4411
  try {
4404
4412
  const response = await retryApiCall(async () => {
4405
- const apiResponse = await this.api.getSessionUserApiV1SessionSessionIdUserGet({ sessionId: resolvedParams.sessionId, xSessionId: resolvedParams.sessionId }, { headers: { 'x-request-id': requestId } });
4413
+ const apiResponse = await this.api.getSessionUserApiV1SessionSessionIdUserGet({ sessionId: resolvedParams.sessionId ?? null, xSessionId: resolvedParams.sessionId ?? null }, { headers: { 'x-request-id': requestId } });
4406
4414
  return await applyResponseInterceptors(apiResponse, this.sdkConfig);
4407
4415
  }, {}, this.sdkConfig);
4408
4416
  // Unwrap axios response immediately - get FinaticResponse object
@@ -5476,7 +5484,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
5476
5484
  * @summary Get Balances
5477
5485
  * @param {string | null} [brokerId] Filter by broker ID
5478
5486
  * @param {string | null} [connectionId] Filter by connection ID
5479
- * @param {string | null} [accountId] Filter by broker provided account ID
5487
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
5480
5488
  * @param {boolean | null} [isEndOfDaySnapshot] Filter by end-of-day snapshot status (true/false)
5481
5489
  * @param {number} [limit] Maximum number of balances to return
5482
5490
  * @param {number} [offset] Number of balances to skip for pagination
@@ -5713,9 +5721,9 @@ const BrokersApiAxiosParamCreator = function (configuration) {
5713
5721
  * @summary Get Orders
5714
5722
  * @param {string | null} [brokerId] Filter by broker ID
5715
5723
  * @param {string | null} [connectionId] Filter by connection ID
5716
- * @param {string | null} [accountId] Filter by broker provided account ID
5724
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
5717
5725
  * @param {string | null} [symbol] Filter by symbol
5718
- * @param {BrokerDataOrderStatusEnum | null} [orderStatus] Filter by order status (e.g., \&#39;filled\&#39;, \&#39;pending_new\&#39;, \&#39;cancelled\&#39;)
5726
+ * @param {string | null} [orderStatus] Filter by order status (e.g., \&#39;filled\&#39;, \&#39;pending_new\&#39;, \&#39;cancelled\&#39;)
5719
5727
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by order side (e.g., \&#39;buy\&#39;, \&#39;sell\&#39;)
5720
5728
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
5721
5729
  * @param {number} [limit] Maximum number of orders to return
@@ -5884,7 +5892,7 @@ const BrokersApiAxiosParamCreator = function (configuration) {
5884
5892
  * @summary Get Positions
5885
5893
  * @param {string | null} [brokerId] Filter by broker ID
5886
5894
  * @param {string | null} [connectionId] Filter by connection ID
5887
- * @param {string | null} [accountId] Filter by broker provided account ID
5895
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
5888
5896
  * @param {string | null} [symbol] Filter by symbol
5889
5897
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
5890
5898
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
@@ -6027,7 +6035,7 @@ const BrokersApiFp = function (configuration) {
6027
6035
  * @summary Get Balances
6028
6036
  * @param {string | null} [brokerId] Filter by broker ID
6029
6037
  * @param {string | null} [connectionId] Filter by connection ID
6030
- * @param {string | null} [accountId] Filter by broker provided account ID
6038
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
6031
6039
  * @param {boolean | null} [isEndOfDaySnapshot] Filter by end-of-day snapshot status (true/false)
6032
6040
  * @param {number} [limit] Maximum number of balances to return
6033
6041
  * @param {number} [offset] Number of balances to skip for pagination
@@ -6113,9 +6121,9 @@ const BrokersApiFp = function (configuration) {
6113
6121
  * @summary Get Orders
6114
6122
  * @param {string | null} [brokerId] Filter by broker ID
6115
6123
  * @param {string | null} [connectionId] Filter by connection ID
6116
- * @param {string | null} [accountId] Filter by broker provided account ID
6124
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
6117
6125
  * @param {string | null} [symbol] Filter by symbol
6118
- * @param {BrokerDataOrderStatusEnum | null} [orderStatus] Filter by order status (e.g., \&#39;filled\&#39;, \&#39;pending_new\&#39;, \&#39;cancelled\&#39;)
6126
+ * @param {string | null} [orderStatus] Filter by order status (e.g., \&#39;filled\&#39;, \&#39;pending_new\&#39;, \&#39;cancelled\&#39;)
6119
6127
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by order side (e.g., \&#39;buy\&#39;, \&#39;sell\&#39;)
6120
6128
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
6121
6129
  * @param {number} [limit] Maximum number of orders to return
@@ -6172,7 +6180,7 @@ const BrokersApiFp = function (configuration) {
6172
6180
  * @summary Get Positions
6173
6181
  * @param {string | null} [brokerId] Filter by broker ID
6174
6182
  * @param {string | null} [connectionId] Filter by connection ID
6175
- * @param {string | null} [accountId] Filter by broker provided account ID
6183
+ * @param {string | null} [accountId] Filter by broker provided account ID or internal account UUID
6176
6184
  * @param {string | null} [symbol] Filter by symbol
6177
6185
  * @param {BrokerDataOrderSideEnum | null} [side] Filter by position side (e.g., \&#39;long\&#39;, \&#39;short\&#39;)
6178
6186
  * @param {BrokerDataAssetTypeEnum | null} [assetType] Filter by asset type (e.g., \&#39;stock\&#39;, \&#39;option\&#39;, \&#39;crypto\&#39;, \&#39;future\&#39;)
@@ -9074,5 +9082,5 @@ class FinaticConnect extends FinaticConnect$1 {
9074
9082
  // Marker to verify custom class is being used
9075
9083
  FinaticConnect.__CUSTOM_CLASS__ = true;
9076
9084
 
9077
- export { AccountStatus, ApiError, BrokerDataAccountTypeEnum, BrokerDataAssetTypeEnum, BrokerDataOrderSideEnum, BrokerDataOrderStatusEnum, BrokerDataPositionStatusEnum, BrokersApi, BrokersApiAxiosParamCreator, BrokersApiFactory, BrokersApiFp, BrokersWrapper, CompanyApi, CompanyApiAxiosParamCreator, CompanyApiFactory, CompanyApiFp, CompanyWrapper, Configuration, EventEmitter, FDXAccountStatus, FDXAccountType, FDXAssetType, FDXBalanceType, FDXOrderClass, FDXOrderEventType, FDXOrderGroupType, FDXOrderSide, FDXOrderStatus, FDXOrderType, FDXPositionSide, FDXPositionStatus, FDXSecurityIdType, FDXTimeInForce, FinaticConnect, FinaticError, PaginatedData, SessionApi, SessionApiAxiosParamCreator, SessionApiFactory, SessionApiFp, SessionStatus, SessionWrapper, ValidationError, addErrorInterceptor, addRequestInterceptor, addResponseInterceptor, appendBrokerFilterToURL, appendThemeToURL, applyErrorInterceptors, applyRequestInterceptors, applyResponseInterceptors, coerceEnumValue, convertToPlainObject, defaultConfig, generateCacheKey, generateRequestId, getCache, getConfig, getLogger, handleError, numberSchema, retryApiCall, stringSchema, unwrapAxiosResponse, validateParams };
9085
+ export { AccountStatus, ApiError, BrokerDataAccountTypeEnum, BrokerDataAssetTypeEnum, BrokerDataOrderSideEnum, BrokerDataPositionStatusEnum, BrokersApi, BrokersApiAxiosParamCreator, BrokersApiFactory, BrokersApiFp, BrokersWrapper, CompanyApi, CompanyApiAxiosParamCreator, CompanyApiFactory, CompanyApiFp, CompanyWrapper, Configuration, EventEmitter, FDXAccountStatus, FDXAccountType, FDXAssetType, FDXBalanceType, FDXOrderClass, FDXOrderEventType, FDXOrderGroupType, FDXOrderSide, FDXOrderStatus, FDXOrderType, FDXPositionSide, FDXPositionStatus, FDXSecurityIdType, FDXTimeInForce, FinaticConnect, FinaticError, PaginatedData, SessionApi, SessionApiAxiosParamCreator, SessionApiFactory, SessionApiFp, SessionStatus, SessionWrapper, ValidationError, addErrorInterceptor, addRequestInterceptor, addResponseInterceptor, appendBrokerFilterToURL, appendThemeToURL, applyErrorInterceptors, applyRequestInterceptors, applyResponseInterceptors, coerceEnumValue, convertToPlainObject, defaultConfig, generateCacheKey, generateRequestId, getCache, getConfig, getLogger, handleError, numberSchema, retryApiCall, stringSchema, unwrapAxiosResponse, validateParams };
9078
9086
  //# sourceMappingURL=index.mjs.map