@finatic/client 0.0.135 → 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 +292 -89
- package/dist/index.js +1244 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1244 -250
- 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/api/errors.d.ts +8 -0
- package/dist/types/types/connect.d.ts +2 -0
- package/dist/types/types/portal.d.ts +178 -49
- package/dist/types/utils/errors.d.ts +3 -0
- 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
|
/**
|
|
@@ -836,6 +1014,9 @@ declare class OrderError extends ApiError {
|
|
|
836
1014
|
declare class OrderValidationError extends ApiError {
|
|
837
1015
|
constructor(message: string, details?: Record<string, any>);
|
|
838
1016
|
}
|
|
1017
|
+
declare class TradingNotEnabledError extends ApiError {
|
|
1018
|
+
constructor(message: string, details?: Record<string, any>);
|
|
1019
|
+
}
|
|
839
1020
|
|
|
840
1021
|
declare class ApiClient {
|
|
841
1022
|
private readonly baseUrl;
|
|
@@ -917,17 +1098,10 @@ declare class ApiClient {
|
|
|
917
1098
|
* @throws SessionError if session is not in ACTIVE state
|
|
918
1099
|
*/
|
|
919
1100
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
920
|
-
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
921
1101
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
922
|
-
getHoldings(): Promise<{
|
|
923
|
-
data: Holding[];
|
|
924
|
-
}>;
|
|
925
1102
|
getOrders(): Promise<{
|
|
926
1103
|
data: Order[];
|
|
927
1104
|
}>;
|
|
928
|
-
getPortfolio(): Promise<{
|
|
929
|
-
data: Portfolio;
|
|
930
|
-
}>;
|
|
931
1105
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
932
1106
|
symbol: string;
|
|
933
1107
|
orderQty: number;
|
|
@@ -953,8 +1127,7 @@ declare class ApiClient {
|
|
|
953
1127
|
private buildOrderRequestBody;
|
|
954
1128
|
private buildModifyRequestBody;
|
|
955
1129
|
private applyBrokerDefaults;
|
|
956
|
-
|
|
957
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
1130
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
958
1131
|
/**
|
|
959
1132
|
* Get the current session state
|
|
960
1133
|
*/
|
|
@@ -1007,6 +1180,14 @@ declare class ApiClient {
|
|
|
1007
1180
|
warnings: null;
|
|
1008
1181
|
errors: null;
|
|
1009
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
|
+
}>;
|
|
1010
1191
|
getBrokerConnections(): Promise<{
|
|
1011
1192
|
_id: string;
|
|
1012
1193
|
response_data: BrokerConnection[];
|
|
@@ -1015,9 +1196,18 @@ declare class ApiClient {
|
|
|
1015
1196
|
warnings: null;
|
|
1016
1197
|
errors: null;
|
|
1017
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
|
+
}>;
|
|
1018
1207
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerOrder[]>>;
|
|
1019
1208
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1020
1209
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerPosition[]>>;
|
|
1210
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1021
1211
|
getNextPage<T>(previousResult: PaginatedResult<T>, fetchFunction: (offset: number, limit: number) => Promise<PaginatedResult<T>>): Promise<PaginatedResult<T> | null>;
|
|
1022
1212
|
/**
|
|
1023
1213
|
* Check if this is a mock client
|
|
@@ -1075,6 +1265,11 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1075
1265
|
* @returns True if the user is fully authenticated and ready for API calls
|
|
1076
1266
|
*/
|
|
1077
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;
|
|
1078
1273
|
/**
|
|
1079
1274
|
* Get user's orders with pagination and optional filtering
|
|
1080
1275
|
* @param params - Query parameters including page, perPage, and filters
|
|
@@ -1105,10 +1300,6 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1105
1300
|
perPage?: number;
|
|
1106
1301
|
filter?: AccountsFilter;
|
|
1107
1302
|
}): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1108
|
-
/**
|
|
1109
|
-
* Revoke the current user's access
|
|
1110
|
-
*/
|
|
1111
|
-
revokeToken(): Promise<void>;
|
|
1112
1303
|
/**
|
|
1113
1304
|
* Initialize the Finatic Connect SDK
|
|
1114
1305
|
* @param token - The portal token from your backend
|
|
@@ -1124,6 +1315,11 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1124
1315
|
* @param userId - The user ID from a previous session
|
|
1125
1316
|
*/
|
|
1126
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>>;
|
|
1127
1323
|
private initializeWithUser;
|
|
1128
1324
|
/**
|
|
1129
1325
|
* Handle company access error by opening the portal
|
|
@@ -1188,32 +1384,41 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1188
1384
|
order_id?: string;
|
|
1189
1385
|
}>, broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', connection_id?: string): Promise<OrderResponse>;
|
|
1190
1386
|
/**
|
|
1191
|
-
*
|
|
1192
|
-
* @param broker - The broker to use for trading
|
|
1387
|
+
* Place a stock market order (convenience method)
|
|
1193
1388
|
*/
|
|
1194
|
-
|
|
1389
|
+
placeStockMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1195
1390
|
/**
|
|
1196
|
-
*
|
|
1197
|
-
* @param accountNumber - The account number to use for trading
|
|
1198
|
-
* @param accountId - Optional account ID
|
|
1391
|
+
* Place a stock limit order (convenience method)
|
|
1199
1392
|
*/
|
|
1200
|
-
|
|
1393
|
+
placeStockLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1201
1394
|
/**
|
|
1202
|
-
*
|
|
1395
|
+
* Place a stock stop order (convenience method)
|
|
1203
1396
|
*/
|
|
1204
|
-
|
|
1397
|
+
placeStockStopOrder(symbol: string, quantity: number, side: 'buy' | 'sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
1205
1398
|
/**
|
|
1206
|
-
*
|
|
1399
|
+
* Place a crypto market order (convenience method)
|
|
1207
1400
|
*/
|
|
1208
|
-
|
|
1401
|
+
placeCryptoMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1209
1402
|
/**
|
|
1210
|
-
* Place a
|
|
1403
|
+
* Place a crypto limit order (convenience method)
|
|
1211
1404
|
*/
|
|
1212
|
-
|
|
1405
|
+
placeCryptoLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
1213
1406
|
/**
|
|
1214
|
-
* Place
|
|
1407
|
+
* Place an options market order (convenience method)
|
|
1215
1408
|
*/
|
|
1216
|
-
|
|
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>;
|
|
1217
1422
|
/**
|
|
1218
1423
|
* Get the current user ID
|
|
1219
1424
|
* @returns The current user ID or undefined if not authenticated
|
|
@@ -1299,6 +1504,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1299
1504
|
* @returns Promise with paginated accounts result
|
|
1300
1505
|
*/
|
|
1301
1506
|
getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
1507
|
+
getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1302
1508
|
/**
|
|
1303
1509
|
* Get the next page of orders
|
|
1304
1510
|
* @param previousResult - The previous paginated result
|
|
@@ -1317,6 +1523,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1317
1523
|
* @returns Promise with next page of accounts or null if no more pages
|
|
1318
1524
|
*/
|
|
1319
1525
|
getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
|
|
1526
|
+
getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
|
|
1320
1527
|
/**
|
|
1321
1528
|
* Get all orders across all pages (convenience method)
|
|
1322
1529
|
* @param filter - Optional filter parameters
|
|
@@ -1335,6 +1542,7 @@ declare class FinaticConnect extends EventEmitter {
|
|
|
1335
1542
|
* @returns Promise with all accounts
|
|
1336
1543
|
*/
|
|
1337
1544
|
getAllAccounts(filter?: AccountsFilter): Promise<BrokerDataAccount[]>;
|
|
1545
|
+
getAllBalances(filter?: BalancesFilter): Promise<BrokerBalance[]>;
|
|
1338
1546
|
/**
|
|
1339
1547
|
* Register session management (but don't auto-cleanup for 24-hour sessions)
|
|
1340
1548
|
*/
|
|
@@ -1495,12 +1703,6 @@ declare class MockDataProvider {
|
|
|
1495
1703
|
warnings: null;
|
|
1496
1704
|
errors: null;
|
|
1497
1705
|
}>;
|
|
1498
|
-
mockGetHoldings(): Promise<{
|
|
1499
|
-
data: Holding[];
|
|
1500
|
-
}>;
|
|
1501
|
-
mockGetPortfolio(): Promise<{
|
|
1502
|
-
data: Portfolio;
|
|
1503
|
-
}>;
|
|
1504
1706
|
mockGetOrders(filter?: OrdersFilter): Promise<{
|
|
1505
1707
|
data: Order[];
|
|
1506
1708
|
}>;
|
|
@@ -1510,6 +1712,9 @@ declare class MockDataProvider {
|
|
|
1510
1712
|
mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
|
|
1511
1713
|
data: BrokerDataPosition[];
|
|
1512
1714
|
}>;
|
|
1715
|
+
mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
|
|
1716
|
+
data: BrokerBalance[];
|
|
1717
|
+
}>;
|
|
1513
1718
|
mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
|
|
1514
1719
|
data: BrokerAccount[];
|
|
1515
1720
|
}>;
|
|
@@ -1521,7 +1726,7 @@ declare class MockDataProvider {
|
|
|
1521
1726
|
/**
|
|
1522
1727
|
* Get stored user token
|
|
1523
1728
|
*/
|
|
1524
|
-
getUserToken(
|
|
1729
|
+
getUserToken(sessionId: string): UserToken | undefined;
|
|
1525
1730
|
/**
|
|
1526
1731
|
* Clear all stored data
|
|
1527
1732
|
*/
|
|
@@ -1536,6 +1741,7 @@ declare class MockDataProvider {
|
|
|
1536
1741
|
private applyBrokerOrderFilters;
|
|
1537
1742
|
private applyBrokerPositionFilters;
|
|
1538
1743
|
private applyBrokerAccountFilters;
|
|
1744
|
+
private applyBrokerBalanceFilters;
|
|
1539
1745
|
/**
|
|
1540
1746
|
* Generate mock orders with diverse data
|
|
1541
1747
|
*/
|
|
@@ -1625,15 +1831,9 @@ declare class MockApiClient {
|
|
|
1625
1831
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
1626
1832
|
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
1627
1833
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
1628
|
-
getHoldings(filter?: OrdersFilter): Promise<{
|
|
1629
|
-
data: Holding[];
|
|
1630
|
-
}>;
|
|
1631
1834
|
getOrders(filter?: OrdersFilter): Promise<{
|
|
1632
1835
|
data: Order[];
|
|
1633
1836
|
}>;
|
|
1634
|
-
getPortfolio(): Promise<{
|
|
1635
|
-
data: Portfolio;
|
|
1636
|
-
}>;
|
|
1637
1837
|
placeOrder(order: BrokerOrderParams): Promise<void>;
|
|
1638
1838
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
1639
1839
|
symbol: string;
|
|
@@ -1657,8 +1857,7 @@ declare class MockApiClient {
|
|
|
1657
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>;
|
|
1658
1858
|
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
1659
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>;
|
|
1660
|
-
|
|
1661
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
1860
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
1662
1861
|
getCurrentSessionState(): SessionState | null;
|
|
1663
1862
|
getBrokerList(): Promise<{
|
|
1664
1863
|
_id: string;
|
|
@@ -1698,12 +1897,16 @@ declare class MockApiClient {
|
|
|
1698
1897
|
getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
|
|
1699
1898
|
data: BrokerDataPosition[];
|
|
1700
1899
|
}>;
|
|
1900
|
+
getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
|
|
1901
|
+
data: BrokerBalance[];
|
|
1902
|
+
}>;
|
|
1701
1903
|
getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
|
|
1702
1904
|
data: BrokerAccount[];
|
|
1703
1905
|
}>;
|
|
1704
1906
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
1705
1907
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
1706
1908
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
1909
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
1707
1910
|
getBrokerConnections(): Promise<{
|
|
1708
1911
|
_id: string;
|
|
1709
1912
|
response_data: BrokerConnection[];
|
|
@@ -1769,5 +1972,5 @@ declare class MockFactory {
|
|
|
1769
1972
|
};
|
|
1770
1973
|
}
|
|
1771
1974
|
|
|
1772
|
-
export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, MockFactory, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
|
|
1773
|
-
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 };
|
|
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 };
|
|
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 };
|