@finatic/client 0.0.139 → 0.0.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +335 -446
  2. package/dist/index.d.ts +272 -515
  3. package/dist/index.js +531 -449
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +532 -449
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/types/core/client/ApiClient.d.ts +81 -27
  8. package/dist/types/core/client/FinaticConnect.d.ts +53 -103
  9. package/dist/types/index.d.ts +1 -2
  10. package/dist/types/mocks/MockApiClient.d.ts +2 -4
  11. package/dist/types/mocks/utils.d.ts +0 -5
  12. package/dist/types/types/api/auth.d.ts +12 -30
  13. package/dist/types/types/api/broker.d.ts +117 -1
  14. package/package.json +7 -3
  15. package/src/core/client/ApiClient.ts +1978 -0
  16. package/src/core/client/FinaticConnect.ts +1557 -0
  17. package/src/core/portal/PortalUI.ts +300 -0
  18. package/src/index.d.ts +23 -0
  19. package/src/index.ts +99 -0
  20. package/src/mocks/MockApiClient.ts +1032 -0
  21. package/src/mocks/MockDataProvider.ts +986 -0
  22. package/src/mocks/MockFactory.ts +97 -0
  23. package/src/mocks/utils.ts +133 -0
  24. package/src/themes/portalPresets.ts +1307 -0
  25. package/src/types/api/auth.ts +112 -0
  26. package/src/types/api/broker.ts +461 -0
  27. package/src/types/api/core.ts +53 -0
  28. package/src/types/api/errors.ts +35 -0
  29. package/src/types/api/orders.ts +45 -0
  30. package/src/types/api/portfolio.ts +59 -0
  31. package/src/types/common/pagination.ts +138 -0
  32. package/src/types/connect.ts +56 -0
  33. package/src/types/index.ts +25 -0
  34. package/src/types/portal.ts +214 -0
  35. package/src/types/ui/theme.ts +105 -0
  36. package/src/utils/brokerUtils.ts +85 -0
  37. package/src/utils/errors.ts +104 -0
  38. package/src/utils/events.ts +54 -0
  39. package/src/utils/themeUtils.ts +146 -0
package/dist/index.d.ts CHANGED
@@ -85,16 +85,6 @@ interface SessionInitResponse {
85
85
  expires_at: string;
86
86
  };
87
87
  }
88
- interface SessionResponseData {
89
- session_id: string;
90
- company_id: string;
91
- status: 'pending';
92
- expires_at: string;
93
- }
94
- interface SessionStartResponse {
95
- data: SessionResponseData;
96
- message: 'Session started successfully';
97
- }
98
88
  interface OtpRequestResponse {
99
89
  success: boolean;
100
90
  message: string;
@@ -113,17 +103,14 @@ interface OtpVerifyResponse {
113
103
  };
114
104
  }
115
105
  interface UserToken {
116
- accessToken: string;
117
- refreshToken: string;
118
- expiresIn: number;
119
106
  user_id: string;
120
- tokenType: string;
121
- scope: string;
122
107
  }
123
108
  interface SessionValidationResponse {
124
109
  valid: boolean;
125
110
  company_id: string;
126
111
  status: string;
112
+ is_sandbox: boolean;
113
+ environment: string;
127
114
  }
128
115
  interface SessionAuthenticateResponse {
129
116
  success: boolean;
@@ -154,23 +141,18 @@ interface TokenInfo {
154
141
  expiresAt: string;
155
142
  userId?: string;
156
143
  }
144
+ interface SessionResponseData {
145
+ session_id: string;
146
+ company_id: string;
147
+ status: string;
148
+ expires_at: string;
149
+ user_id?: string | null;
150
+ auto_login?: boolean;
151
+ }
157
152
  interface SessionResponse {
158
- data: {
159
- session_id: string;
160
- state: SessionState;
161
- device_info?: Record<string, string>;
162
- company_id?: string;
163
- status?: string;
164
- expires_at?: string;
165
- user_id?: string | null;
166
- auto_login?: boolean;
167
- access_token?: string;
168
- refresh_token?: string;
169
- expires_in?: number;
170
- token_type?: string;
171
- scope?: string;
172
- };
153
+ success: boolean;
173
154
  message: string;
155
+ data: SessionResponseData;
174
156
  }
175
157
  declare enum SessionState {
176
158
  PENDING = "PENDING",
@@ -297,7 +279,7 @@ interface BrokerOrderParams {
297
279
  broker: 'robinhood' | 'tasty_trade' | 'ninja_trader';
298
280
  order_id?: string;
299
281
  orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
300
- assetType: 'Stock' | 'Option' | 'Crypto' | 'Future';
282
+ assetType: 'equity' | 'equity_option' | 'crypto' | 'forex' | 'future' | 'future_option';
301
283
  action: 'Buy' | 'Sell';
302
284
  timeInForce: 'day' | 'gtc' | 'gtd' | 'ioc' | 'fok';
303
285
  accountNumber: string | number;
@@ -306,7 +288,7 @@ interface BrokerOrderParams {
306
288
  price?: number;
307
289
  stopPrice?: number;
308
290
  }
309
- interface BrokerExtras {
291
+ interface BrokerExtras$1 {
310
292
  robinhood?: {
311
293
  extendedHours?: boolean;
312
294
  marketHours?: 'regular_hours' | 'extended_hours';
@@ -491,6 +473,122 @@ interface DisconnectCompanyResponse {
491
473
  message: string;
492
474
  status_code: number;
493
475
  }
476
+ interface OrderFill {
477
+ id: string;
478
+ order_id: string;
479
+ leg_id: string | null;
480
+ price: number;
481
+ quantity: number;
482
+ executed_at: string;
483
+ execution_id: string | null;
484
+ trade_id: string | null;
485
+ venue: string | null;
486
+ commission_fee: number | null;
487
+ created_at: string;
488
+ updated_at: string;
489
+ }
490
+ interface OrderEvent {
491
+ id: string;
492
+ order_id: string;
493
+ order_group_id: string | null;
494
+ event_type: string | null;
495
+ event_time: string;
496
+ event_id: string | null;
497
+ order_status: string | null;
498
+ inferred: boolean;
499
+ confidence: number | null;
500
+ reason_code: string | null;
501
+ recorded_at: string | null;
502
+ }
503
+ interface OrderLeg {
504
+ id: string;
505
+ order_id: string;
506
+ leg_index: number;
507
+ asset_type: string;
508
+ broker_provided_symbol: string | null;
509
+ quantity: number;
510
+ filled_quantity: number | null;
511
+ avg_fill_price: number | null;
512
+ created_at: string | null;
513
+ updated_at: string | null;
514
+ }
515
+ interface OrderGroupOrder extends BrokerDataOrder {
516
+ legs: OrderLeg[];
517
+ }
518
+ interface OrderGroup {
519
+ id: string;
520
+ user_broker_connection_id: string | null;
521
+ created_at: string;
522
+ updated_at: string;
523
+ orders: OrderGroupOrder[];
524
+ }
525
+ interface PositionLot {
526
+ id: string;
527
+ position_id: string | null;
528
+ user_broker_connection_id: string;
529
+ broker_provided_account_id: string;
530
+ instrument_key: string;
531
+ asset_type: string | null;
532
+ side: 'long' | 'short' | null;
533
+ open_quantity: number;
534
+ closed_quantity: number;
535
+ remaining_quantity: number;
536
+ open_price: number;
537
+ close_price_avg: number | null;
538
+ cost_basis: number;
539
+ cost_basis_w_commission: number;
540
+ realized_pl: number;
541
+ realized_pl_w_commission: number;
542
+ lot_opened_at: string;
543
+ lot_closed_at: string | null;
544
+ position_group_id: string | null;
545
+ created_at: string;
546
+ updated_at: string;
547
+ position_lot_fills?: PositionLotFill[];
548
+ }
549
+ interface PositionLotFill {
550
+ id: string;
551
+ lot_id: string;
552
+ order_fill_id: string;
553
+ fill_price: number;
554
+ fill_quantity: number;
555
+ executed_at: string;
556
+ commission_share: number | null;
557
+ created_at: string;
558
+ updated_at: string;
559
+ }
560
+ interface OrderFillsFilter {
561
+ connection_id?: string;
562
+ limit?: number;
563
+ offset?: number;
564
+ }
565
+ interface OrderEventsFilter {
566
+ connection_id?: string;
567
+ limit?: number;
568
+ offset?: number;
569
+ }
570
+ interface OrderGroupsFilter {
571
+ broker_id?: string;
572
+ connection_id?: string;
573
+ limit?: number;
574
+ offset?: number;
575
+ created_after?: string;
576
+ created_before?: string;
577
+ }
578
+ interface PositionLotsFilter {
579
+ broker_id?: string;
580
+ connection_id?: string;
581
+ account_id?: string;
582
+ symbol?: string;
583
+ position_id?: string;
584
+ limit?: number;
585
+ offset?: number;
586
+ }
587
+ interface PositionLotFillsFilter {
588
+ connection_id?: string;
589
+ limit?: number;
590
+ offset?: number;
591
+ }
494
592
 
495
593
  /**
496
594
  * Order-related types
@@ -1027,9 +1125,6 @@ declare class ApiClient {
1027
1125
  protected currentSessionState: SessionState | null;
1028
1126
  protected currentSessionId: string | null;
1029
1127
  private tradingContext;
1030
- private tokenInfo;
1031
- private refreshPromise;
1032
- private readonly REFRESH_BUFFER_MINUTES;
1033
1128
  private companyId;
1034
1129
  private csrfToken;
1035
1130
  constructor(baseUrl: string, deviceInfo?: DeviceInfo$1);
@@ -1050,33 +1145,24 @@ declare class ApiClient {
1050
1145
  */
1051
1146
  getCurrentCsrfToken(): string | null;
1052
1147
  /**
1053
- * Store tokens after successful authentication
1054
- */
1055
- setTokens(accessToken: string, refreshToken: string, expiresAt: string, userId?: string): void;
1056
- /**
1057
- * Get the current access token, refreshing if necessary
1148
+ * Get a valid access token (session-based auth - no tokens needed)
1058
1149
  */
1059
1150
  getValidAccessToken(): Promise<string>;
1060
1151
  /**
1061
- * Check if the current token is expired or about to expire
1152
+ * Perform the actual Supabase session refresh
1062
1153
  */
1063
- private isTokenExpired;
1064
1154
  /**
1065
- * Refresh the access token using the refresh token
1066
- */
1067
- private refreshTokens;
1068
- /**
1069
- * Perform the actual token refresh request
1070
- */
1071
- private performTokenRefresh;
1072
- /**
1073
- * Clear stored tokens (useful for logout)
1155
+ * Clear session tokens (useful for logout)
1074
1156
  */
1075
1157
  clearTokens(): void;
1076
1158
  /**
1077
- * Get current token info (for debugging/testing)
1159
+ * Get current session info (for debugging/testing) - session-based auth
1078
1160
  */
1079
- getTokenInfo(): TokenInfo | null;
1161
+ getTokenInfo(): {
1162
+ accessToken: string;
1163
+ refreshToken: string;
1164
+ expiresAt: number;
1165
+ } | null;
1080
1166
  /**
1081
1167
  * Make a request to the API.
1082
1168
  */
@@ -1110,23 +1196,21 @@ declare class ApiClient {
1110
1196
  orderQty: number;
1111
1197
  action: 'Buy' | 'Sell';
1112
1198
  orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
1113
- assetType: 'Stock' | 'Option' | 'Crypto' | 'Future';
1114
- }, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
1199
+ assetType: 'equity' | 'equity_option' | 'crypto' | 'forex' | 'future' | 'future_option';
1200
+ }, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
1115
1201
  cancelBrokerOrder(orderId: string, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
1116
1202
  modifyBrokerOrder(orderId: string, params: Partial<BrokerOrderParams>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
1117
1203
  setBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader'): void;
1118
1204
  setAccount(accountNumber: string, accountId?: string): void;
1119
- getTradingContext(): TradingContext;
1120
- clearTradingContext(): void;
1121
- placeStockMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
1122
- placeStockLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
1123
- placeStockStopOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
1124
- placeCryptoMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1125
- placeCryptoLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1126
- placeOptionsMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options: OptionsOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1127
- placeOptionsLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, options: OptionsOrderOptions, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1128
- placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1129
- placeFuturesLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1205
+ placeStockMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
1206
+ placeStockLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
1207
+ placeStockStopOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
1208
+ placeCryptoMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1209
+ placeCryptoLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1210
+ placeOptionsMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options: OptionsOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1211
+ placeOptionsLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, options: OptionsOrderOptions, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1212
+ placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1213
+ placeFuturesLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
1130
1214
  private buildOrderRequestBody;
1131
1215
  private buildModifyRequestBody;
1132
1216
  private applyBrokerDefaults;
@@ -1137,6 +1221,7 @@ declare class ApiClient {
1137
1221
  getCurrentSessionState(): SessionState | null;
1138
1222
  /**
1139
1223
  * Refresh the current session to extend its lifetime
1224
+ * Note: This now uses Supabase session refresh instead of custom endpoint
1140
1225
  */
1141
1226
  refreshSession(): Promise<{
1142
1227
  success: boolean;
@@ -1223,6 +1308,74 @@ declare class ApiClient {
1223
1308
  * @returns Promise with disconnect response
1224
1309
  */
1225
1310
  disconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
1311
+ /**
1312
+ * Get order fills for a specific order
1313
+ * @param orderId - The order ID
1314
+ * @param filter - Optional filter parameters
1315
+ * @returns Promise with order fills response
1316
+ */
1317
+ getOrderFills(orderId: string, filter?: OrderFillsFilter): Promise<{
1318
+ _id: string;
1319
+ response_data: OrderFill[];
1320
+ message: string;
1321
+ status_code: number;
1322
+ warnings: null;
1323
+ errors: null;
1324
+ }>;
1325
+ /**
1326
+ * Get order events for a specific order
1327
+ * @param orderId - The order ID
1328
+ * @param filter - Optional filter parameters
1329
+ * @returns Promise with order events response
1330
+ */
1331
+ getOrderEvents(orderId: string, filter?: OrderEventsFilter): Promise<{
1332
+ _id: string;
1333
+ response_data: OrderEvent[];
1334
+ message: string;
1335
+ status_code: number;
1336
+ warnings: null;
1337
+ errors: null;
1338
+ }>;
1339
+ /**
1340
+ * Get order groups
1341
+ * @param filter - Optional filter parameters
1342
+ * @returns Promise with order groups response
1343
+ */
1344
+ getOrderGroups(filter?: OrderGroupsFilter): Promise<{
1345
+ _id: string;
1346
+ response_data: OrderGroup[];
1347
+ message: string;
1348
+ status_code: number;
1349
+ warnings: null;
1350
+ errors: null;
1351
+ }>;
1352
+ /**
1353
+ * Get position lots (tax lots for positions)
1354
+ * @param filter - Optional filter parameters
1355
+ * @returns Promise with position lots response
1356
+ */
1357
+ getPositionLots(filter?: PositionLotsFilter): Promise<{
1358
+ _id: string;
1359
+ response_data: PositionLot[];
1360
+ message: string;
1361
+ status_code: number;
1362
+ warnings: null;
1363
+ errors: null;
1364
+ }>;
1365
+ /**
1366
+ * Get position lot fills for a specific lot
1367
+ * @param lotId - The position lot ID
1368
+ * @param filter - Optional filter parameters
1369
+ * @returns Promise with position lot fills response
1370
+ */
1371
+ getPositionLotFills(lotId: string, filter?: PositionLotFillsFilter): Promise<{
1372
+ _id: string;
1373
+ response_data: PositionLotFill[];
1374
+ message: string;
1375
+ status_code: number;
1376
+ warnings: null;
1377
+ errors: null;
1378
+ }>;
1226
1379
  }
1227
1380
 
1228
1381
  type EventCallback = (...args: any[]) => void;
@@ -1262,47 +1415,41 @@ declare class FinaticConnect extends EventEmitter {
1262
1415
  private readonly SESSION_REFRESH_BUFFER_HOURS;
1263
1416
  private sessionStartTime;
1264
1417
  constructor(options: FinaticConnectOptions, deviceInfo?: DeviceInfo);
1265
- private handleTokens;
1418
+ private linkUserToSession;
1266
1419
  /**
1267
- * Check if the user is fully authenticated (has userId, access token, and refresh token)
1268
- * @returns True if the user is fully authenticated and ready for API calls
1420
+ * Store user ID for authentication state persistence
1421
+ * @param userId - The user ID to store
1269
1422
  */
1270
- isAuthed(): boolean;
1423
+ private storeUserId;
1271
1424
  /**
1272
- * Check if the client is authenticated (alias for isAuthed for consistency)
1273
- * @returns True if authenticated, false otherwise
1425
+ * Check if the user is fully authenticated (has userId in session context)
1426
+ * @returns True if the user is fully authenticated and ready for API calls
1274
1427
  */
1275
- is_authenticated(): boolean;
1428
+ isAuthenticated(): Promise<boolean>;
1276
1429
  /**
1277
1430
  * Get user's orders with pagination and optional filtering
1278
1431
  * @param params - Query parameters including page, perPage, and filters
1279
1432
  * @returns Promise with paginated result that supports navigation
1280
1433
  */
1281
- getOrders(params?: {
1282
- page?: number;
1283
- perPage?: number;
1284
- filter?: OrdersFilter;
1285
- }): Promise<PaginatedResult<BrokerDataOrder[]>>;
1434
+ getOrders(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
1286
1435
  /**
1287
1436
  * Get user's positions with pagination and optional filtering
1288
1437
  * @param params - Query parameters including page, perPage, and filters
1289
1438
  * @returns Promise with paginated result that supports navigation
1290
1439
  */
1291
- getPositions(params?: {
1292
- page?: number;
1293
- perPage?: number;
1294
- filter?: PositionsFilter;
1295
- }): Promise<PaginatedResult<BrokerDataPosition[]>>;
1440
+ getPositions(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
1296
1441
  /**
1297
1442
  * Get user's accounts with pagination and optional filtering
1298
1443
  * @param params - Query parameters including page, perPage, and filters
1299
1444
  * @returns Promise with paginated result that supports navigation
1300
1445
  */
1301
- getAccounts(params?: {
1302
- page?: number;
1303
- perPage?: number;
1304
- filter?: AccountsFilter;
1305
- }): Promise<PaginatedResult<BrokerDataAccount[]>>;
1446
+ getAccounts(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
1447
+ /**
1448
+ * Get user's balances with pagination and optional filtering
1449
+ * @param params - Query parameters including page, perPage, and filters
1450
+ * @returns Promise with paginated result that supports navigation
1451
+ */
1452
+ getBalances(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
1306
1453
  /**
1307
1454
  * Initialize the Finatic Connect SDK
1308
1455
  * @param token - The portal token from your backend
@@ -1322,7 +1469,6 @@ declare class FinaticConnect extends EventEmitter {
1322
1469
  * Get the user and tokens for a completed session
1323
1470
  * @returns Promise with user information and tokens
1324
1471
  */
1325
- getSessionUser(): Promise<Record<string, any>>;
1326
1472
  private initializeWithUser;
1327
1473
  /**
1328
1474
  * Handle company access error by opening the portal
@@ -1348,20 +1494,7 @@ declare class FinaticConnect extends EventEmitter {
1348
1494
  * Place a new order using the broker order API
1349
1495
  * @param order - Order details with broker context
1350
1496
  */
1351
- placeOrder(order: {
1352
- symbol: string;
1353
- quantity: number;
1354
- side: 'buy' | 'sell';
1355
- orderType: 'market' | 'limit' | 'stop' | 'stop_limit';
1356
- price?: number;
1357
- stopPrice?: number;
1358
- timeInForce: 'day' | 'gtc' | 'gtd' | 'ioc' | 'fok';
1359
- broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader';
1360
- accountNumber?: string;
1361
- assetType?: 'Stock' | 'Option' | 'Crypto' | 'Future';
1362
- order_id?: string;
1363
- connection_id?: string;
1364
- }): Promise<OrderResponse>;
1497
+ placeOrder(order: BrokerOrderParams, extras?: BrokerExtras): Promise<OrderResponse>;
1365
1498
  /**
1366
1499
  * Cancel a broker order
1367
1500
  * @param orderId - The order ID to cancel
@@ -1386,25 +1519,6 @@ declare class FinaticConnect extends EventEmitter {
1386
1519
  side?: 'Buy' | 'Sell';
1387
1520
  order_id?: string;
1388
1521
  }>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', connection_id?: string): Promise<OrderResponse>;
1389
- /**
1390
- * Set the broker context for trading
1391
- * @param broker - The broker to use for trading
1392
- */
1393
- setTradingContextBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader' | 'interactive_brokers' | 'tradestation'): void;
1394
- /**
1395
- * Set the account context for trading
1396
- * @param accountNumber - The account number to use for trading
1397
- * @param accountId - Optional account ID
1398
- */
1399
- setTradingContextAccount(accountNumber: string, accountId?: string): void;
1400
- /**
1401
- * Get the current trading context
1402
- */
1403
- getTradingContext(): TradingContext;
1404
- /**
1405
- * Clear the trading context
1406
- */
1407
- clearTradingContext(): void;
1408
1522
  /**
1409
1523
  * Place a stock market order (convenience method)
1410
1524
  */
@@ -1446,7 +1560,7 @@ declare class FinaticConnect extends EventEmitter {
1446
1560
  * @returns The current user ID or undefined if not authenticated
1447
1561
  * @throws AuthenticationError if user is not authenticated
1448
1562
  */
1449
- getUserId(): string | null;
1563
+ getUserId(): Promise<string | null>;
1450
1564
  /**
1451
1565
  * Get list of supported brokers
1452
1566
  * @returns Promise with array of broker information
@@ -1502,50 +1616,6 @@ declare class FinaticConnect extends EventEmitter {
1502
1616
  * @returns Promise with array of positions for the broker
1503
1617
  */
1504
1618
  getPositionsByBroker(brokerId: string): Promise<BrokerDataPosition[]>;
1505
- /**
1506
- * Get a specific page of orders with pagination metadata
1507
- * @param page - Page number (default: 1)
1508
- * @param perPage - Items per page (default: 100)
1509
- * @param filter - Optional filter parameters
1510
- * @returns Promise with paginated orders result
1511
- */
1512
- getOrdersPage(page?: number, perPage?: number, filter?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
1513
- /**
1514
- * Get a specific page of positions with pagination metadata
1515
- * @param page - Page number (default: 1)
1516
- * @param perPage - Items per page (default: 100)
1517
- * @param filter - Optional filter parameters
1518
- * @returns Promise with paginated positions result
1519
- */
1520
- getPositionsPage(page?: number, perPage?: number, filter?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
1521
- /**
1522
- * Get a specific page of accounts with pagination metadata
1523
- * @param page - Page number (default: 1)
1524
- * @param perPage - Items per page (default: 100)
1525
- * @param filter - Optional filter parameters
1526
- * @returns Promise with paginated accounts result
1527
- */
1528
- getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
1529
- getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
1530
- /**
1531
- * Get the next page of orders
1532
- * @param previousResult - The previous paginated result
1533
- * @returns Promise with next page of orders or null if no more pages
1534
- */
1535
- getNextOrdersPage(previousResult: PaginatedResult<BrokerDataOrder[]>): Promise<PaginatedResult<BrokerDataOrder[]> | null>;
1536
- /**
1537
- * Get the next page of positions
1538
- * @param previousResult - The previous paginated result
1539
- * @returns Promise with next page of positions or null if no more pages
1540
- */
1541
- getNextPositionsPage(previousResult: PaginatedResult<BrokerDataPosition[]>): Promise<PaginatedResult<BrokerDataPosition[]> | null>;
1542
- /**
1543
- * Get the next page of accounts
1544
- * @param previousResult - The previous paginated result
1545
- * @returns Promise with next page of accounts or null if no more pages
1546
- */
1547
- getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
1548
- getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
1549
1619
  /**
1550
1620
  * Get all orders across all pages (convenience method)
1551
1621
  * @param filter - Optional filter parameters
@@ -1610,6 +1680,39 @@ declare class FinaticConnect extends EventEmitter {
1610
1680
  * @throws AuthenticationError if user is not authenticated
1611
1681
  */
1612
1682
  disconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
1683
+ /**
1684
+ * Get order fills for a specific order
1685
+ * @param orderId - The order ID
1686
+ * @param filter - Optional filter parameters
1687
+ * @returns Promise with order fills response
1688
+ */
1689
+ getOrderFills(orderId: string, filter?: OrderFillsFilter): Promise<OrderFill[]>;
1690
+ /**
1691
+ * Get order events for a specific order
1692
+ * @param orderId - The order ID
1693
+ * @param filter - Optional filter parameters
1694
+ * @returns Promise with order events response
1695
+ */
1696
+ getOrderEvents(orderId: string, filter?: OrderEventsFilter): Promise<OrderEvent[]>;
1697
+ /**
1698
+ * Get order groups
1699
+ * @param filter - Optional filter parameters
1700
+ * @returns Promise with order groups response
1701
+ */
1702
+ getOrderGroups(filter?: OrderGroupsFilter): Promise<OrderGroup[]>;
1703
+ /**
1704
+ * Get position lots (tax lots for positions)
1705
+ * @param filter - Optional filter parameters
1706
+ * @returns Promise with position lots response
1707
+ */
1708
+ getPositionLots(filter?: PositionLotsFilter): Promise<PositionLot[]>;
1709
+ /**
1710
+ * Get position lot fills for a specific lot
1711
+ * @param lotId - The position lot ID
1712
+ * @param filter - Optional filter parameters
1713
+ * @returns Promise with position lot fills response
1714
+ */
1715
+ getPositionLotFills(lotId: string, filter?: PositionLotFillsFilter): Promise<PositionLotFill[]>;
1613
1716
  }
1614
1717
 
1615
1718
  /**
@@ -1648,351 +1751,5 @@ declare function createCustomThemeFromPreset(preset: string, modifications: Part
1648
1751
 
1649
1752
  declare const portalThemePresets: Record<string, PortalThemeConfig>;
1650
1753
 
1651
- /**
1652
- * Configuration for mock behavior
1653
- */
1654
- interface MockConfig {
1655
- delay?: number;
1656
- scenario?: MockScenario;
1657
- customData?: Record<string, any>;
1658
- mockApiOnly?: boolean;
1659
- }
1660
- /**
1661
- * Different mock scenarios for testing
1662
- */
1663
- type MockScenario = 'success' | 'error' | 'network_error' | 'rate_limit' | 'auth_failure';
1664
- /**
1665
- * Mock data provider for Finatic API endpoints
1666
- */
1667
- declare class MockDataProvider {
1668
- private config;
1669
- private sessionData;
1670
- private userTokens;
1671
- constructor(config?: MockConfig);
1672
- /**
1673
- * Get a random delay between min and max milliseconds
1674
- */
1675
- private getRandomDelay;
1676
- /**
1677
- * Simulate network delay
1678
- */
1679
- simulateDelay(): Promise<void>;
1680
- /**
1681
- * Generate a realistic session ID
1682
- */
1683
- private generateSessionId;
1684
- /**
1685
- * Generate a realistic user ID
1686
- */
1687
- private generateUserId;
1688
- /**
1689
- * Generate a realistic company ID
1690
- */
1691
- private generateCompanyId;
1692
- /**
1693
- * Generate mock tokens
1694
- */
1695
- private generateTokens;
1696
- mockStartSession(token: string, userId?: string): Promise<SessionResponse>;
1697
- mockRequestOtp(sessionId: string, email: string): Promise<OtpRequestResponse>;
1698
- mockVerifyOtp(sessionId: string, otp: string): Promise<OtpVerifyResponse>;
1699
- mockAuthenticateDirectly(sessionId: string, userId: string): Promise<SessionAuthenticateResponse>;
1700
- mockGetPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
1701
- mockValidatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
1702
- mockCompletePortalSession(sessionId: string): Promise<PortalUrlResponse>;
1703
- mockRefreshToken(refreshToken: string): Promise<RefreshTokenResponse>;
1704
- mockGetBrokerList(): Promise<{
1705
- _id: string;
1706
- response_data: BrokerInfo[];
1707
- message: string;
1708
- status_code: number;
1709
- warnings: null;
1710
- errors: null;
1711
- }>;
1712
- mockGetBrokerAccounts(): Promise<{
1713
- _id: string;
1714
- response_data: BrokerAccount[];
1715
- message: string;
1716
- status_code: number;
1717
- warnings: null;
1718
- errors: null;
1719
- }>;
1720
- mockGetBrokerConnections(): Promise<{
1721
- _id: string;
1722
- response_data: BrokerConnection[];
1723
- message: string;
1724
- status_code: number;
1725
- warnings: null;
1726
- errors: null;
1727
- }>;
1728
- mockGetOrders(filter?: OrdersFilter): Promise<{
1729
- data: Order[];
1730
- }>;
1731
- mockGetBrokerOrders(filter?: OrdersFilter): Promise<{
1732
- data: BrokerDataOrder[];
1733
- }>;
1734
- mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
1735
- data: BrokerDataPosition[];
1736
- }>;
1737
- mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
1738
- data: BrokerBalance[];
1739
- }>;
1740
- mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
1741
- data: BrokerAccount[];
1742
- }>;
1743
- mockPlaceOrder(order: BrokerOrderParams): Promise<OrderResponse>;
1744
- /**
1745
- * Get stored session data
1746
- */
1747
- getSessionData(sessionId: string): any;
1748
- /**
1749
- * Get stored user token
1750
- */
1751
- getUserToken(sessionId: string): UserToken | undefined;
1752
- /**
1753
- * Clear all stored data
1754
- */
1755
- clearData(): void;
1756
- /**
1757
- * Update configuration
1758
- */
1759
- updateConfig(config: Partial<MockConfig>): void;
1760
- setScenario(scenario: MockScenario): void;
1761
- getScenario(): MockScenario;
1762
- private applyOrderFilters;
1763
- private applyBrokerOrderFilters;
1764
- private applyBrokerPositionFilters;
1765
- private applyBrokerAccountFilters;
1766
- private applyBrokerBalanceFilters;
1767
- /**
1768
- * Generate mock orders with diverse data
1769
- */
1770
- private generateMockOrders;
1771
- /**
1772
- * Generate mock positions with diverse data
1773
- */
1774
- private generateMockPositions;
1775
- /**
1776
- * Generate mock accounts with diverse data
1777
- */
1778
- private generateMockAccounts;
1779
- /**
1780
- * Mock disconnect company method
1781
- * @param connectionId - The connection ID to disconnect
1782
- * @returns Promise with mock disconnect response
1783
- */
1784
- mockDisconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
1785
- }
1786
-
1787
- /**
1788
- * Mock API Client that implements the same interface as the real ApiClient
1789
- * but returns mock data instead of making HTTP requests
1790
- */
1791
- declare class MockApiClient {
1792
- private readonly baseUrl;
1793
- protected readonly deviceInfo?: DeviceInfo$1;
1794
- protected currentSessionState: SessionState | null;
1795
- protected currentSessionId: string | null;
1796
- private tradingContext;
1797
- private tokenInfo;
1798
- private refreshPromise;
1799
- private readonly REFRESH_BUFFER_MINUTES;
1800
- private companyId;
1801
- private csrfToken;
1802
- private mockDataProvider;
1803
- private readonly mockApiOnly;
1804
- constructor(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig);
1805
- /**
1806
- * Store tokens after successful authentication
1807
- */
1808
- setTokens(accessToken: string, refreshToken: string, expiresAt: string, userId?: string): void;
1809
- /**
1810
- * Get the current access token, refreshing if necessary
1811
- */
1812
- getValidAccessToken(): Promise<string>;
1813
- /**
1814
- * Check if the current token is expired or about to expire
1815
- */
1816
- private isTokenExpired;
1817
- /**
1818
- * Refresh the access token using the refresh token
1819
- */
1820
- private refreshTokens;
1821
- /**
1822
- * Perform the actual token refresh request
1823
- */
1824
- private performTokenRefresh;
1825
- /**
1826
- * Clear stored tokens (useful for logout)
1827
- */
1828
- clearTokens(): void;
1829
- /**
1830
- * Get current token info (for debugging/testing)
1831
- */
1832
- getTokenInfo(): TokenInfo | null;
1833
- /**
1834
- * Set session context (session ID, company ID, CSRF token)
1835
- */
1836
- setSessionContext(sessionId: string, companyId: string, csrfToken?: string): void;
1837
- /**
1838
- * Get the current session ID
1839
- */
1840
- getCurrentSessionId(): string | null;
1841
- /**
1842
- * Get the current company ID
1843
- */
1844
- getCurrentCompanyId(): string | null;
1845
- /**
1846
- * Get the current CSRF token
1847
- */
1848
- getCurrentCsrfToken(): string | null;
1849
- startSession(token: string, userId?: string): Promise<SessionResponse>;
1850
- requestOtp(sessionId: string, email: string): Promise<OtpRequestResponse>;
1851
- verifyOtp(sessionId: string, otp: string): Promise<OtpVerifyResponse>;
1852
- authenticateDirectly(sessionId: string, userId: string): Promise<SessionAuthenticateResponse>;
1853
- getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
1854
- validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
1855
- completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
1856
- getOrders(filter?: OrdersFilter): Promise<{
1857
- data: Order[];
1858
- }>;
1859
- placeOrder(order: BrokerOrderParams): Promise<void>;
1860
- placeBrokerOrder(params: Partial<BrokerOrderParams> & {
1861
- symbol: string;
1862
- orderQty: number;
1863
- action: 'Buy' | 'Sell';
1864
- orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
1865
- assetType: 'Stock' | 'Option' | 'Crypto' | 'Future';
1866
- }, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
1867
- cancelBrokerOrder(orderId: string, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
1868
- modifyBrokerOrder(orderId: string, params: Partial<BrokerOrderParams>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
1869
- setBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader'): void;
1870
- setAccount(accountNumber: string, accountId?: string): void;
1871
- getTradingContext(): TradingContext;
1872
- clearTradingContext(): void;
1873
- placeStockMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1874
- placeStockLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1875
- placeStockStopOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1876
- placeCryptoMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1877
- placeCryptoLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1878
- placeOptionsMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options: OptionsOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1879
- placeOptionsLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, options: OptionsOrderOptions, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1880
- placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1881
- placeFuturesLimitOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
1882
- getUserToken(sessionId: string): Promise<UserToken>;
1883
- getCurrentSessionState(): SessionState | null;
1884
- getBrokerList(): Promise<{
1885
- _id: string;
1886
- response_data: BrokerInfo[];
1887
- message: string;
1888
- status_code: number;
1889
- warnings: null;
1890
- errors: null;
1891
- }>;
1892
- getBrokerAccounts(options?: BrokerDataOptions): Promise<{
1893
- _id: string;
1894
- response_data: BrokerAccount[];
1895
- message: string;
1896
- status_code: number;
1897
- warnings: null;
1898
- errors: null;
1899
- }>;
1900
- getBrokerOrders(options?: BrokerDataOptions): Promise<{
1901
- _id: string;
1902
- response_data: BrokerOrder[];
1903
- message: string;
1904
- status_code: number;
1905
- warnings: null;
1906
- errors: null;
1907
- }>;
1908
- getBrokerPositions(options?: BrokerDataOptions): Promise<{
1909
- _id: string;
1910
- response_data: BrokerPosition[];
1911
- message: string;
1912
- status_code: number;
1913
- warnings: null;
1914
- errors: null;
1915
- }>;
1916
- getBrokerOrdersWithFilter(filter?: OrdersFilter): Promise<{
1917
- data: BrokerDataOrder[];
1918
- }>;
1919
- getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
1920
- data: BrokerDataPosition[];
1921
- }>;
1922
- getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
1923
- data: BrokerBalance[];
1924
- }>;
1925
- getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
1926
- data: BrokerAccount[];
1927
- }>;
1928
- getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
1929
- getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
1930
- getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
1931
- getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
1932
- getBrokerConnections(): Promise<{
1933
- _id: string;
1934
- response_data: BrokerConnection[];
1935
- message: string;
1936
- status_code: number;
1937
- warnings: null;
1938
- errors: null;
1939
- }>;
1940
- /**
1941
- * Mock disconnect company method
1942
- * @param connectionId - The connection ID to disconnect
1943
- * @returns Promise with mock disconnect response
1944
- */
1945
- disconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
1946
- getMockDataProvider(): MockDataProvider;
1947
- clearMockData(): void;
1948
- /**
1949
- * Check if this is a mock client
1950
- * @returns true if this is a mock client
1951
- */
1952
- isMockClient(): boolean;
1953
- }
1954
-
1955
- /**
1956
- * Factory class for creating API clients (real or mock)
1957
- */
1958
- declare class MockFactory {
1959
- /**
1960
- * Create an API client based on environment configuration
1961
- * @param baseUrl - The base URL for the API
1962
- * @param deviceInfo - Optional device information
1963
- * @param mockConfig - Optional mock configuration (only used if mocks are enabled)
1964
- * @returns ApiClient or MockApiClient instance
1965
- */
1966
- static createApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig): ApiClient | MockApiClient;
1967
- /**
1968
- * Force create a mock API client regardless of environment settings
1969
- * @param baseUrl - The base URL for the API
1970
- * @param deviceInfo - Optional device information
1971
- * @param mockConfig - Optional mock configuration
1972
- * @returns MockApiClient instance
1973
- */
1974
- static createMockApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig): MockApiClient;
1975
- /**
1976
- * Force create a real API client regardless of environment settings
1977
- * @param baseUrl - The base URL for the API
1978
- * @param deviceInfo - Optional device information
1979
- * @returns ApiClient instance
1980
- */
1981
- static createRealApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1): ApiClient;
1982
- /**
1983
- * Check if mocks are currently enabled
1984
- * @returns boolean indicating if mocks are enabled
1985
- */
1986
- static isMockMode(): boolean;
1987
- /**
1988
- * Get current mock configuration
1989
- * @returns Mock configuration object
1990
- */
1991
- static getMockConfig(): {
1992
- enabled: boolean;
1993
- delay?: number;
1994
- };
1995
- }
1996
-
1997
- export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, MockFactory, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, TradingNotEnabledError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
1998
- export type { AccountsFilter, ApiConfig, ApiResponse, BalancesFilter, BrokerAccount, BrokerBalance, BrokerConnection, BrokerDataAccount, BrokerDataOptions, BrokerDataOrder, BrokerDataPosition, BrokerExtras, BrokerInfo, BrokerOrder, BrokerOrderParams, BrokerPosition, CryptoOrderOptions, DeviceInfo$1 as DeviceInfo, FilteredAccountsResponse, FilteredBalancesResponse, FilteredOrdersResponse, FilteredPositionsResponse, FinaticConnectOptions, FinaticUserToken, Holding, OptionsOrder, OptionsOrderOptions, Order, OrderNotFoundError, OrderResponse, OrdersFilter, OtpRequestResponse, OtpVerifyResponse, PerformanceMetrics, PortalMessage, PortalProps, PortalResponse, PortalTheme, PortalThemeConfig, PortalThemePreset, PortalUrlResponse, Portfolio, PortfolioSnapshot, PositionsFilter, RefreshTokenRequest, RefreshTokenResponse, RequestHeaders, SessionAuthenticateResponse, SessionInitResponse, SessionResponse, SessionStartResponse, SessionStatus, SessionValidationResponse, TokenInfo, TradeAccessDeniedError, TradingContext, UserToken, ValidationError };
1754
+ export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, TradingNotEnabledError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
1755
+ export type { AccountsFilter, ApiConfig, ApiResponse, BalancesFilter, BrokerAccount, BrokerBalance, BrokerConnection, BrokerDataAccount, BrokerDataOptions, BrokerDataOrder, BrokerDataPosition, BrokerExtras$1 as BrokerExtras, BrokerInfo, BrokerOrder, BrokerOrderParams, BrokerPosition, CryptoOrderOptions, DeviceInfo$1 as DeviceInfo, FilteredAccountsResponse, FilteredBalancesResponse, FilteredOrdersResponse, FilteredPositionsResponse, FinaticConnectOptions, FinaticUserToken, Holding, OptionsOrder, OptionsOrderOptions, Order, OrderEvent, OrderEventsFilter, OrderFill, OrderFillsFilter, OrderGroup, OrderGroupOrder, OrderGroupsFilter, OrderLeg, OrderNotFoundError, OrderResponse, OrdersFilter, OtpRequestResponse, OtpVerifyResponse, PerformanceMetrics, PortalMessage, PortalProps, PortalResponse, PortalTheme, PortalThemeConfig, PortalThemePreset, PortalUrlResponse, Portfolio, PortfolioSnapshot, PositionLot, PositionLotFill, PositionLotFillsFilter, PositionLotsFilter, PositionsFilter, RefreshTokenRequest, RefreshTokenResponse, RequestHeaders, SessionAuthenticateResponse, SessionInitResponse, SessionResponse, SessionStatus, SessionValidationResponse, TokenInfo, TradeAccessDeniedError, TradingContext, UserToken, ValidationError };