@finatic/client 0.0.136 → 0.0.137
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 +288 -88
- package/dist/index.js +1243 -258
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1243 -258
- 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 +39 -21
- 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/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
|
|
@@ -1191,32 +1384,41 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1191
1384
|
order_id?: string;
|
|
1192
1385
|
}>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', connection_id?: string): Promise<OrderResponse>;
|
|
1193
1386
|
/**
|
|
1194
|
-
*
|
|
1195
|
-
* @param broker - The broker to use for trading
|
|
1387
|
+
* Place a stock market order (convenience method)
|
|
1196
1388
|
*/
|
|
1197
|
-
|
|
1389
|
+
placeStockMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1198
1390
|
/**
|
|
1199
|
-
*
|
|
1200
|
-
* @param accountNumber - The account number to use for trading
|
|
1201
|
-
* @param accountId - Optional account ID
|
|
1391
|
+
* Place a stock limit order (convenience method)
|
|
1202
1392
|
*/
|
|
1203
|
-
|
|
1393
|
+
placeStockLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1204
1394
|
/**
|
|
1205
|
-
*
|
|
1395
|
+
* Place a stock stop order (convenience method)
|
|
1206
1396
|
*/
|
|
1207
|
-
|
|
1397
|
+
placeStockStopOrder(symbol: string, quantity: number, side: 'buy' | 'sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1208
1398
|
/**
|
|
1209
|
-
*
|
|
1399
|
+
* Place a crypto market order (convenience method)
|
|
1210
1400
|
*/
|
|
1211
|
-
|
|
1401
|
+
placeCryptoMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1212
1402
|
/**
|
|
1213
|
-
* Place a
|
|
1403
|
+
* Place a crypto limit order (convenience method)
|
|
1214
1404
|
*/
|
|
1215
|
-
|
|
1405
|
+
placeCryptoLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1216
1406
|
/**
|
|
1217
|
-
* Place
|
|
1407
|
+
* Place an options market order (convenience method)
|
|
1218
1408
|
*/
|
|
1219
|
-
|
|
1409
|
+
placeOptionsMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Place an options limit order (convenience method)
|
|
1412
|
+
*/
|
|
1413
|
+
placeOptionsLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Place a futures market order (convenience method)
|
|
1416
|
+
*/
|
|
1417
|
+
placeFuturesMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Place a futures limit order (convenience method)
|
|
1420
|
+
*/
|
|
1421
|
+
placeFuturesLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
1220
1422
|
/**
|
|
1221
1423
|
* Get the current user ID
|
|
1222
1424
|
* @returns The current user ID or undefined if not authenticated
|
|
@@ -1302,6 +1504,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1302
1504
|
* @returns Promise with paginated accounts result
|
|
1303
1505
|
*/
|
|
1304
1506
|
getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1507
|
+
getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1305
1508
|
/**
|
|
1306
1509
|
* Get the next page of orders
|
|
1307
1510
|
* @param previousResult - The previous paginated result
|
|
@@ -1320,6 +1523,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1320
1523
|
* @returns Promise with next page of accounts or null if no more pages
|
|
1321
1524
|
*/
|
|
1322
1525
|
getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
|
|
1526
|
+
getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
|
|
1323
1527
|
/**
|
|
1324
1528
|
* Get all orders across all pages (convenience method)
|
|
1325
1529
|
* @param filter - Optional filter parameters
|
|
@@ -1338,6 +1542,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1338
1542
|
* @returns Promise with all accounts
|
|
1339
1543
|
*/
|
|
1340
1544
|
getAllAccounts(filter?: AccountsFilter): Promise<BrokerDataAccount[]>;
|
|
1545
|
+
getAllBalances(filter?: BalancesFilter): Promise<BrokerBalance[]>;
|
|
1341
1546
|
/**
|
|
1342
1547
|
* Register session management (but don't auto-cleanup for 24-hour sessions)
|
|
1343
1548
|
*/
|
|
@@ -1498,12 +1703,6 @@ declare class MockDataProvider {
|
|
|
1498
1703
|
warnings: null;
|
|
1499
1704
|
errors: null;
|
|
1500
1705
|
}>;
|
|
1501
|
-
mockGetHoldings(): Promise<{
|
|
1502
|
-
data: Holding[];
|
|
1503
|
-
}>;
|
|
1504
|
-
mockGetPortfolio(): Promise<{
|
|
1505
|
-
data: Portfolio;
|
|
1506
|
-
}>;
|
|
1507
1706
|
mockGetOrders(filter?: OrdersFilter): Promise<{
|
|
1508
1707
|
data: Order[];
|
|
1509
1708
|
}>;
|
|
@@ -1513,6 +1712,9 @@ declare class MockDataProvider {
|
|
|
1513
1712
|
mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
|
|
1514
1713
|
data: BrokerDataPosition[];
|
|
1515
1714
|
}>;
|
|
1715
|
+
mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
|
|
1716
|
+
data: BrokerBalance[];
|
|
1717
|
+
}>;
|
|
1516
1718
|
mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
|
|
1517
1719
|
data: BrokerAccount[];
|
|
1518
1720
|
}>;
|
|
@@ -1524,7 +1726,7 @@ declare class MockDataProvider {
|
|
|
1524
1726
|
/**
|
|
1525
1727
|
* Get stored user token
|
|
1526
1728
|
*/
|
|
1527
|
-
getUserToken(
|
|
1729
|
+
getUserToken(sessionId: string): UserToken | undefined;
|
|
1528
1730
|
/**
|
|
1529
1731
|
* Clear all stored data
|
|
1530
1732
|
*/
|
|
@@ -1539,6 +1741,7 @@ declare class MockDataProvider {
|
|
|
1539
1741
|
private applyBrokerOrderFilters;
|
|
1540
1742
|
private applyBrokerPositionFilters;
|
|
1541
1743
|
private applyBrokerAccountFilters;
|
|
1744
|
+
private applyBrokerBalanceFilters;
|
|
1542
1745
|
/**
|
|
1543
1746
|
* Generate mock orders with diverse data
|
|
1544
1747
|
*/
|
|
@@ -1628,15 +1831,9 @@ declare class MockApiClient {
|
|
|
1628
1831
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
1629
1832
|
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
1630
1833
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
1631
|
-
getHoldings(filter?: OrdersFilter): Promise<{
|
|
1632
|
-
data: Holding[];
|
|
1633
|
-
}>;
|
|
1634
1834
|
getOrders(filter?: OrdersFilter): Promise<{
|
|
1635
1835
|
data: Order[];
|
|
1636
1836
|
}>;
|
|
1637
|
-
getPortfolio(): Promise<{
|
|
1638
|
-
data: Portfolio;
|
|
1639
|
-
}>;
|
|
1640
1837
|
placeOrder(order: BrokerOrderParams): Promise<void>;
|
|
1641
1838
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
1642
1839
|
symbol: string;
|
|
@@ -1660,8 +1857,7 @@ declare class MockApiClient {
|
|
|
1660
1857
|
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
1858
|
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1662
1859
|
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>;
|
|
1860
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
1665
1861
|
getCurrentSessionState(): SessionState | null;
|
|
1666
1862
|
getBrokerList(): Promise<{
|
|
1667
1863
|
_id: string;
|
|
@@ -1701,12 +1897,16 @@ declare class MockApiClient {
|
|
|
1701
1897
|
getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
|
|
1702
1898
|
data: BrokerDataPosition[];
|
|
1703
1899
|
}>;
|
|
1900
|
+
getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
|
|
1901
|
+
data: BrokerBalance[];
|
|
1902
|
+
}>;
|
|
1704
1903
|
getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
|
|
1705
1904
|
data: BrokerAccount[];
|
|
1706
1905
|
}>;
|
|
1707
1906
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1708
1907
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1709
1908
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1909
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1710
1910
|
getBrokerConnections(): Promise<{
|
|
1711
1911
|
_id: string;
|
|
1712
1912
|
response_data: BrokerConnection[];
|
|
@@ -1773,4 +1973,4 @@ declare class MockFactory {
|
|
|
1773
1973
|
}
|
|
1774
1974
|
|
|
1775
1975
|
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 };
|
|
1976
|
+
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 };
|