@finatic/client 0.0.138 → 0.0.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +278 -461
- package/dist/index.d.ts +59 -516
- package/dist/index.js +337 -456
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +338 -456
- package/dist/index.mjs.map +1 -1
- package/dist/types/core/client/ApiClient.d.ts +12 -26
- package/dist/types/core/client/FinaticConnect.d.ts +20 -103
- package/dist/types/index.d.ts +1 -2
- package/dist/types/mocks/MockApiClient.d.ts +2 -4
- package/dist/types/mocks/utils.d.ts +0 -5
- package/dist/types/types/api/auth.d.ts +12 -30
- package/dist/types/types/api/broker.d.ts +1 -1
- package/dist/types/types/connect.d.ts +4 -1
- package/package.json +7 -3
- package/src/core/client/ApiClient.ts +1721 -0
- package/src/core/client/FinaticConnect.ts +1476 -0
- package/src/core/portal/PortalUI.ts +300 -0
- package/src/index.d.ts +23 -0
- package/src/index.ts +87 -0
- package/src/mocks/MockApiClient.ts +1032 -0
- package/src/mocks/MockDataProvider.ts +986 -0
- package/src/mocks/MockFactory.ts +97 -0
- package/src/mocks/utils.ts +133 -0
- package/src/themes/portalPresets.ts +1307 -0
- package/src/types/api/auth.ts +112 -0
- package/src/types/api/broker.ts +330 -0
- package/src/types/api/core.ts +53 -0
- package/src/types/api/errors.ts +35 -0
- package/src/types/api/orders.ts +45 -0
- package/src/types/api/portfolio.ts +59 -0
- package/src/types/common/pagination.ts +138 -0
- package/src/types/connect.ts +56 -0
- package/src/types/index.ts +25 -0
- package/src/types/portal.ts +214 -0
- package/src/types/ui/theme.ts +105 -0
- package/src/utils/brokerUtils.ts +85 -0
- package/src/utils/errors.ts +104 -0
- package/src/utils/events.ts +54 -0
- 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
|
-
|
|
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: '
|
|
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';
|
|
@@ -936,7 +918,10 @@ interface PortalMessage {
|
|
|
936
918
|
}
|
|
937
919
|
interface PortalOptions {
|
|
938
920
|
/** Callback when user successfully connects */
|
|
939
|
-
onSuccess?: (userId: string
|
|
921
|
+
onSuccess?: (userId: string, tokens?: {
|
|
922
|
+
access_token?: string;
|
|
923
|
+
refresh_token?: string;
|
|
924
|
+
}) => void;
|
|
940
925
|
/** Callback when an error occurs */
|
|
941
926
|
onError?: (error: Error) => void;
|
|
942
927
|
/** Callback when the portal is closed */
|
|
@@ -1024,9 +1009,6 @@ declare class ApiClient {
|
|
|
1024
1009
|
protected currentSessionState: SessionState | null;
|
|
1025
1010
|
protected currentSessionId: string | null;
|
|
1026
1011
|
private tradingContext;
|
|
1027
|
-
private tokenInfo;
|
|
1028
|
-
private refreshPromise;
|
|
1029
|
-
private readonly REFRESH_BUFFER_MINUTES;
|
|
1030
1012
|
private companyId;
|
|
1031
1013
|
private csrfToken;
|
|
1032
1014
|
constructor(baseUrl: string, deviceInfo?: DeviceInfo$1);
|
|
@@ -1047,33 +1029,24 @@ declare class ApiClient {
|
|
|
1047
1029
|
*/
|
|
1048
1030
|
getCurrentCsrfToken(): string | null;
|
|
1049
1031
|
/**
|
|
1050
|
-
*
|
|
1051
|
-
*/
|
|
1052
|
-
setTokens(accessToken: string, refreshToken: string, expiresAt: string, userId?: string): void;
|
|
1053
|
-
/**
|
|
1054
|
-
* Get the current access token, refreshing if necessary
|
|
1032
|
+
* Get a valid access token (session-based auth - no tokens needed)
|
|
1055
1033
|
*/
|
|
1056
1034
|
getValidAccessToken(): Promise<string>;
|
|
1057
1035
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*/
|
|
1060
|
-
private isTokenExpired;
|
|
1061
|
-
/**
|
|
1062
|
-
* Refresh the access token using the refresh token
|
|
1036
|
+
* Perform the actual Supabase session refresh
|
|
1063
1037
|
*/
|
|
1064
|
-
private refreshTokens;
|
|
1065
1038
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*/
|
|
1068
|
-
private performTokenRefresh;
|
|
1069
|
-
/**
|
|
1070
|
-
* Clear stored tokens (useful for logout)
|
|
1039
|
+
* Clear session tokens (useful for logout)
|
|
1071
1040
|
*/
|
|
1072
1041
|
clearTokens(): void;
|
|
1073
1042
|
/**
|
|
1074
|
-
* Get current
|
|
1043
|
+
* Get current session info (for debugging/testing) - session-based auth
|
|
1075
1044
|
*/
|
|
1076
|
-
getTokenInfo():
|
|
1045
|
+
getTokenInfo(): {
|
|
1046
|
+
accessToken: string;
|
|
1047
|
+
refreshToken: string;
|
|
1048
|
+
expiresAt: number;
|
|
1049
|
+
} | null;
|
|
1077
1050
|
/**
|
|
1078
1051
|
* Make a request to the API.
|
|
1079
1052
|
*/
|
|
@@ -1107,23 +1080,21 @@ declare class ApiClient {
|
|
|
1107
1080
|
orderQty: number;
|
|
1108
1081
|
action: 'Buy' | 'Sell';
|
|
1109
1082
|
orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
|
|
1110
|
-
assetType: '
|
|
1111
|
-
}, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
|
|
1083
|
+
assetType: 'equity' | 'equity_option' | 'crypto' | 'forex' | 'future' | 'future_option';
|
|
1084
|
+
}, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
|
|
1112
1085
|
cancelBrokerOrder(orderId: string, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
|
|
1113
1086
|
modifyBrokerOrder(orderId: string, params: Partial<BrokerOrderParams>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
|
|
1114
1087
|
setBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader'): void;
|
|
1115
1088
|
setAccount(accountNumber: string, accountId?: string): void;
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1126
|
-
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>;
|
|
1089
|
+
placeStockMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1, connection_id?: string): Promise<OrderResponse>;
|
|
1090
|
+
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>;
|
|
1091
|
+
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>;
|
|
1092
|
+
placeCryptoMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
|
|
1093
|
+
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>;
|
|
1094
|
+
placeOptionsMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options: OptionsOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
|
|
1095
|
+
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>;
|
|
1096
|
+
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras$1): Promise<OrderResponse>;
|
|
1097
|
+
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>;
|
|
1127
1098
|
private buildOrderRequestBody;
|
|
1128
1099
|
private buildModifyRequestBody;
|
|
1129
1100
|
private applyBrokerDefaults;
|
|
@@ -1134,6 +1105,7 @@ declare class ApiClient {
|
|
|
1134
1105
|
getCurrentSessionState(): SessionState | null;
|
|
1135
1106
|
/**
|
|
1136
1107
|
* Refresh the current session to extend its lifetime
|
|
1108
|
+
* Note: This now uses Supabase session refresh instead of custom endpoint
|
|
1137
1109
|
*/
|
|
1138
1110
|
refreshSession(): Promise<{
|
|
1139
1111
|
success: boolean;
|
|
@@ -1259,47 +1231,41 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1259
1231
|
private readonly SESSION_REFRESH_BUFFER_HOURS;
|
|
1260
1232
|
private sessionStartTime;
|
|
1261
1233
|
constructor(options: FinaticConnectOptions, deviceInfo?: DeviceInfo);
|
|
1262
|
-
private
|
|
1234
|
+
private linkUserToSession;
|
|
1263
1235
|
/**
|
|
1264
|
-
*
|
|
1265
|
-
* @
|
|
1236
|
+
* Store user ID for authentication state persistence
|
|
1237
|
+
* @param userId - The user ID to store
|
|
1266
1238
|
*/
|
|
1267
|
-
|
|
1239
|
+
private storeUserId;
|
|
1268
1240
|
/**
|
|
1269
|
-
* Check if the
|
|
1270
|
-
* @returns True if authenticated
|
|
1241
|
+
* Check if the user is fully authenticated (has userId in session context)
|
|
1242
|
+
* @returns True if the user is fully authenticated and ready for API calls
|
|
1271
1243
|
*/
|
|
1272
|
-
|
|
1244
|
+
isAuthenticated(): Promise<boolean>;
|
|
1273
1245
|
/**
|
|
1274
1246
|
* Get user's orders with pagination and optional filtering
|
|
1275
1247
|
* @param params - Query parameters including page, perPage, and filters
|
|
1276
1248
|
* @returns Promise with paginated result that supports navigation
|
|
1277
1249
|
*/
|
|
1278
|
-
getOrders(
|
|
1279
|
-
page?: number;
|
|
1280
|
-
perPage?: number;
|
|
1281
|
-
filter?: OrdersFilter;
|
|
1282
|
-
}): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1250
|
+
getOrders(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1283
1251
|
/**
|
|
1284
1252
|
* Get user's positions with pagination and optional filtering
|
|
1285
1253
|
* @param params - Query parameters including page, perPage, and filters
|
|
1286
1254
|
* @returns Promise with paginated result that supports navigation
|
|
1287
1255
|
*/
|
|
1288
|
-
getPositions(
|
|
1289
|
-
page?: number;
|
|
1290
|
-
perPage?: number;
|
|
1291
|
-
filter?: PositionsFilter;
|
|
1292
|
-
}): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1256
|
+
getPositions(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1293
1257
|
/**
|
|
1294
1258
|
* Get user's accounts with pagination and optional filtering
|
|
1295
1259
|
* @param params - Query parameters including page, perPage, and filters
|
|
1296
1260
|
* @returns Promise with paginated result that supports navigation
|
|
1297
1261
|
*/
|
|
1298
|
-
getAccounts(
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1262
|
+
getAccounts(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Get user's balances with pagination and optional filtering
|
|
1265
|
+
* @param params - Query parameters including page, perPage, and filters
|
|
1266
|
+
* @returns Promise with paginated result that supports navigation
|
|
1267
|
+
*/
|
|
1268
|
+
getBalances(page?: number, perPage?: number, options?: BrokerDataOptions, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1303
1269
|
/**
|
|
1304
1270
|
* Initialize the Finatic Connect SDK
|
|
1305
1271
|
* @param token - The portal token from your backend
|
|
@@ -1319,7 +1285,6 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1319
1285
|
* Get the user and tokens for a completed session
|
|
1320
1286
|
* @returns Promise with user information and tokens
|
|
1321
1287
|
*/
|
|
1322
|
-
getSessionUser(): Promise<Record<string, any>>;
|
|
1323
1288
|
private initializeWithUser;
|
|
1324
1289
|
/**
|
|
1325
1290
|
* Handle company access error by opening the portal
|
|
@@ -1345,20 +1310,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1345
1310
|
* Place a new order using the broker order API
|
|
1346
1311
|
* @param order - Order details with broker context
|
|
1347
1312
|
*/
|
|
1348
|
-
placeOrder(order:
|
|
1349
|
-
symbol: string;
|
|
1350
|
-
quantity: number;
|
|
1351
|
-
side: 'buy' | 'sell';
|
|
1352
|
-
orderType: 'market' | 'limit' | 'stop' | 'stop_limit';
|
|
1353
|
-
price?: number;
|
|
1354
|
-
stopPrice?: number;
|
|
1355
|
-
timeInForce: 'day' | 'gtc' | 'gtd' | 'ioc' | 'fok';
|
|
1356
|
-
broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader';
|
|
1357
|
-
accountNumber?: string;
|
|
1358
|
-
assetType?: 'Stock' | 'Option' | 'Crypto' | 'Future';
|
|
1359
|
-
order_id?: string;
|
|
1360
|
-
connection_id?: string;
|
|
1361
|
-
}): Promise<OrderResponse>;
|
|
1313
|
+
placeOrder(order: BrokerOrderParams, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1362
1314
|
/**
|
|
1363
1315
|
* Cancel a broker order
|
|
1364
1316
|
* @param orderId - The order ID to cancel
|
|
@@ -1383,25 +1335,6 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1383
1335
|
side?: 'Buy' | 'Sell';
|
|
1384
1336
|
order_id?: string;
|
|
1385
1337
|
}>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', connection_id?: string): Promise<OrderResponse>;
|
|
1386
|
-
/**
|
|
1387
|
-
* Set the broker context for trading
|
|
1388
|
-
* @param broker - The broker to use for trading
|
|
1389
|
-
*/
|
|
1390
|
-
setTradingContextBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader' | 'interactive_brokers' | 'tradestation'): void;
|
|
1391
|
-
/**
|
|
1392
|
-
* Set the account context for trading
|
|
1393
|
-
* @param accountNumber - The account number to use for trading
|
|
1394
|
-
* @param accountId - Optional account ID
|
|
1395
|
-
*/
|
|
1396
|
-
setTradingContextAccount(accountNumber: string, accountId?: string): void;
|
|
1397
|
-
/**
|
|
1398
|
-
* Get the current trading context
|
|
1399
|
-
*/
|
|
1400
|
-
getTradingContext(): TradingContext;
|
|
1401
|
-
/**
|
|
1402
|
-
* Clear the trading context
|
|
1403
|
-
*/
|
|
1404
|
-
clearTradingContext(): void;
|
|
1405
1338
|
/**
|
|
1406
1339
|
* Place a stock market order (convenience method)
|
|
1407
1340
|
*/
|
|
@@ -1443,7 +1376,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1443
1376
|
* @returns The current user ID or undefined if not authenticated
|
|
1444
1377
|
* @throws AuthenticationError if user is not authenticated
|
|
1445
1378
|
*/
|
|
1446
|
-
getUserId(): string | null
|
|
1379
|
+
getUserId(): Promise<string | null>;
|
|
1447
1380
|
/**
|
|
1448
1381
|
* Get list of supported brokers
|
|
1449
1382
|
* @returns Promise with array of broker information
|
|
@@ -1499,50 +1432,6 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1499
1432
|
* @returns Promise with array of positions for the broker
|
|
1500
1433
|
*/
|
|
1501
1434
|
getPositionsByBroker(brokerId: string): Promise<BrokerDataPosition[]>;
|
|
1502
|
-
/**
|
|
1503
|
-
* Get a specific page of orders with pagination metadata
|
|
1504
|
-
* @param page - Page number (default: 1)
|
|
1505
|
-
* @param perPage - Items per page (default: 100)
|
|
1506
|
-
* @param filter - Optional filter parameters
|
|
1507
|
-
* @returns Promise with paginated orders result
|
|
1508
|
-
*/
|
|
1509
|
-
getOrdersPage(page?: number, perPage?: number, filter?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1510
|
-
/**
|
|
1511
|
-
* Get a specific page of positions with pagination metadata
|
|
1512
|
-
* @param page - Page number (default: 1)
|
|
1513
|
-
* @param perPage - Items per page (default: 100)
|
|
1514
|
-
* @param filter - Optional filter parameters
|
|
1515
|
-
* @returns Promise with paginated positions result
|
|
1516
|
-
*/
|
|
1517
|
-
getPositionsPage(page?: number, perPage?: number, filter?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1518
|
-
/**
|
|
1519
|
-
* Get a specific page of accounts with pagination metadata
|
|
1520
|
-
* @param page - Page number (default: 1)
|
|
1521
|
-
* @param perPage - Items per page (default: 100)
|
|
1522
|
-
* @param filter - Optional filter parameters
|
|
1523
|
-
* @returns Promise with paginated accounts result
|
|
1524
|
-
*/
|
|
1525
|
-
getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1526
|
-
getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1527
|
-
/**
|
|
1528
|
-
* Get the next page of orders
|
|
1529
|
-
* @param previousResult - The previous paginated result
|
|
1530
|
-
* @returns Promise with next page of orders or null if no more pages
|
|
1531
|
-
*/
|
|
1532
|
-
getNextOrdersPage(previousResult: PaginatedResult<BrokerDataOrder[]>): Promise<PaginatedResult<BrokerDataOrder[]> | null>;
|
|
1533
|
-
/**
|
|
1534
|
-
* Get the next page of positions
|
|
1535
|
-
* @param previousResult - The previous paginated result
|
|
1536
|
-
* @returns Promise with next page of positions or null if no more pages
|
|
1537
|
-
*/
|
|
1538
|
-
getNextPositionsPage(previousResult: PaginatedResult<BrokerDataPosition[]>): Promise<PaginatedResult<BrokerDataPosition[]> | null>;
|
|
1539
|
-
/**
|
|
1540
|
-
* Get the next page of accounts
|
|
1541
|
-
* @param previousResult - The previous paginated result
|
|
1542
|
-
* @returns Promise with next page of accounts or null if no more pages
|
|
1543
|
-
*/
|
|
1544
|
-
getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
|
|
1545
|
-
getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
|
|
1546
1435
|
/**
|
|
1547
1436
|
* Get all orders across all pages (convenience method)
|
|
1548
1437
|
* @param filter - Optional filter parameters
|
|
@@ -1645,351 +1534,5 @@ declare function createCustomThemeFromPreset(preset: string, modifications: Part
|
|
|
1645
1534
|
|
|
1646
1535
|
declare const portalThemePresets: Record<string, PortalThemeConfig>;
|
|
1647
1536
|
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
*/
|
|
1651
|
-
interface MockConfig {
|
|
1652
|
-
delay?: number;
|
|
1653
|
-
scenario?: MockScenario;
|
|
1654
|
-
customData?: Record<string, any>;
|
|
1655
|
-
mockApiOnly?: boolean;
|
|
1656
|
-
}
|
|
1657
|
-
/**
|
|
1658
|
-
* Different mock scenarios for testing
|
|
1659
|
-
*/
|
|
1660
|
-
type MockScenario = 'success' | 'error' | 'network_error' | 'rate_limit' | 'auth_failure';
|
|
1661
|
-
/**
|
|
1662
|
-
* Mock data provider for Finatic API endpoints
|
|
1663
|
-
*/
|
|
1664
|
-
declare class MockDataProvider {
|
|
1665
|
-
private config;
|
|
1666
|
-
private sessionData;
|
|
1667
|
-
private userTokens;
|
|
1668
|
-
constructor(config?: MockConfig);
|
|
1669
|
-
/**
|
|
1670
|
-
* Get a random delay between min and max milliseconds
|
|
1671
|
-
*/
|
|
1672
|
-
private getRandomDelay;
|
|
1673
|
-
/**
|
|
1674
|
-
* Simulate network delay
|
|
1675
|
-
*/
|
|
1676
|
-
simulateDelay(): Promise<void>;
|
|
1677
|
-
/**
|
|
1678
|
-
* Generate a realistic session ID
|
|
1679
|
-
*/
|
|
1680
|
-
private generateSessionId;
|
|
1681
|
-
/**
|
|
1682
|
-
* Generate a realistic user ID
|
|
1683
|
-
*/
|
|
1684
|
-
private generateUserId;
|
|
1685
|
-
/**
|
|
1686
|
-
* Generate a realistic company ID
|
|
1687
|
-
*/
|
|
1688
|
-
private generateCompanyId;
|
|
1689
|
-
/**
|
|
1690
|
-
* Generate mock tokens
|
|
1691
|
-
*/
|
|
1692
|
-
private generateTokens;
|
|
1693
|
-
mockStartSession(token: string, userId?: string): Promise<SessionResponse>;
|
|
1694
|
-
mockRequestOtp(sessionId: string, email: string): Promise<OtpRequestResponse>;
|
|
1695
|
-
mockVerifyOtp(sessionId: string, otp: string): Promise<OtpVerifyResponse>;
|
|
1696
|
-
mockAuthenticateDirectly(sessionId: string, userId: string): Promise<SessionAuthenticateResponse>;
|
|
1697
|
-
mockGetPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
1698
|
-
mockValidatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
1699
|
-
mockCompletePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
1700
|
-
mockRefreshToken(refreshToken: string): Promise<RefreshTokenResponse>;
|
|
1701
|
-
mockGetBrokerList(): Promise<{
|
|
1702
|
-
_id: string;
|
|
1703
|
-
response_data: BrokerInfo[];
|
|
1704
|
-
message: string;
|
|
1705
|
-
status_code: number;
|
|
1706
|
-
warnings: null;
|
|
1707
|
-
errors: null;
|
|
1708
|
-
}>;
|
|
1709
|
-
mockGetBrokerAccounts(): Promise<{
|
|
1710
|
-
_id: string;
|
|
1711
|
-
response_data: BrokerAccount[];
|
|
1712
|
-
message: string;
|
|
1713
|
-
status_code: number;
|
|
1714
|
-
warnings: null;
|
|
1715
|
-
errors: null;
|
|
1716
|
-
}>;
|
|
1717
|
-
mockGetBrokerConnections(): Promise<{
|
|
1718
|
-
_id: string;
|
|
1719
|
-
response_data: BrokerConnection[];
|
|
1720
|
-
message: string;
|
|
1721
|
-
status_code: number;
|
|
1722
|
-
warnings: null;
|
|
1723
|
-
errors: null;
|
|
1724
|
-
}>;
|
|
1725
|
-
mockGetOrders(filter?: OrdersFilter): Promise<{
|
|
1726
|
-
data: Order[];
|
|
1727
|
-
}>;
|
|
1728
|
-
mockGetBrokerOrders(filter?: OrdersFilter): Promise<{
|
|
1729
|
-
data: BrokerDataOrder[];
|
|
1730
|
-
}>;
|
|
1731
|
-
mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
|
|
1732
|
-
data: BrokerDataPosition[];
|
|
1733
|
-
}>;
|
|
1734
|
-
mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
|
|
1735
|
-
data: BrokerBalance[];
|
|
1736
|
-
}>;
|
|
1737
|
-
mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
|
|
1738
|
-
data: BrokerAccount[];
|
|
1739
|
-
}>;
|
|
1740
|
-
mockPlaceOrder(order: BrokerOrderParams): Promise<OrderResponse>;
|
|
1741
|
-
/**
|
|
1742
|
-
* Get stored session data
|
|
1743
|
-
*/
|
|
1744
|
-
getSessionData(sessionId: string): any;
|
|
1745
|
-
/**
|
|
1746
|
-
* Get stored user token
|
|
1747
|
-
*/
|
|
1748
|
-
getUserToken(sessionId: string): UserToken | undefined;
|
|
1749
|
-
/**
|
|
1750
|
-
* Clear all stored data
|
|
1751
|
-
*/
|
|
1752
|
-
clearData(): void;
|
|
1753
|
-
/**
|
|
1754
|
-
* Update configuration
|
|
1755
|
-
*/
|
|
1756
|
-
updateConfig(config: Partial<MockConfig>): void;
|
|
1757
|
-
setScenario(scenario: MockScenario): void;
|
|
1758
|
-
getScenario(): MockScenario;
|
|
1759
|
-
private applyOrderFilters;
|
|
1760
|
-
private applyBrokerOrderFilters;
|
|
1761
|
-
private applyBrokerPositionFilters;
|
|
1762
|
-
private applyBrokerAccountFilters;
|
|
1763
|
-
private applyBrokerBalanceFilters;
|
|
1764
|
-
/**
|
|
1765
|
-
* Generate mock orders with diverse data
|
|
1766
|
-
*/
|
|
1767
|
-
private generateMockOrders;
|
|
1768
|
-
/**
|
|
1769
|
-
* Generate mock positions with diverse data
|
|
1770
|
-
*/
|
|
1771
|
-
private generateMockPositions;
|
|
1772
|
-
/**
|
|
1773
|
-
* Generate mock accounts with diverse data
|
|
1774
|
-
*/
|
|
1775
|
-
private generateMockAccounts;
|
|
1776
|
-
/**
|
|
1777
|
-
* Mock disconnect company method
|
|
1778
|
-
* @param connectionId - The connection ID to disconnect
|
|
1779
|
-
* @returns Promise with mock disconnect response
|
|
1780
|
-
*/
|
|
1781
|
-
mockDisconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
/**
|
|
1785
|
-
* Mock API Client that implements the same interface as the real ApiClient
|
|
1786
|
-
* but returns mock data instead of making HTTP requests
|
|
1787
|
-
*/
|
|
1788
|
-
declare class MockApiClient {
|
|
1789
|
-
private readonly baseUrl;
|
|
1790
|
-
protected readonly deviceInfo?: DeviceInfo$1;
|
|
1791
|
-
protected currentSessionState: SessionState | null;
|
|
1792
|
-
protected currentSessionId: string | null;
|
|
1793
|
-
private tradingContext;
|
|
1794
|
-
private tokenInfo;
|
|
1795
|
-
private refreshPromise;
|
|
1796
|
-
private readonly REFRESH_BUFFER_MINUTES;
|
|
1797
|
-
private companyId;
|
|
1798
|
-
private csrfToken;
|
|
1799
|
-
private mockDataProvider;
|
|
1800
|
-
private readonly mockApiOnly;
|
|
1801
|
-
constructor(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig);
|
|
1802
|
-
/**
|
|
1803
|
-
* Store tokens after successful authentication
|
|
1804
|
-
*/
|
|
1805
|
-
setTokens(accessToken: string, refreshToken: string, expiresAt: string, userId?: string): void;
|
|
1806
|
-
/**
|
|
1807
|
-
* Get the current access token, refreshing if necessary
|
|
1808
|
-
*/
|
|
1809
|
-
getValidAccessToken(): Promise<string>;
|
|
1810
|
-
/**
|
|
1811
|
-
* Check if the current token is expired or about to expire
|
|
1812
|
-
*/
|
|
1813
|
-
private isTokenExpired;
|
|
1814
|
-
/**
|
|
1815
|
-
* Refresh the access token using the refresh token
|
|
1816
|
-
*/
|
|
1817
|
-
private refreshTokens;
|
|
1818
|
-
/**
|
|
1819
|
-
* Perform the actual token refresh request
|
|
1820
|
-
*/
|
|
1821
|
-
private performTokenRefresh;
|
|
1822
|
-
/**
|
|
1823
|
-
* Clear stored tokens (useful for logout)
|
|
1824
|
-
*/
|
|
1825
|
-
clearTokens(): void;
|
|
1826
|
-
/**
|
|
1827
|
-
* Get current token info (for debugging/testing)
|
|
1828
|
-
*/
|
|
1829
|
-
getTokenInfo(): TokenInfo | null;
|
|
1830
|
-
/**
|
|
1831
|
-
* Set session context (session ID, company ID, CSRF token)
|
|
1832
|
-
*/
|
|
1833
|
-
setSessionContext(sessionId: string, companyId: string, csrfToken?: string): void;
|
|
1834
|
-
/**
|
|
1835
|
-
* Get the current session ID
|
|
1836
|
-
*/
|
|
1837
|
-
getCurrentSessionId(): string | null;
|
|
1838
|
-
/**
|
|
1839
|
-
* Get the current company ID
|
|
1840
|
-
*/
|
|
1841
|
-
getCurrentCompanyId(): string | null;
|
|
1842
|
-
/**
|
|
1843
|
-
* Get the current CSRF token
|
|
1844
|
-
*/
|
|
1845
|
-
getCurrentCsrfToken(): string | null;
|
|
1846
|
-
startSession(token: string, userId?: string): Promise<SessionResponse>;
|
|
1847
|
-
requestOtp(sessionId: string, email: string): Promise<OtpRequestResponse>;
|
|
1848
|
-
verifyOtp(sessionId: string, otp: string): Promise<OtpVerifyResponse>;
|
|
1849
|
-
authenticateDirectly(sessionId: string, userId: string): Promise<SessionAuthenticateResponse>;
|
|
1850
|
-
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
1851
|
-
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
1852
|
-
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
1853
|
-
getOrders(filter?: OrdersFilter): Promise<{
|
|
1854
|
-
data: Order[];
|
|
1855
|
-
}>;
|
|
1856
|
-
placeOrder(order: BrokerOrderParams): Promise<void>;
|
|
1857
|
-
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
1858
|
-
symbol: string;
|
|
1859
|
-
orderQty: number;
|
|
1860
|
-
action: 'Buy' | 'Sell';
|
|
1861
|
-
orderType: 'Market' | 'Limit' | 'Stop' | 'StopLimit';
|
|
1862
|
-
assetType: 'Stock' | 'Option' | 'Crypto' | 'Future';
|
|
1863
|
-
}, extras?: BrokerExtras, connection_id?: string): Promise<OrderResponse>;
|
|
1864
|
-
cancelBrokerOrder(orderId: string, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
|
|
1865
|
-
modifyBrokerOrder(orderId: string, params: Partial<BrokerOrderParams>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', extras?: any, connection_id?: string): Promise<OrderResponse>;
|
|
1866
|
-
setBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader'): void;
|
|
1867
|
-
setAccount(accountNumber: string, accountId?: string): void;
|
|
1868
|
-
getTradingContext(): TradingContext;
|
|
1869
|
-
clearTradingContext(): void;
|
|
1870
|
-
placeStockMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1871
|
-
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>;
|
|
1872
|
-
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>;
|
|
1873
|
-
placeCryptoMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options?: CryptoOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1874
|
-
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>;
|
|
1875
|
-
placeOptionsMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', options: OptionsOrderOptions, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1876
|
-
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>;
|
|
1877
|
-
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1878
|
-
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>;
|
|
1879
|
-
getUserToken(sessionId: string): Promise<UserToken>;
|
|
1880
|
-
getCurrentSessionState(): SessionState | null;
|
|
1881
|
-
getBrokerList(): Promise<{
|
|
1882
|
-
_id: string;
|
|
1883
|
-
response_data: BrokerInfo[];
|
|
1884
|
-
message: string;
|
|
1885
|
-
status_code: number;
|
|
1886
|
-
warnings: null;
|
|
1887
|
-
errors: null;
|
|
1888
|
-
}>;
|
|
1889
|
-
getBrokerAccounts(options?: BrokerDataOptions): Promise<{
|
|
1890
|
-
_id: string;
|
|
1891
|
-
response_data: BrokerAccount[];
|
|
1892
|
-
message: string;
|
|
1893
|
-
status_code: number;
|
|
1894
|
-
warnings: null;
|
|
1895
|
-
errors: null;
|
|
1896
|
-
}>;
|
|
1897
|
-
getBrokerOrders(options?: BrokerDataOptions): Promise<{
|
|
1898
|
-
_id: string;
|
|
1899
|
-
response_data: BrokerOrder[];
|
|
1900
|
-
message: string;
|
|
1901
|
-
status_code: number;
|
|
1902
|
-
warnings: null;
|
|
1903
|
-
errors: null;
|
|
1904
|
-
}>;
|
|
1905
|
-
getBrokerPositions(options?: BrokerDataOptions): Promise<{
|
|
1906
|
-
_id: string;
|
|
1907
|
-
response_data: BrokerPosition[];
|
|
1908
|
-
message: string;
|
|
1909
|
-
status_code: number;
|
|
1910
|
-
warnings: null;
|
|
1911
|
-
errors: null;
|
|
1912
|
-
}>;
|
|
1913
|
-
getBrokerOrdersWithFilter(filter?: OrdersFilter): Promise<{
|
|
1914
|
-
data: BrokerDataOrder[];
|
|
1915
|
-
}>;
|
|
1916
|
-
getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
|
|
1917
|
-
data: BrokerDataPosition[];
|
|
1918
|
-
}>;
|
|
1919
|
-
getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
|
|
1920
|
-
data: BrokerBalance[];
|
|
1921
|
-
}>;
|
|
1922
|
-
getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
|
|
1923
|
-
data: BrokerAccount[];
|
|
1924
|
-
}>;
|
|
1925
|
-
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1926
|
-
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1927
|
-
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1928
|
-
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1929
|
-
getBrokerConnections(): Promise<{
|
|
1930
|
-
_id: string;
|
|
1931
|
-
response_data: BrokerConnection[];
|
|
1932
|
-
message: string;
|
|
1933
|
-
status_code: number;
|
|
1934
|
-
warnings: null;
|
|
1935
|
-
errors: null;
|
|
1936
|
-
}>;
|
|
1937
|
-
/**
|
|
1938
|
-
* Mock disconnect company method
|
|
1939
|
-
* @param connectionId - The connection ID to disconnect
|
|
1940
|
-
* @returns Promise with mock disconnect response
|
|
1941
|
-
*/
|
|
1942
|
-
disconnectCompany(connectionId: string): Promise<DisconnectCompanyResponse>;
|
|
1943
|
-
getMockDataProvider(): MockDataProvider;
|
|
1944
|
-
clearMockData(): void;
|
|
1945
|
-
/**
|
|
1946
|
-
* Check if this is a mock client
|
|
1947
|
-
* @returns true if this is a mock client
|
|
1948
|
-
*/
|
|
1949
|
-
isMockClient(): boolean;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* Factory class for creating API clients (real or mock)
|
|
1954
|
-
*/
|
|
1955
|
-
declare class MockFactory {
|
|
1956
|
-
/**
|
|
1957
|
-
* Create an API client based on environment configuration
|
|
1958
|
-
* @param baseUrl - The base URL for the API
|
|
1959
|
-
* @param deviceInfo - Optional device information
|
|
1960
|
-
* @param mockConfig - Optional mock configuration (only used if mocks are enabled)
|
|
1961
|
-
* @returns ApiClient or MockApiClient instance
|
|
1962
|
-
*/
|
|
1963
|
-
static createApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig): ApiClient | MockApiClient;
|
|
1964
|
-
/**
|
|
1965
|
-
* Force create a mock API client regardless of environment settings
|
|
1966
|
-
* @param baseUrl - The base URL for the API
|
|
1967
|
-
* @param deviceInfo - Optional device information
|
|
1968
|
-
* @param mockConfig - Optional mock configuration
|
|
1969
|
-
* @returns MockApiClient instance
|
|
1970
|
-
*/
|
|
1971
|
-
static createMockApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1, mockConfig?: MockConfig): MockApiClient;
|
|
1972
|
-
/**
|
|
1973
|
-
* Force create a real API client regardless of environment settings
|
|
1974
|
-
* @param baseUrl - The base URL for the API
|
|
1975
|
-
* @param deviceInfo - Optional device information
|
|
1976
|
-
* @returns ApiClient instance
|
|
1977
|
-
*/
|
|
1978
|
-
static createRealApiClient(baseUrl: string, deviceInfo?: DeviceInfo$1): ApiClient;
|
|
1979
|
-
/**
|
|
1980
|
-
* Check if mocks are currently enabled
|
|
1981
|
-
* @returns boolean indicating if mocks are enabled
|
|
1982
|
-
*/
|
|
1983
|
-
static isMockMode(): boolean;
|
|
1984
|
-
/**
|
|
1985
|
-
* Get current mock configuration
|
|
1986
|
-
* @returns Mock configuration object
|
|
1987
|
-
*/
|
|
1988
|
-
static getMockConfig(): {
|
|
1989
|
-
enabled: boolean;
|
|
1990
|
-
delay?: number;
|
|
1991
|
-
};
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
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 };
|
|
1995
|
-
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 };
|
|
1537
|
+
export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, TradingNotEnabledError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
|
|
1538
|
+
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, OrderNotFoundError, OrderResponse, OrdersFilter, OtpRequestResponse, OtpVerifyResponse, PerformanceMetrics, PortalMessage, PortalProps, PortalResponse, PortalTheme, PortalThemeConfig, PortalThemePreset, PortalUrlResponse, Portfolio, PortfolioSnapshot, PositionsFilter, RefreshTokenRequest, RefreshTokenResponse, RequestHeaders, SessionAuthenticateResponse, SessionInitResponse, SessionResponse, SessionStatus, SessionValidationResponse, TokenInfo, TradeAccessDeniedError, TradingContext, UserToken, ValidationError };
|