@finatic/client 0.0.133 → 0.0.135
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 +87 -0
- package/dist/index.d.ts +471 -730
- package/dist/index.js +847 -734
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +848 -732
- package/dist/index.mjs.map +1 -1
- package/dist/types/core/client/ApiClient.d.ts +206 -0
- package/dist/types/{client → core/client}/FinaticConnect.d.ts +54 -13
- package/dist/types/{portal → core/portal}/PortalUI.d.ts +1 -1
- package/dist/types/index.d.ts +6 -11
- package/dist/types/mocks/MockApiClient.d.ts +36 -90
- package/dist/types/mocks/MockDataProvider.d.ts +13 -3
- package/dist/types/mocks/MockFactory.d.ts +2 -2
- package/dist/types/{shared/themes → themes}/portalPresets.d.ts +1 -1
- package/dist/types/types/api/auth.d.ts +111 -0
- package/dist/types/types/{api.d.ts → api/broker.d.ts} +56 -284
- package/dist/types/types/api/core.d.ts +46 -0
- package/dist/types/types/api/errors.d.ts +23 -0
- package/dist/types/types/api/orders.d.ts +39 -0
- package/dist/types/types/{shared.d.ts → api/portfolio.d.ts} +26 -21
- package/dist/types/types/common/pagination.d.ts +33 -0
- package/dist/types/types/connect.d.ts +4 -2
- package/dist/types/types/index.d.ts +13 -0
- package/dist/types/types/{theme.d.ts → ui/theme.d.ts} +3 -0
- package/dist/types/utils/brokerUtils.d.ts +30 -0
- package/package.json +4 -3
- package/dist/types/client/ApiClient.d.ts +0 -234
- package/dist/types/mocks/index.d.ts +0 -5
- package/dist/types/security/ApiSecurity.d.ts +0 -24
- package/dist/types/security/RuntimeSecurity.d.ts +0 -28
- package/dist/types/security/SecurityUtils.d.ts +0 -21
- package/dist/types/security/index.d.ts +0 -2
- package/dist/types/services/AnalyticsService.d.ts +0 -18
- package/dist/types/services/ApiClient.d.ts +0 -121
- package/dist/types/services/PortalService.d.ts +0 -24
- package/dist/types/services/TradingService.d.ts +0 -55
- package/dist/types/services/api.d.ts +0 -23
- package/dist/types/services/auth.d.ts +0 -9
- package/dist/types/services/index.d.ts +0 -4
- package/dist/types/services/portfolio.d.ts +0 -10
- package/dist/types/services/trading.d.ts +0 -10
- package/dist/types/shared/index.d.ts +0 -2
- package/dist/types/shared/themes/index.d.ts +0 -2
- package/dist/types/shared/themes/presets.d.ts +0 -3
- package/dist/types/shared/themes/system.d.ts +0 -2
- package/dist/types/shared/types/index.d.ts +0 -110
- package/dist/types/types/config.d.ts +0 -12
- package/dist/types/types/errors.d.ts +0 -47
- package/dist/types/types/security.d.ts +0 -35
- package/dist/types/types.d.ts +0 -157
package/README.md
CHANGED
|
@@ -87,6 +87,15 @@ await finatic.placeOrder({
|
|
|
87
87
|
timeInForce: 'day'
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
// Open portal with broker filtering
|
|
91
|
+
await finatic.openPortal({
|
|
92
|
+
brokers: ['alpaca', 'robinhood'] // Only show these brokers
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Disconnect a company from a broker connection
|
|
96
|
+
const disconnectResponse = await finatic.disconnectCompany('connection-uuid-here');
|
|
97
|
+
console.log('Disconnect action:', disconnectResponse.response_data.action);
|
|
98
|
+
|
|
90
99
|
// Close the portal when done
|
|
91
100
|
finatic.closePortal();
|
|
92
101
|
```
|
|
@@ -120,6 +129,7 @@ Opens the authentication portal in an iframe.
|
|
|
120
129
|
- `theme` (object, optional): Theme configuration
|
|
121
130
|
- `preset` (string, optional): Preset theme name ('dark', 'light', 'corporateBlue', 'purple', 'green', 'orange')
|
|
122
131
|
- `custom` (object, optional): Custom theme configuration object
|
|
132
|
+
- `brokers` (string[], optional): List of broker names to filter by (only these brokers will be shown)
|
|
123
133
|
|
|
124
134
|
#### `closePortal()`
|
|
125
135
|
|
|
@@ -239,6 +249,69 @@ const modifiedTheme = createCustomThemeFromPreset('dark', {
|
|
|
239
249
|
});
|
|
240
250
|
```
|
|
241
251
|
|
|
252
|
+
### Portal Broker Filtering
|
|
253
|
+
|
|
254
|
+
The Finatic Portal supports broker filtering via URL parameters. You can restrict which brokers are displayed in the portal by specifying a list of allowed broker names.
|
|
255
|
+
|
|
256
|
+
#### Supported Brokers
|
|
257
|
+
|
|
258
|
+
The following broker names are supported:
|
|
259
|
+
- `alpaca` - Alpaca Markets
|
|
260
|
+
- `robinhood` - Robinhood
|
|
261
|
+
- `tasty_trade` - TastyTrade
|
|
262
|
+
- `ninja_trader` - NinjaTrader
|
|
263
|
+
|
|
264
|
+
#### Using Broker Filtering
|
|
265
|
+
|
|
266
|
+
```javascript
|
|
267
|
+
// Show only specific brokers
|
|
268
|
+
await finatic.openPortal({
|
|
269
|
+
brokers: ['alpaca', 'robinhood']
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// Show only one broker
|
|
273
|
+
await finatic.openPortal({
|
|
274
|
+
brokers: ['tasty_trade']
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Combine with theme
|
|
278
|
+
await finatic.openPortal({
|
|
279
|
+
theme: { preset: 'dark' },
|
|
280
|
+
brokers: ['alpaca', 'ninja_trader']
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Error Handling
|
|
285
|
+
|
|
286
|
+
If you pass an unsupported broker name, it will be logged as a warning to the console, but the portal will still open with the supported brokers:
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
// This will log a warning for 'unsupported_broker' but continue with 'alpaca'
|
|
290
|
+
await finatic.openPortal({
|
|
291
|
+
brokers: ['alpaca', 'unsupported_broker']
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### Broker Filtering Utilities
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
import {
|
|
299
|
+
convertBrokerNamesToIds,
|
|
300
|
+
appendBrokerFilterToURL,
|
|
301
|
+
getSupportedBrokerNames,
|
|
302
|
+
isBrokerSupported
|
|
303
|
+
} from 'finatic-sdk';
|
|
304
|
+
|
|
305
|
+
// Convert broker names to IDs
|
|
306
|
+
const { brokerIds, warnings } = convertBrokerNamesToIds(['alpaca', 'robinhood']);
|
|
307
|
+
|
|
308
|
+
// Get list of supported broker names
|
|
309
|
+
const supportedBrokers = getSupportedBrokerNames();
|
|
310
|
+
|
|
311
|
+
// Check if a broker is supported
|
|
312
|
+
const isSupported = isBrokerSupported('alpaca');
|
|
313
|
+
```
|
|
314
|
+
|
|
242
315
|
### Data Access (Paginated)
|
|
243
316
|
|
|
244
317
|
#### `getAccounts(params?)`
|
|
@@ -372,6 +445,20 @@ Returns broker connections for the authenticated user.
|
|
|
372
445
|
|
|
373
446
|
Returns: Promise<BrokerConnection[]>
|
|
374
447
|
|
|
448
|
+
#### `disconnectCompany(connectionId)`
|
|
449
|
+
|
|
450
|
+
Disconnects a company from a broker connection.
|
|
451
|
+
|
|
452
|
+
- `connectionId` (string): The connection ID to disconnect
|
|
453
|
+
|
|
454
|
+
Returns: Promise<DisconnectCompanyResponse>
|
|
455
|
+
|
|
456
|
+
The response includes:
|
|
457
|
+
- `success` (boolean): Whether the operation was successful
|
|
458
|
+
- `response_data.action` (string): Either 'company_access_removed' or 'connection_deleted'
|
|
459
|
+
- `response_data.remaining_companies` (number, optional): Number of remaining companies if connection still exists
|
|
460
|
+
- `response_data.message` (string): Human-readable message about the action taken
|
|
461
|
+
|
|
375
462
|
### Trading
|
|
376
463
|
|
|
377
464
|
#### `placeOrder(order)`
|