@finatic/client 0.0.136 → 0.0.138
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 +68 -64
- package/dist/index.d.ts +294 -75
- package/dist/index.js +1424 -321
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1424 -321
- package/dist/index.mjs.map +1 -1
- package/dist/types/core/client/ApiClient.d.ts +21 -13
- package/dist/types/core/client/FinaticConnect.d.ts +44 -7
- package/dist/types/core/portal/PortalUI.d.ts +0 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/mocks/MockApiClient.d.ts +6 -9
- package/dist/types/mocks/MockDataProvider.d.ts +6 -9
- package/dist/types/themes/portalPresets.d.ts +1 -0
- package/dist/types/types/api/broker.d.ts +47 -0
- package/dist/types/types/connect.d.ts +2 -0
- package/dist/types/types/portal.d.ts +178 -49
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -205,6 +205,18 @@ interface BrokerAccount {
|
|
|
205
205
|
updated_at: string;
|
|
206
206
|
/** ISO 8601 timestamp with timezone information */
|
|
207
207
|
last_synced_at: string;
|
|
208
|
+
/** ISO 8601 timestamp with timezone information - when positions were last synced */
|
|
209
|
+
positions_synced_at: string | null;
|
|
210
|
+
/** ISO 8601 timestamp with timezone information - when orders were last synced */
|
|
211
|
+
orders_synced_at: string | null;
|
|
212
|
+
/** ISO 8601 timestamp with timezone information - when balances were last synced */
|
|
213
|
+
balances_synced_at: string | null;
|
|
214
|
+
/** ISO 8601 timestamp with timezone information - when the account was created */
|
|
215
|
+
account_created_at: string | null;
|
|
216
|
+
/** ISO 8601 timestamp with timezone information - when the account was last updated */
|
|
217
|
+
account_updated_at: string | null;
|
|
218
|
+
/** ISO 8601 timestamp with timezone information - when the first trade occurred */
|
|
219
|
+
account_first_trade_at: string | null;
|
|
208
220
|
}
|
|
209
221
|
interface BrokerOrder {
|
|
210
222
|
id: string;
|
|
@@ -247,6 +259,24 @@ interface BrokerPosition {
|
|
|
247
259
|
/** ISO 8601 timestamp with timezone information */
|
|
248
260
|
updated_at: string;
|
|
249
261
|
}
|
|
262
|
+
interface BrokerBalance {
|
|
263
|
+
id: string;
|
|
264
|
+
account_id: string;
|
|
265
|
+
total_cash_value: number | null;
|
|
266
|
+
net_liquidation_value: number | null;
|
|
267
|
+
initial_margin: number | null;
|
|
268
|
+
maintenance_margin: number | null;
|
|
269
|
+
available_to_withdraw: number | null;
|
|
270
|
+
total_realized_pnl: number | null;
|
|
271
|
+
balance_created_at: string | null;
|
|
272
|
+
balance_updated_at: string | null;
|
|
273
|
+
is_end_of_day_snapshot: boolean | null;
|
|
274
|
+
raw_payload: any | null;
|
|
275
|
+
/** ISO 8601 timestamp with timezone information */
|
|
276
|
+
created_at: string;
|
|
277
|
+
/** ISO 8601 timestamp with timezone information */
|
|
278
|
+
updated_at: string;
|
|
279
|
+
}
|
|
250
280
|
interface BrokerDataOptions {
|
|
251
281
|
broker_name?: string;
|
|
252
282
|
account_id?: string;
|
|
@@ -415,6 +445,17 @@ interface AccountsFilter {
|
|
|
415
445
|
offset?: number;
|
|
416
446
|
with_metadata?: boolean;
|
|
417
447
|
}
|
|
448
|
+
interface BalancesFilter {
|
|
449
|
+
broker_id?: string;
|
|
450
|
+
connection_id?: string;
|
|
451
|
+
account_id?: string;
|
|
452
|
+
is_end_of_day_snapshot?: boolean;
|
|
453
|
+
limit?: number;
|
|
454
|
+
offset?: number;
|
|
455
|
+
balance_created_after?: string;
|
|
456
|
+
balance_created_before?: string;
|
|
457
|
+
with_metadata?: boolean;
|
|
458
|
+
}
|
|
418
459
|
interface FilteredOrdersResponse {
|
|
419
460
|
orders: BrokerDataOrder[];
|
|
420
461
|
total: number;
|
|
@@ -433,6 +474,12 @@ interface FilteredAccountsResponse {
|
|
|
433
474
|
limit: number;
|
|
434
475
|
offset: number;
|
|
435
476
|
}
|
|
477
|
+
interface FilteredBalancesResponse {
|
|
478
|
+
balances: BrokerBalance[];
|
|
479
|
+
total: number;
|
|
480
|
+
limit: number;
|
|
481
|
+
offset: number;
|
|
482
|
+
}
|
|
436
483
|
interface DisconnectCompanyResponse {
|
|
437
484
|
success: boolean;
|
|
438
485
|
response_data: {
|
|
@@ -653,62 +700,191 @@ interface PortalConfig {
|
|
|
653
700
|
zIndex?: number;
|
|
654
701
|
}
|
|
655
702
|
interface PortalThemeConfig {
|
|
656
|
-
mode
|
|
657
|
-
colors
|
|
658
|
-
background
|
|
659
|
-
primary
|
|
660
|
-
secondary
|
|
661
|
-
tertiary
|
|
662
|
-
accent
|
|
663
|
-
glass
|
|
703
|
+
mode?: 'dark' | 'light' | 'auto';
|
|
704
|
+
colors?: {
|
|
705
|
+
background?: {
|
|
706
|
+
primary?: string;
|
|
707
|
+
secondary?: string;
|
|
708
|
+
tertiary?: string;
|
|
709
|
+
accent?: string;
|
|
710
|
+
glass?: string;
|
|
664
711
|
};
|
|
665
|
-
status
|
|
666
|
-
connected
|
|
667
|
-
disconnected
|
|
668
|
-
warning
|
|
669
|
-
pending
|
|
670
|
-
error
|
|
671
|
-
success
|
|
712
|
+
status?: {
|
|
713
|
+
connected?: string;
|
|
714
|
+
disconnected?: string;
|
|
715
|
+
warning?: string;
|
|
716
|
+
pending?: string;
|
|
717
|
+
error?: string;
|
|
718
|
+
success?: string;
|
|
672
719
|
};
|
|
673
|
-
text
|
|
674
|
-
primary
|
|
675
|
-
secondary
|
|
676
|
-
muted
|
|
677
|
-
inverse
|
|
720
|
+
text?: {
|
|
721
|
+
primary?: string;
|
|
722
|
+
secondary?: string;
|
|
723
|
+
muted?: string;
|
|
724
|
+
inverse?: string;
|
|
678
725
|
};
|
|
679
|
-
border
|
|
680
|
-
primary
|
|
681
|
-
secondary
|
|
682
|
-
hover
|
|
683
|
-
focus
|
|
684
|
-
accent
|
|
726
|
+
border?: {
|
|
727
|
+
primary?: string;
|
|
728
|
+
secondary?: string;
|
|
729
|
+
hover?: string;
|
|
730
|
+
focus?: string;
|
|
731
|
+
accent?: string;
|
|
685
732
|
};
|
|
686
|
-
input
|
|
687
|
-
background
|
|
688
|
-
border
|
|
689
|
-
borderFocus
|
|
690
|
-
text
|
|
691
|
-
placeholder
|
|
733
|
+
input?: {
|
|
734
|
+
background?: string;
|
|
735
|
+
border?: string;
|
|
736
|
+
borderFocus?: string;
|
|
737
|
+
text?: string;
|
|
738
|
+
placeholder?: string;
|
|
692
739
|
};
|
|
693
|
-
button
|
|
694
|
-
primary
|
|
695
|
-
background
|
|
696
|
-
text
|
|
697
|
-
hover
|
|
698
|
-
active
|
|
740
|
+
button?: {
|
|
741
|
+
primary?: {
|
|
742
|
+
background?: string;
|
|
743
|
+
text?: string;
|
|
744
|
+
hover?: string;
|
|
745
|
+
active?: string;
|
|
746
|
+
};
|
|
747
|
+
secondary?: {
|
|
748
|
+
background?: string;
|
|
749
|
+
text?: string;
|
|
750
|
+
border?: string;
|
|
751
|
+
hover?: string;
|
|
752
|
+
active?: string;
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
typography?: {
|
|
757
|
+
fontFamily?: {
|
|
758
|
+
primary?: string;
|
|
759
|
+
secondary?: string;
|
|
760
|
+
};
|
|
761
|
+
fontSize?: {
|
|
762
|
+
xs?: string;
|
|
763
|
+
sm?: string;
|
|
764
|
+
base?: string;
|
|
765
|
+
lg?: string;
|
|
766
|
+
xl?: string;
|
|
767
|
+
'2xl'?: string;
|
|
768
|
+
'3xl'?: string;
|
|
769
|
+
'4xl'?: string;
|
|
770
|
+
};
|
|
771
|
+
fontWeight?: {
|
|
772
|
+
normal?: number;
|
|
773
|
+
medium?: number;
|
|
774
|
+
semibold?: number;
|
|
775
|
+
bold?: number;
|
|
776
|
+
extrabold?: number;
|
|
777
|
+
};
|
|
778
|
+
lineHeight?: {
|
|
779
|
+
tight?: string;
|
|
780
|
+
normal?: string;
|
|
781
|
+
relaxed?: string;
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
spacing?: {
|
|
785
|
+
xs?: string;
|
|
786
|
+
sm?: string;
|
|
787
|
+
md?: string;
|
|
788
|
+
lg?: string;
|
|
789
|
+
xl?: string;
|
|
790
|
+
'2xl'?: string;
|
|
791
|
+
'3xl'?: string;
|
|
792
|
+
};
|
|
793
|
+
layout?: {
|
|
794
|
+
containerMaxWidth?: string;
|
|
795
|
+
gridGap?: string;
|
|
796
|
+
cardPadding?: string;
|
|
797
|
+
borderRadius?: {
|
|
798
|
+
sm?: string;
|
|
799
|
+
md?: string;
|
|
800
|
+
lg?: string;
|
|
801
|
+
xl?: string;
|
|
802
|
+
'2xl'?: string;
|
|
803
|
+
full?: string;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
components?: {
|
|
807
|
+
brokerCard?: {
|
|
808
|
+
width?: string;
|
|
809
|
+
height?: string;
|
|
810
|
+
logoSize?: string;
|
|
811
|
+
padding?: string;
|
|
812
|
+
};
|
|
813
|
+
statusIndicator?: {
|
|
814
|
+
size?: string;
|
|
815
|
+
glowIntensity?: number;
|
|
816
|
+
};
|
|
817
|
+
modal?: {
|
|
818
|
+
background?: string;
|
|
819
|
+
backdrop?: string;
|
|
820
|
+
};
|
|
821
|
+
brokerCardModern?: {
|
|
822
|
+
width?: string;
|
|
823
|
+
height?: string;
|
|
824
|
+
padding?: string;
|
|
825
|
+
logoSize?: string;
|
|
826
|
+
statusSize?: string;
|
|
827
|
+
};
|
|
828
|
+
connectButton?: {
|
|
829
|
+
width?: string;
|
|
830
|
+
height?: string;
|
|
831
|
+
};
|
|
832
|
+
themeSwitcher?: {
|
|
833
|
+
indicatorSize?: string;
|
|
834
|
+
};
|
|
835
|
+
};
|
|
836
|
+
effects?: {
|
|
837
|
+
glassmorphism?: {
|
|
838
|
+
enabled?: boolean;
|
|
839
|
+
blur?: string;
|
|
840
|
+
opacity?: number;
|
|
841
|
+
border?: string;
|
|
842
|
+
};
|
|
843
|
+
animations?: {
|
|
844
|
+
enabled?: boolean;
|
|
845
|
+
duration?: {
|
|
846
|
+
fast?: string;
|
|
847
|
+
normal?: string;
|
|
848
|
+
slow?: string;
|
|
699
849
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
hover: string;
|
|
705
|
-
active: string;
|
|
850
|
+
easing?: {
|
|
851
|
+
default?: string;
|
|
852
|
+
smooth?: string;
|
|
853
|
+
bounce?: string;
|
|
706
854
|
};
|
|
707
855
|
};
|
|
856
|
+
shadows?: {
|
|
857
|
+
sm?: string;
|
|
858
|
+
md?: string;
|
|
859
|
+
lg?: string;
|
|
860
|
+
xl?: string;
|
|
861
|
+
card?: string;
|
|
862
|
+
cardHover?: string;
|
|
863
|
+
glow?: string;
|
|
864
|
+
focus?: string;
|
|
865
|
+
};
|
|
708
866
|
};
|
|
709
867
|
branding?: {
|
|
868
|
+
logo?: string;
|
|
869
|
+
companyName?: string;
|
|
870
|
+
favicon?: string;
|
|
710
871
|
primaryColor?: string;
|
|
711
872
|
};
|
|
873
|
+
glow?: {
|
|
874
|
+
primary?: string;
|
|
875
|
+
secondary?: string;
|
|
876
|
+
card?: string;
|
|
877
|
+
cardHover?: string;
|
|
878
|
+
button?: string;
|
|
879
|
+
focus?: string;
|
|
880
|
+
scrollbar?: string;
|
|
881
|
+
};
|
|
882
|
+
gradients?: {
|
|
883
|
+
start?: string;
|
|
884
|
+
end?: string;
|
|
885
|
+
hoverStart?: string;
|
|
886
|
+
hoverEnd?: string;
|
|
887
|
+
};
|
|
712
888
|
}
|
|
713
889
|
type PortalThemePreset = 'dark' | 'light' | 'corporateBlue' | 'purple' | 'green' | 'orange';
|
|
714
890
|
interface PortalTheme {
|
|
@@ -771,6 +947,8 @@ interface PortalOptions {
|
|
|
771
947
|
theme?: PortalTheme;
|
|
772
948
|
/** Optional list of broker names to filter by (only these brokers will be shown) */
|
|
773
949
|
brokers?: string[];
|
|
950
|
+
/** Optional email address to prefill in the portal */
|
|
951
|
+
email?: string;
|
|
774
952
|
}
|
|
775
953
|
|
|
776
954
|
/**
|
|
@@ -920,17 +1098,10 @@ declare class ApiClient {
|
|
|
920
1098
|
* @throws SessionError if session is not in ACTIVE state
|
|
921
1099
|
*/
|
|
922
1100
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
923
|
-
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
924
1101
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
925
|
-
getHoldings(): Promise<{
|
|
926
|
-
data: Holding[];
|
|
927
|
-
}>;
|
|
928
1102
|
getOrders(): Promise<{
|
|
929
1103
|
data: Order[];
|
|
930
1104
|
}>;
|
|
931
|
-
getPortfolio(): Promise<{
|
|
932
|
-
data: Portfolio;
|
|
933
|
-
}>;
|
|
934
1105
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
935
1106
|
symbol: string;
|
|
936
1107
|
orderQty: number;
|
|
@@ -956,8 +1127,7 @@ declare class ApiClient {
|
|
|
956
1127
|
private buildOrderRequestBody;
|
|
957
1128
|
private buildModifyRequestBody;
|
|
958
1129
|
private applyBrokerDefaults;
|
|
959
|
-
|
|
960
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
1130
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
961
1131
|
/**
|
|
962
1132
|
* Get the current session state
|
|
963
1133
|
*/
|
|
@@ -1010,6 +1180,14 @@ declare class ApiClient {
|
|
|
1010
1180
|
warnings: null;
|
|
1011
1181
|
errors: null;
|
|
1012
1182
|
}>;
|
|
1183
|
+
getBrokerBalances(options?: BrokerDataOptions): Promise<{
|
|
1184
|
+
_id: string;
|
|
1185
|
+
response_data: BrokerBalance[];
|
|
1186
|
+
message: string;
|
|
1187
|
+
status_code: number;
|
|
1188
|
+
warnings: null;
|
|
1189
|
+
errors: null;
|
|
1190
|
+
}>;
|
|
1013
1191
|
getBrokerConnections(): Promise<{
|
|
1014
1192
|
_id: string;
|
|
1015
1193
|
response_data: BrokerConnection[];
|
|
@@ -1018,9 +1196,18 @@ declare class ApiClient {
|
|
|
1018
1196
|
warnings: null;
|
|
1019
1197
|
errors: null;
|
|
1020
1198
|
}>;
|
|
1199
|
+
getBalances(filters?: any): Promise<{
|
|
1200
|
+
_id: string;
|
|
1201
|
+
response_data: any[];
|
|
1202
|
+
message: string;
|
|
1203
|
+
status_code: number;
|
|
1204
|
+
warnings: null;
|
|
1205
|
+
errors: null;
|
|
1206
|
+
}>;
|
|
1021
1207
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerOrder[]>>;
|
|
1022
1208
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1023
1209
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerPosition[]>>;
|
|
1210
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1024
1211
|
getNextPage<T>(previousResult: PaginatedResult<T>, fetchFunction: (offset: number, limit: number) => Promise<PaginatedResult<T>>): Promise<PaginatedResult<T> | null>;
|
|
1025
1212
|
/**
|
|
1026
1213
|
* Check if this is a mock client
|
|
@@ -1078,6 +1265,11 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1078
1265
|
* @returns True if the user is fully authenticated and ready for API calls
|
|
1079
1266
|
*/
|
|
1080
1267
|
isAuthed(): boolean;
|
|
1268
|
+
/**
|
|
1269
|
+
* Check if the client is authenticated (alias for isAuthed for consistency)
|
|
1270
|
+
* @returns True if authenticated, false otherwise
|
|
1271
|
+
*/
|
|
1272
|
+
is_authenticated(): boolean;
|
|
1081
1273
|
/**
|
|
1082
1274
|
* Get user's orders with pagination and optional filtering
|
|
1083
1275
|
* @param params - Query parameters including page, perPage, and filters
|
|
@@ -1108,10 +1300,6 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1108
1300
|
perPage?: number;
|
|
1109
1301
|
filter?: AccountsFilter;
|
|
1110
1302
|
}): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1111
|
-
/**
|
|
1112
|
-
* Revoke the current user's access
|
|
1113
|
-
*/
|
|
1114
|
-
revokeToken(): Promise<void>;
|
|
1115
1303
|
/**
|
|
1116
1304
|
* Initialize the Finatic Connect SDK
|
|
1117
1305
|
* @param token - The portal token from your backend
|
|
@@ -1127,6 +1315,11 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1127
1315
|
* @param userId - The user ID from a previous session
|
|
1128
1316
|
*/
|
|
1129
1317
|
setUserId(userId: string): Promise<void>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Get the user and tokens for a completed session
|
|
1320
|
+
* @returns Promise with user information and tokens
|
|
1321
|
+
*/
|
|
1322
|
+
getSessionUser(): Promise<Record<string, any>>;
|
|
1130
1323
|
private initializeWithUser;
|
|
1131
1324
|
/**
|
|
1132
1325
|
* Handle company access error by opening the portal
|
|
@@ -1194,13 +1387,13 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1194
1387
|
* Set the broker context for trading
|
|
1195
1388
|
* @param broker - The broker to use for trading
|
|
1196
1389
|
*/
|
|
1197
|
-
|
|
1390
|
+
setTradingContextBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader' | 'interactive_brokers' | 'tradestation'): void;
|
|
1198
1391
|
/**
|
|
1199
1392
|
* Set the account context for trading
|
|
1200
1393
|
* @param accountNumber - The account number to use for trading
|
|
1201
1394
|
* @param accountId - Optional account ID
|
|
1202
1395
|
*/
|
|
1203
|
-
|
|
1396
|
+
setTradingContextAccount(accountNumber: string, accountId?: string): void;
|
|
1204
1397
|
/**
|
|
1205
1398
|
* Get the current trading context
|
|
1206
1399
|
*/
|
|
@@ -1217,6 +1410,34 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1217
1410
|
* Place a stock limit order (convenience method)
|
|
1218
1411
|
*/
|
|
1219
1412
|
placeStockLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Place a stock stop order (convenience method)
|
|
1415
|
+
*/
|
|
1416
|
+
placeStockStopOrder(symbol: string, quantity: number, side: 'buy' | 'sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Place a crypto market order (convenience method)
|
|
1419
|
+
*/
|
|
1420
|
+
placeCryptoMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Place a crypto limit order (convenience method)
|
|
1423
|
+
*/
|
|
1424
|
+
placeCryptoLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Place an options market order (convenience method)
|
|
1427
|
+
*/
|
|
1428
|
+
placeOptionsMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Place an options limit order (convenience method)
|
|
1431
|
+
*/
|
|
1432
|
+
placeOptionsLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1433
|
+
/**
|
|
1434
|
+
* Place a futures market order (convenience method)
|
|
1435
|
+
*/
|
|
1436
|
+
placeFuturesMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Place a futures limit order (convenience method)
|
|
1439
|
+
*/
|
|
1440
|
+
placeFuturesLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
1220
1441
|
/**
|
|
1221
1442
|
* Get the current user ID
|
|
1222
1443
|
* @returns The current user ID or undefined if not authenticated
|
|
@@ -1302,6 +1523,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1302
1523
|
* @returns Promise with paginated accounts result
|
|
1303
1524
|
*/
|
|
1304
1525
|
getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1526
|
+
getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1305
1527
|
/**
|
|
1306
1528
|
* Get the next page of orders
|
|
1307
1529
|
* @param previousResult - The previous paginated result
|
|
@@ -1320,6 +1542,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1320
1542
|
* @returns Promise with next page of accounts or null if no more pages
|
|
1321
1543
|
*/
|
|
1322
1544
|
getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
|
|
1545
|
+
getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
|
|
1323
1546
|
/**
|
|
1324
1547
|
* Get all orders across all pages (convenience method)
|
|
1325
1548
|
* @param filter - Optional filter parameters
|
|
@@ -1338,6 +1561,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1338
1561
|
* @returns Promise with all accounts
|
|
1339
1562
|
*/
|
|
1340
1563
|
getAllAccounts(filter?: AccountsFilter): Promise<BrokerDataAccount[]>;
|
|
1564
|
+
getAllBalances(filter?: BalancesFilter): Promise<BrokerBalance[]>;
|
|
1341
1565
|
/**
|
|
1342
1566
|
* Register session management (but don't auto-cleanup for 24-hour sessions)
|
|
1343
1567
|
*/
|
|
@@ -1498,12 +1722,6 @@ declare class MockDataProvider {
|
|
|
1498
1722
|
warnings: null;
|
|
1499
1723
|
errors: null;
|
|
1500
1724
|
}>;
|
|
1501
|
-
mockGetHoldings(): Promise<{
|
|
1502
|
-
data: Holding[];
|
|
1503
|
-
}>;
|
|
1504
|
-
mockGetPortfolio(): Promise<{
|
|
1505
|
-
data: Portfolio;
|
|
1506
|
-
}>;
|
|
1507
1725
|
mockGetOrders(filter?: OrdersFilter): Promise<{
|
|
1508
1726
|
data: Order[];
|
|
1509
1727
|
}>;
|
|
@@ -1513,6 +1731,9 @@ declare class MockDataProvider {
|
|
|
1513
1731
|
mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
|
|
1514
1732
|
data: BrokerDataPosition[];
|
|
1515
1733
|
}>;
|
|
1734
|
+
mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
|
|
1735
|
+
data: BrokerBalance[];
|
|
1736
|
+
}>;
|
|
1516
1737
|
mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
|
|
1517
1738
|
data: BrokerAccount[];
|
|
1518
1739
|
}>;
|
|
@@ -1524,7 +1745,7 @@ declare class MockDataProvider {
|
|
|
1524
1745
|
/**
|
|
1525
1746
|
* Get stored user token
|
|
1526
1747
|
*/
|
|
1527
|
-
getUserToken(
|
|
1748
|
+
getUserToken(sessionId: string): UserToken | undefined;
|
|
1528
1749
|
/**
|
|
1529
1750
|
* Clear all stored data
|
|
1530
1751
|
*/
|
|
@@ -1539,6 +1760,7 @@ declare class MockDataProvider {
|
|
|
1539
1760
|
private applyBrokerOrderFilters;
|
|
1540
1761
|
private applyBrokerPositionFilters;
|
|
1541
1762
|
private applyBrokerAccountFilters;
|
|
1763
|
+
private applyBrokerBalanceFilters;
|
|
1542
1764
|
/**
|
|
1543
1765
|
* Generate mock orders with diverse data
|
|
1544
1766
|
*/
|
|
@@ -1628,15 +1850,9 @@ declare class MockApiClient {
|
|
|
1628
1850
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
1629
1851
|
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
1630
1852
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
1631
|
-
getHoldings(filter?: OrdersFilter): Promise<{
|
|
1632
|
-
data: Holding[];
|
|
1633
|
-
}>;
|
|
1634
1853
|
getOrders(filter?: OrdersFilter): Promise<{
|
|
1635
1854
|
data: Order[];
|
|
1636
1855
|
}>;
|
|
1637
|
-
getPortfolio(): Promise<{
|
|
1638
|
-
data: Portfolio;
|
|
1639
|
-
}>;
|
|
1640
1856
|
placeOrder(order: BrokerOrderParams): Promise<void>;
|
|
1641
1857
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
1642
1858
|
symbol: string;
|
|
@@ -1660,8 +1876,7 @@ declare class MockApiClient {
|
|
|
1660
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>;
|
|
1661
1877
|
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1662
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>;
|
|
1663
|
-
|
|
1664
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
1879
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
1665
1880
|
getCurrentSessionState(): SessionState | null;
|
|
1666
1881
|
getBrokerList(): Promise<{
|
|
1667
1882
|
_id: string;
|
|
@@ -1701,12 +1916,16 @@ declare class MockApiClient {
|
|
|
1701
1916
|
getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
|
|
1702
1917
|
data: BrokerDataPosition[];
|
|
1703
1918
|
}>;
|
|
1919
|
+
getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
|
|
1920
|
+
data: BrokerBalance[];
|
|
1921
|
+
}>;
|
|
1704
1922
|
getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
|
|
1705
1923
|
data: BrokerAccount[];
|
|
1706
1924
|
}>;
|
|
1707
1925
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1708
1926
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1709
1927
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1928
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1710
1929
|
getBrokerConnections(): Promise<{
|
|
1711
1930
|
_id: string;
|
|
1712
1931
|
response_data: BrokerConnection[];
|
|
@@ -1773,4 +1992,4 @@ declare class MockFactory {
|
|
|
1773
1992
|
}
|
|
1774
1993
|
|
|
1775
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 };
|
|
1776
|
-
export type { AccountsFilter, ApiConfig, ApiResponse, BrokerAccount, BrokerConnection, BrokerDataAccount, BrokerDataOptions, BrokerDataOrder, BrokerDataPosition, BrokerExtras, BrokerInfo, BrokerOrder, BrokerOrderParams, BrokerPosition, CryptoOrderOptions, DeviceInfo$1 as DeviceInfo, FilteredAccountsResponse, 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 };
|
|
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 };
|