@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
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Holding, Portfolio } from '../../types/api/portfolio';
|
|
2
1
|
import { Order } from '../../types/api/orders';
|
|
3
|
-
import { BrokerInfo, BrokerAccount, BrokerOrder, BrokerPosition, BrokerDataOptions, DisconnectCompanyResponse } from '../../types/api/broker';
|
|
2
|
+
import { BrokerInfo, BrokerAccount, BrokerOrder, BrokerPosition, BrokerBalance, BrokerDataOptions, DisconnectCompanyResponse } from '../../types/api/broker';
|
|
4
3
|
import { BrokerOrderParams, BrokerExtras } from '../../types/api/broker';
|
|
5
4
|
import { CryptoOrderOptions, OptionsOrderOptions, OrderResponse } from '../../types/api/orders';
|
|
6
5
|
import { BrokerConnection } from '../../types/api/broker';
|
|
7
|
-
import { OrdersFilter, PositionsFilter, AccountsFilter } from '../../types/api/broker';
|
|
6
|
+
import { OrdersFilter, PositionsFilter, AccountsFilter, BalancesFilter } from '../../types/api/broker';
|
|
8
7
|
import { TradingContext } from '../../types/api/orders';
|
|
9
8
|
import { PaginatedResult } from '../../types/common/pagination';
|
|
10
9
|
import { PortalUrlResponse } from '../../types/api/core';
|
|
11
|
-
import { DeviceInfo, SessionState, TokenInfo, SessionResponse, OtpRequestResponse, OtpVerifyResponse,
|
|
10
|
+
import { DeviceInfo, SessionState, TokenInfo, SessionResponse, OtpRequestResponse, OtpVerifyResponse, SessionAuthenticateResponse, UserToken } from '../../types/api/auth';
|
|
12
11
|
import { ApiError } from '../../utils/errors';
|
|
13
12
|
export declare class ApiClient {
|
|
14
13
|
private readonly baseUrl;
|
|
@@ -90,17 +89,10 @@ export declare class ApiClient {
|
|
|
90
89
|
* @throws SessionError if session is not in ACTIVE state
|
|
91
90
|
*/
|
|
92
91
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
93
|
-
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
94
92
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
95
|
-
getHoldings(): Promise<{
|
|
96
|
-
data: Holding[];
|
|
97
|
-
}>;
|
|
98
93
|
getOrders(): Promise<{
|
|
99
94
|
data: Order[];
|
|
100
95
|
}>;
|
|
101
|
-
getPortfolio(): Promise<{
|
|
102
|
-
data: Portfolio;
|
|
103
|
-
}>;
|
|
104
96
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
105
97
|
symbol: string;
|
|
106
98
|
orderQty: number;
|
|
@@ -126,8 +118,7 @@ export declare class ApiClient {
|
|
|
126
118
|
private buildOrderRequestBody;
|
|
127
119
|
private buildModifyRequestBody;
|
|
128
120
|
private applyBrokerDefaults;
|
|
129
|
-
|
|
130
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
121
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
131
122
|
/**
|
|
132
123
|
* Get the current session state
|
|
133
124
|
*/
|
|
@@ -180,6 +171,14 @@ export declare class ApiClient {
|
|
|
180
171
|
warnings: null;
|
|
181
172
|
errors: null;
|
|
182
173
|
}>;
|
|
174
|
+
getBrokerBalances(options?: BrokerDataOptions): Promise<{
|
|
175
|
+
_id: string;
|
|
176
|
+
response_data: BrokerBalance[];
|
|
177
|
+
message: string;
|
|
178
|
+
status_code: number;
|
|
179
|
+
warnings: null;
|
|
180
|
+
errors: null;
|
|
181
|
+
}>;
|
|
183
182
|
getBrokerConnections(): Promise<{
|
|
184
183
|
_id: string;
|
|
185
184
|
response_data: BrokerConnection[];
|
|
@@ -188,9 +187,18 @@ export declare class ApiClient {
|
|
|
188
187
|
warnings: null;
|
|
189
188
|
errors: null;
|
|
190
189
|
}>;
|
|
190
|
+
getBalances(filters?: any): Promise<{
|
|
191
|
+
_id: string;
|
|
192
|
+
response_data: any[];
|
|
193
|
+
message: string;
|
|
194
|
+
status_code: number;
|
|
195
|
+
warnings: null;
|
|
196
|
+
errors: null;
|
|
197
|
+
}>;
|
|
191
198
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerOrder[]>>;
|
|
192
199
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
193
200
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerPosition[]>>;
|
|
201
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
194
202
|
getNextPage<T>(previousResult: PaginatedResult<T>, fetchFunction: (offset: number, limit: number) => Promise<PaginatedResult<T>>): Promise<PaginatedResult<T> | null>;
|
|
195
203
|
/**
|
|
196
204
|
* Check if this is a mock client
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '../../utils/events';
|
|
2
2
|
import { PaginatedResult } from '../../types/common/pagination';
|
|
3
3
|
import { OrderResponse, TradingContext } from '../../types/api/orders';
|
|
4
|
-
import { BrokerInfo, BrokerConnection, OrdersFilter, PositionsFilter, AccountsFilter, BrokerDataOrder, BrokerDataPosition, BrokerDataAccount, DisconnectCompanyResponse } from '../../types/api/broker';
|
|
4
|
+
import { BrokerBalance, BrokerInfo, BrokerConnection, OrdersFilter, PositionsFilter, AccountsFilter, BalancesFilter, BrokerDataOrder, BrokerDataPosition, BrokerDataAccount, DisconnectCompanyResponse } from '../../types/api/broker';
|
|
5
5
|
import { FinaticConnectOptions, PortalOptions } from '../../types/connect';
|
|
6
6
|
interface DeviceInfo {
|
|
7
7
|
ip_address: string;
|
|
@@ -34,6 +34,11 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
34
34
|
* @returns True if the user is fully authenticated and ready for API calls
|
|
35
35
|
*/
|
|
36
36
|
isAuthed(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the client is authenticated (alias for isAuthed for consistency)
|
|
39
|
+
* @returns True if authenticated, false otherwise
|
|
40
|
+
*/
|
|
41
|
+
is_authenticated(): boolean;
|
|
37
42
|
/**
|
|
38
43
|
* Get user's orders with pagination and optional filtering
|
|
39
44
|
* @param params - Query parameters including page, perPage, and filters
|
|
@@ -64,10 +69,6 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
64
69
|
perPage?: number;
|
|
65
70
|
filter?: AccountsFilter;
|
|
66
71
|
}): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
67
|
-
/**
|
|
68
|
-
* Revoke the current user's access
|
|
69
|
-
*/
|
|
70
|
-
revokeToken(): Promise<void>;
|
|
71
72
|
/**
|
|
72
73
|
* Initialize the Finatic Connect SDK
|
|
73
74
|
* @param token - The portal token from your backend
|
|
@@ -83,6 +84,11 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
83
84
|
* @param userId - The user ID from a previous session
|
|
84
85
|
*/
|
|
85
86
|
setUserId(userId: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Get the user and tokens for a completed session
|
|
89
|
+
* @returns Promise with user information and tokens
|
|
90
|
+
*/
|
|
91
|
+
getSessionUser(): Promise<Record<string, any>>;
|
|
86
92
|
private initializeWithUser;
|
|
87
93
|
/**
|
|
88
94
|
* Handle company access error by opening the portal
|
|
@@ -150,13 +156,13 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
150
156
|
* Set the broker context for trading
|
|
151
157
|
* @param broker - The broker to use for trading
|
|
152
158
|
*/
|
|
153
|
-
|
|
159
|
+
setTradingContextBroker(broker: 'robinhood' | 'tasty_trade' | 'ninja_trader' | 'interactive_brokers' | 'tradestation'): void;
|
|
154
160
|
/**
|
|
155
161
|
* Set the account context for trading
|
|
156
162
|
* @param accountNumber - The account number to use for trading
|
|
157
163
|
* @param accountId - Optional account ID
|
|
158
164
|
*/
|
|
159
|
-
|
|
165
|
+
setTradingContextAccount(accountNumber: string, accountId?: string): void;
|
|
160
166
|
/**
|
|
161
167
|
* Get the current trading context
|
|
162
168
|
*/
|
|
@@ -173,6 +179,34 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
173
179
|
* Place a stock limit order (convenience method)
|
|
174
180
|
*/
|
|
175
181
|
placeStockLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Place a stock stop order (convenience method)
|
|
184
|
+
*/
|
|
185
|
+
placeStockStopOrder(symbol: string, quantity: number, side: 'buy' | 'sell', stopPrice: number, timeInForce?: 'day' | 'gtc', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* Place a crypto market order (convenience method)
|
|
188
|
+
*/
|
|
189
|
+
placeCryptoMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
190
|
+
/**
|
|
191
|
+
* Place a crypto limit order (convenience method)
|
|
192
|
+
*/
|
|
193
|
+
placeCryptoLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'coinbase' | 'binance' | 'kraken', accountNumber?: string): Promise<OrderResponse>;
|
|
194
|
+
/**
|
|
195
|
+
* Place an options market order (convenience method)
|
|
196
|
+
*/
|
|
197
|
+
placeOptionsMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* Place an options limit order (convenience method)
|
|
200
|
+
*/
|
|
201
|
+
placeOptionsLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'tasty_trade' | 'robinhood' | 'ninja_trader', accountNumber?: string): Promise<OrderResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Place a futures market order (convenience method)
|
|
204
|
+
*/
|
|
205
|
+
placeFuturesMarketOrder(symbol: string, quantity: number, side: 'buy' | 'sell', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Place a futures limit order (convenience method)
|
|
208
|
+
*/
|
|
209
|
+
placeFuturesLimitOrder(symbol: string, quantity: number, side: 'buy' | 'sell', price: number, timeInForce?: 'day' | 'gtc', broker?: 'ninja_trader' | 'tasty_trade', accountNumber?: string): Promise<OrderResponse>;
|
|
176
210
|
/**
|
|
177
211
|
* Get the current user ID
|
|
178
212
|
* @returns The current user ID or undefined if not authenticated
|
|
@@ -258,6 +292,7 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
258
292
|
* @returns Promise with paginated accounts result
|
|
259
293
|
*/
|
|
260
294
|
getAccountsPage(page?: number, perPage?: number, filter?: AccountsFilter): Promise<PaginatedResult<BrokerDataAccount[]>>;
|
|
295
|
+
getBalancesPage(page?: number, perPage?: number, filter?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
261
296
|
/**
|
|
262
297
|
* Get the next page of orders
|
|
263
298
|
* @param previousResult - The previous paginated result
|
|
@@ -276,6 +311,7 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
276
311
|
* @returns Promise with next page of accounts or null if no more pages
|
|
277
312
|
*/
|
|
278
313
|
getNextAccountsPage(previousResult: PaginatedResult<BrokerDataAccount[]>): Promise<PaginatedResult<BrokerDataAccount[]> | null>;
|
|
314
|
+
getNextBalancesPage(previousResult: PaginatedResult<BrokerBalance[]>): Promise<PaginatedResult<BrokerBalance[]> | null>;
|
|
279
315
|
/**
|
|
280
316
|
* Get all orders across all pages (convenience method)
|
|
281
317
|
* @param filter - Optional filter parameters
|
|
@@ -294,6 +330,7 @@ export declare class FinaticConnect extends EventEmitter {
|
|
|
294
330
|
* @returns Promise with all accounts
|
|
295
331
|
*/
|
|
296
332
|
getAllAccounts(filter?: AccountsFilter): Promise<BrokerDataAccount[]>;
|
|
333
|
+
getAllBalances(filter?: BalancesFilter): Promise<BrokerBalance[]>;
|
|
297
334
|
/**
|
|
298
335
|
* Register session management (but don't auto-cleanup for 24-hour sessions)
|
|
299
336
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UserToken } from '../../types';
|
|
2
1
|
export declare class PortalUI {
|
|
3
2
|
private iframe;
|
|
4
3
|
private container;
|
|
@@ -6,7 +5,6 @@ export declare class PortalUI {
|
|
|
6
5
|
private sessionId;
|
|
7
6
|
private portalOrigin;
|
|
8
7
|
private options?;
|
|
9
|
-
private userToken;
|
|
10
8
|
private originalBodyStyle;
|
|
11
9
|
constructor(portalUrl: string);
|
|
12
10
|
private createContainer;
|
|
@@ -34,5 +32,4 @@ export declare class PortalUI {
|
|
|
34
32
|
private handleError;
|
|
35
33
|
private handleClose;
|
|
36
34
|
private handleResize;
|
|
37
|
-
getTokens(): UserToken | null;
|
|
38
35
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ApiConfig, ApiResponse, Order, OptionsOrder, BrokerAccount, PortfolioSnapshot, PerformanceMetrics, UserToken, Holding, Portfolio, PortalResponse, SessionInitResponse, SessionStartResponse, SessionResponse, OtpRequestResponse, OtpVerifyResponse, PortalUrlResponse, SessionValidationResponse, SessionAuthenticateResponse, RequestHeaders, SessionStatus, BrokerOrderParams, BrokerExtras, CryptoOrderOptions, OptionsOrderOptions, OrderResponse, TradingContext, DeviceInfo, BrokerOrder, BrokerPosition, BrokerDataOptions, BrokerInfo, TokenInfo, RefreshTokenRequest, RefreshTokenResponse, AccountsFilter, OrdersFilter, PositionsFilter, BrokerDataOrder, BrokerDataPosition, BrokerDataAccount, FilteredOrdersResponse, FilteredPositionsResponse, FilteredAccountsResponse, BrokerConnection, } from './types';
|
|
1
|
+
export type { ApiConfig, ApiResponse, Order, OptionsOrder, BrokerAccount, PortfolioSnapshot, PerformanceMetrics, UserToken, Holding, Portfolio, PortalResponse, SessionInitResponse, SessionStartResponse, SessionResponse, OtpRequestResponse, OtpVerifyResponse, PortalUrlResponse, SessionValidationResponse, SessionAuthenticateResponse, RequestHeaders, SessionStatus, BrokerOrderParams, BrokerExtras, CryptoOrderOptions, OptionsOrderOptions, OrderResponse, TradingContext, DeviceInfo, BrokerOrder, BrokerPosition, BrokerBalance, BrokerDataOptions, BrokerInfo, TokenInfo, RefreshTokenRequest, RefreshTokenResponse, AccountsFilter, OrdersFilter, PositionsFilter, BalancesFilter, BrokerDataOrder, BrokerDataPosition, BrokerDataAccount, FilteredOrdersResponse, FilteredPositionsResponse, FilteredAccountsResponse, FilteredBalancesResponse, BrokerConnection, } from './types';
|
|
2
2
|
export type { FinaticConnectOptions, FinaticUserToken, PortalMessage } from './types/connect';
|
|
3
3
|
export type { PortalProps, PortalTheme, PortalThemeConfig, PortalThemePreset, } from './types/portal';
|
|
4
4
|
export type { TradeAccessDeniedError, OrderNotFoundError, ValidationError, } from './types/api/errors';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SessionResponse, OtpRequestResponse, OtpVerifyResponse, PortalUrlResponse, SessionValidationResponse, SessionAuthenticateResponse, UserToken,
|
|
1
|
+
import { SessionResponse, OtpRequestResponse, OtpVerifyResponse, PortalUrlResponse, SessionValidationResponse, SessionAuthenticateResponse, UserToken, Order, BrokerInfo, BrokerAccount, BrokerOrder, BrokerPosition, BrokerBalance, BrokerConnection, BrokerDataOptions, BrokerOrderParams, BrokerExtras, CryptoOrderOptions, OptionsOrderOptions, OrderResponse, TradingContext, OrdersFilter, PositionsFilter, AccountsFilter, BalancesFilter, BrokerDataOrder, BrokerDataPosition, DisconnectCompanyResponse } from '../types';
|
|
2
2
|
import { PaginatedResult } from '../types';
|
|
3
3
|
import { DeviceInfo, SessionState, TokenInfo } from '../types/api/auth';
|
|
4
4
|
import { MockDataProvider, MockConfig } from './MockDataProvider';
|
|
@@ -71,15 +71,9 @@ export declare class MockApiClient {
|
|
|
71
71
|
getPortalUrl(sessionId: string): Promise<PortalUrlResponse>;
|
|
72
72
|
validatePortalSession(sessionId: string, signature: string): Promise<SessionValidationResponse>;
|
|
73
73
|
completePortalSession(sessionId: string): Promise<PortalUrlResponse>;
|
|
74
|
-
getHoldings(filter?: OrdersFilter): Promise<{
|
|
75
|
-
data: Holding[];
|
|
76
|
-
}>;
|
|
77
74
|
getOrders(filter?: OrdersFilter): Promise<{
|
|
78
75
|
data: Order[];
|
|
79
76
|
}>;
|
|
80
|
-
getPortfolio(): Promise<{
|
|
81
|
-
data: Portfolio;
|
|
82
|
-
}>;
|
|
83
77
|
placeOrder(order: BrokerOrderParams): Promise<void>;
|
|
84
78
|
placeBrokerOrder(params: Partial<BrokerOrderParams> & {
|
|
85
79
|
symbol: string;
|
|
@@ -103,8 +97,7 @@ export declare class MockApiClient {
|
|
|
103
97
|
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>;
|
|
104
98
|
placeFuturesMarketOrder(symbol: string, orderQty: number, action: 'Buy' | 'Sell', broker?: 'robinhood' | 'tasty_trade' | 'ninja_trader', accountNumber?: string, extras?: BrokerExtras): Promise<OrderResponse>;
|
|
105
99
|
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>;
|
|
106
|
-
|
|
107
|
-
getUserToken(userId: string): Promise<UserToken>;
|
|
100
|
+
getUserToken(sessionId: string): Promise<UserToken>;
|
|
108
101
|
getCurrentSessionState(): SessionState | null;
|
|
109
102
|
getBrokerList(): Promise<{
|
|
110
103
|
_id: string;
|
|
@@ -144,12 +137,16 @@ export declare class MockApiClient {
|
|
|
144
137
|
getBrokerPositionsWithFilter(filter?: PositionsFilter): Promise<{
|
|
145
138
|
data: BrokerDataPosition[];
|
|
146
139
|
}>;
|
|
140
|
+
getBrokerBalancesWithFilter(filter?: BalancesFilter): Promise<{
|
|
141
|
+
data: BrokerBalance[];
|
|
142
|
+
}>;
|
|
147
143
|
getBrokerDataAccountsWithFilter(filter?: AccountsFilter): Promise<{
|
|
148
144
|
data: BrokerAccount[];
|
|
149
145
|
}>;
|
|
150
146
|
getBrokerOrdersPage(page?: number, perPage?: number, filters?: OrdersFilter): Promise<PaginatedResult<BrokerDataOrder[]>>;
|
|
151
147
|
getBrokerAccountsPage(page?: number, perPage?: number, filters?: AccountsFilter): Promise<PaginatedResult<BrokerAccount[]>>;
|
|
152
148
|
getBrokerPositionsPage(page?: number, perPage?: number, filters?: PositionsFilter): Promise<PaginatedResult<BrokerDataPosition[]>>;
|
|
149
|
+
getBrokerBalancesPage(page?: number, perPage?: number, filters?: BalancesFilter): Promise<PaginatedResult<BrokerBalance[]>>;
|
|
153
150
|
getBrokerConnections(): Promise<{
|
|
154
151
|
_id: string;
|
|
155
152
|
response_data: BrokerConnection[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Holding, Portfolio } from '../types/api/portfolio';
|
|
2
1
|
import { Order, OrderResponse } from '../types/api/orders';
|
|
3
|
-
import { BrokerInfo, BrokerAccount, BrokerConnection, OrdersFilter, PositionsFilter, AccountsFilter, BrokerDataOrder, BrokerDataPosition, BrokerOrderParams, DisconnectCompanyResponse } from '../types/api/broker';
|
|
2
|
+
import { BrokerInfo, BrokerAccount, BrokerBalance, BrokerConnection, OrdersFilter, PositionsFilter, AccountsFilter, BalancesFilter, BrokerDataOrder, BrokerDataPosition, BrokerOrderParams, DisconnectCompanyResponse } from '../types/api/broker';
|
|
4
3
|
import { SessionResponse, OtpRequestResponse, OtpVerifyResponse, SessionValidationResponse, SessionAuthenticateResponse, UserToken, RefreshTokenResponse } from '../types/api/auth';
|
|
5
4
|
import { PortalUrlResponse } from '../types/api/core';
|
|
6
5
|
/**
|
|
@@ -80,12 +79,6 @@ export declare class MockDataProvider {
|
|
|
80
79
|
warnings: null;
|
|
81
80
|
errors: null;
|
|
82
81
|
}>;
|
|
83
|
-
mockGetHoldings(): Promise<{
|
|
84
|
-
data: Holding[];
|
|
85
|
-
}>;
|
|
86
|
-
mockGetPortfolio(): Promise<{
|
|
87
|
-
data: Portfolio;
|
|
88
|
-
}>;
|
|
89
82
|
mockGetOrders(filter?: OrdersFilter): Promise<{
|
|
90
83
|
data: Order[];
|
|
91
84
|
}>;
|
|
@@ -95,6 +88,9 @@ export declare class MockDataProvider {
|
|
|
95
88
|
mockGetBrokerPositions(filter?: PositionsFilter): Promise<{
|
|
96
89
|
data: BrokerDataPosition[];
|
|
97
90
|
}>;
|
|
91
|
+
mockGetBrokerBalances(filter?: BalancesFilter): Promise<{
|
|
92
|
+
data: BrokerBalance[];
|
|
93
|
+
}>;
|
|
98
94
|
mockGetBrokerDataAccounts(filter?: AccountsFilter): Promise<{
|
|
99
95
|
data: BrokerAccount[];
|
|
100
96
|
}>;
|
|
@@ -106,7 +102,7 @@ export declare class MockDataProvider {
|
|
|
106
102
|
/**
|
|
107
103
|
* Get stored user token
|
|
108
104
|
*/
|
|
109
|
-
getUserToken(
|
|
105
|
+
getUserToken(sessionId: string): UserToken | undefined;
|
|
110
106
|
/**
|
|
111
107
|
* Clear all stored data
|
|
112
108
|
*/
|
|
@@ -121,6 +117,7 @@ export declare class MockDataProvider {
|
|
|
121
117
|
private applyBrokerOrderFilters;
|
|
122
118
|
private applyBrokerPositionFilters;
|
|
123
119
|
private applyBrokerAccountFilters;
|
|
120
|
+
private applyBrokerBalanceFilters;
|
|
124
121
|
/**
|
|
125
122
|
* Generate mock orders with diverse data
|
|
126
123
|
*/
|
|
@@ -5,4 +5,5 @@ export declare const corporateBlueTheme: PortalThemeConfig;
|
|
|
5
5
|
export declare const purpleTheme: PortalThemeConfig;
|
|
6
6
|
export declare const greenTheme: PortalThemeConfig;
|
|
7
7
|
export declare const orangeTheme: PortalThemeConfig;
|
|
8
|
+
export declare const stockAlgosTheme: PortalThemeConfig;
|
|
8
9
|
export declare const portalThemePresets: Record<string, PortalThemeConfig>;
|
|
@@ -17,6 +17,18 @@ export interface BrokerAccount {
|
|
|
17
17
|
updated_at: string;
|
|
18
18
|
/** ISO 8601 timestamp with timezone information */
|
|
19
19
|
last_synced_at: string;
|
|
20
|
+
/** ISO 8601 timestamp with timezone information - when positions were last synced */
|
|
21
|
+
positions_synced_at: string | null;
|
|
22
|
+
/** ISO 8601 timestamp with timezone information - when orders were last synced */
|
|
23
|
+
orders_synced_at: string | null;
|
|
24
|
+
/** ISO 8601 timestamp with timezone information - when balances were last synced */
|
|
25
|
+
balances_synced_at: string | null;
|
|
26
|
+
/** ISO 8601 timestamp with timezone information - when the account was created */
|
|
27
|
+
account_created_at: string | null;
|
|
28
|
+
/** ISO 8601 timestamp with timezone information - when the account was last updated */
|
|
29
|
+
account_updated_at: string | null;
|
|
30
|
+
/** ISO 8601 timestamp with timezone information - when the first trade occurred */
|
|
31
|
+
account_first_trade_at: string | null;
|
|
20
32
|
}
|
|
21
33
|
export interface BrokerOrder {
|
|
22
34
|
id: string;
|
|
@@ -59,6 +71,24 @@ export interface BrokerPosition {
|
|
|
59
71
|
/** ISO 8601 timestamp with timezone information */
|
|
60
72
|
updated_at: string;
|
|
61
73
|
}
|
|
74
|
+
export interface BrokerBalance {
|
|
75
|
+
id: string;
|
|
76
|
+
account_id: string;
|
|
77
|
+
total_cash_value: number | null;
|
|
78
|
+
net_liquidation_value: number | null;
|
|
79
|
+
initial_margin: number | null;
|
|
80
|
+
maintenance_margin: number | null;
|
|
81
|
+
available_to_withdraw: number | null;
|
|
82
|
+
total_realized_pnl: number | null;
|
|
83
|
+
balance_created_at: string | null;
|
|
84
|
+
balance_updated_at: string | null;
|
|
85
|
+
is_end_of_day_snapshot: boolean | null;
|
|
86
|
+
raw_payload: any | null;
|
|
87
|
+
/** ISO 8601 timestamp with timezone information */
|
|
88
|
+
created_at: string;
|
|
89
|
+
/** ISO 8601 timestamp with timezone information */
|
|
90
|
+
updated_at: string;
|
|
91
|
+
}
|
|
62
92
|
export interface BrokerDataOptions {
|
|
63
93
|
broker_name?: string;
|
|
64
94
|
account_id?: string;
|
|
@@ -227,6 +257,17 @@ export interface AccountsFilter {
|
|
|
227
257
|
offset?: number;
|
|
228
258
|
with_metadata?: boolean;
|
|
229
259
|
}
|
|
260
|
+
export interface BalancesFilter {
|
|
261
|
+
broker_id?: string;
|
|
262
|
+
connection_id?: string;
|
|
263
|
+
account_id?: string;
|
|
264
|
+
is_end_of_day_snapshot?: boolean;
|
|
265
|
+
limit?: number;
|
|
266
|
+
offset?: number;
|
|
267
|
+
balance_created_after?: string;
|
|
268
|
+
balance_created_before?: string;
|
|
269
|
+
with_metadata?: boolean;
|
|
270
|
+
}
|
|
230
271
|
export interface FilteredOrdersResponse {
|
|
231
272
|
orders: BrokerDataOrder[];
|
|
232
273
|
total: number;
|
|
@@ -245,6 +286,12 @@ export interface FilteredAccountsResponse {
|
|
|
245
286
|
limit: number;
|
|
246
287
|
offset: number;
|
|
247
288
|
}
|
|
289
|
+
export interface FilteredBalancesResponse {
|
|
290
|
+
balances: BrokerBalance[];
|
|
291
|
+
total: number;
|
|
292
|
+
limit: number;
|
|
293
|
+
offset: number;
|
|
294
|
+
}
|
|
248
295
|
export interface DisconnectCompanyResponse {
|
|
249
296
|
success: boolean;
|
|
250
297
|
response_data: {
|
|
@@ -5,62 +5,191 @@ export interface PortalConfig {
|
|
|
5
5
|
zIndex?: number;
|
|
6
6
|
}
|
|
7
7
|
export interface PortalThemeConfig {
|
|
8
|
-
mode
|
|
9
|
-
colors
|
|
10
|
-
background
|
|
11
|
-
primary
|
|
12
|
-
secondary
|
|
13
|
-
tertiary
|
|
14
|
-
accent
|
|
15
|
-
glass
|
|
16
|
-
};
|
|
17
|
-
status
|
|
18
|
-
connected
|
|
19
|
-
disconnected
|
|
20
|
-
warning
|
|
21
|
-
pending
|
|
22
|
-
error
|
|
23
|
-
success
|
|
24
|
-
};
|
|
25
|
-
text
|
|
26
|
-
primary
|
|
27
|
-
secondary
|
|
28
|
-
muted
|
|
29
|
-
inverse
|
|
30
|
-
};
|
|
31
|
-
border
|
|
32
|
-
primary
|
|
33
|
-
secondary
|
|
34
|
-
hover
|
|
35
|
-
focus
|
|
36
|
-
accent
|
|
37
|
-
};
|
|
38
|
-
input
|
|
39
|
-
background
|
|
40
|
-
border
|
|
41
|
-
borderFocus
|
|
42
|
-
text
|
|
43
|
-
placeholder
|
|
44
|
-
};
|
|
45
|
-
button
|
|
46
|
-
primary
|
|
47
|
-
background
|
|
48
|
-
text
|
|
49
|
-
hover
|
|
50
|
-
active
|
|
8
|
+
mode?: 'dark' | 'light' | 'auto';
|
|
9
|
+
colors?: {
|
|
10
|
+
background?: {
|
|
11
|
+
primary?: string;
|
|
12
|
+
secondary?: string;
|
|
13
|
+
tertiary?: string;
|
|
14
|
+
accent?: string;
|
|
15
|
+
glass?: string;
|
|
16
|
+
};
|
|
17
|
+
status?: {
|
|
18
|
+
connected?: string;
|
|
19
|
+
disconnected?: string;
|
|
20
|
+
warning?: string;
|
|
21
|
+
pending?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
success?: string;
|
|
24
|
+
};
|
|
25
|
+
text?: {
|
|
26
|
+
primary?: string;
|
|
27
|
+
secondary?: string;
|
|
28
|
+
muted?: string;
|
|
29
|
+
inverse?: string;
|
|
30
|
+
};
|
|
31
|
+
border?: {
|
|
32
|
+
primary?: string;
|
|
33
|
+
secondary?: string;
|
|
34
|
+
hover?: string;
|
|
35
|
+
focus?: string;
|
|
36
|
+
accent?: string;
|
|
37
|
+
};
|
|
38
|
+
input?: {
|
|
39
|
+
background?: string;
|
|
40
|
+
border?: string;
|
|
41
|
+
borderFocus?: string;
|
|
42
|
+
text?: string;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
};
|
|
45
|
+
button?: {
|
|
46
|
+
primary?: {
|
|
47
|
+
background?: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
hover?: string;
|
|
50
|
+
active?: string;
|
|
51
|
+
};
|
|
52
|
+
secondary?: {
|
|
53
|
+
background?: string;
|
|
54
|
+
text?: string;
|
|
55
|
+
border?: string;
|
|
56
|
+
hover?: string;
|
|
57
|
+
active?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
typography?: {
|
|
62
|
+
fontFamily?: {
|
|
63
|
+
primary?: string;
|
|
64
|
+
secondary?: string;
|
|
65
|
+
};
|
|
66
|
+
fontSize?: {
|
|
67
|
+
xs?: string;
|
|
68
|
+
sm?: string;
|
|
69
|
+
base?: string;
|
|
70
|
+
lg?: string;
|
|
71
|
+
xl?: string;
|
|
72
|
+
'2xl'?: string;
|
|
73
|
+
'3xl'?: string;
|
|
74
|
+
'4xl'?: string;
|
|
75
|
+
};
|
|
76
|
+
fontWeight?: {
|
|
77
|
+
normal?: number;
|
|
78
|
+
medium?: number;
|
|
79
|
+
semibold?: number;
|
|
80
|
+
bold?: number;
|
|
81
|
+
extrabold?: number;
|
|
82
|
+
};
|
|
83
|
+
lineHeight?: {
|
|
84
|
+
tight?: string;
|
|
85
|
+
normal?: string;
|
|
86
|
+
relaxed?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
spacing?: {
|
|
90
|
+
xs?: string;
|
|
91
|
+
sm?: string;
|
|
92
|
+
md?: string;
|
|
93
|
+
lg?: string;
|
|
94
|
+
xl?: string;
|
|
95
|
+
'2xl'?: string;
|
|
96
|
+
'3xl'?: string;
|
|
97
|
+
};
|
|
98
|
+
layout?: {
|
|
99
|
+
containerMaxWidth?: string;
|
|
100
|
+
gridGap?: string;
|
|
101
|
+
cardPadding?: string;
|
|
102
|
+
borderRadius?: {
|
|
103
|
+
sm?: string;
|
|
104
|
+
md?: string;
|
|
105
|
+
lg?: string;
|
|
106
|
+
xl?: string;
|
|
107
|
+
'2xl'?: string;
|
|
108
|
+
full?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
components?: {
|
|
112
|
+
brokerCard?: {
|
|
113
|
+
width?: string;
|
|
114
|
+
height?: string;
|
|
115
|
+
logoSize?: string;
|
|
116
|
+
padding?: string;
|
|
117
|
+
};
|
|
118
|
+
statusIndicator?: {
|
|
119
|
+
size?: string;
|
|
120
|
+
glowIntensity?: number;
|
|
121
|
+
};
|
|
122
|
+
modal?: {
|
|
123
|
+
background?: string;
|
|
124
|
+
backdrop?: string;
|
|
125
|
+
};
|
|
126
|
+
brokerCardModern?: {
|
|
127
|
+
width?: string;
|
|
128
|
+
height?: string;
|
|
129
|
+
padding?: string;
|
|
130
|
+
logoSize?: string;
|
|
131
|
+
statusSize?: string;
|
|
132
|
+
};
|
|
133
|
+
connectButton?: {
|
|
134
|
+
width?: string;
|
|
135
|
+
height?: string;
|
|
136
|
+
};
|
|
137
|
+
themeSwitcher?: {
|
|
138
|
+
indicatorSize?: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
effects?: {
|
|
142
|
+
glassmorphism?: {
|
|
143
|
+
enabled?: boolean;
|
|
144
|
+
blur?: string;
|
|
145
|
+
opacity?: number;
|
|
146
|
+
border?: string;
|
|
147
|
+
};
|
|
148
|
+
animations?: {
|
|
149
|
+
enabled?: boolean;
|
|
150
|
+
duration?: {
|
|
151
|
+
fast?: string;
|
|
152
|
+
normal?: string;
|
|
153
|
+
slow?: string;
|
|
51
154
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
hover: string;
|
|
57
|
-
active: string;
|
|
155
|
+
easing?: {
|
|
156
|
+
default?: string;
|
|
157
|
+
smooth?: string;
|
|
158
|
+
bounce?: string;
|
|
58
159
|
};
|
|
59
160
|
};
|
|
161
|
+
shadows?: {
|
|
162
|
+
sm?: string;
|
|
163
|
+
md?: string;
|
|
164
|
+
lg?: string;
|
|
165
|
+
xl?: string;
|
|
166
|
+
card?: string;
|
|
167
|
+
cardHover?: string;
|
|
168
|
+
glow?: string;
|
|
169
|
+
focus?: string;
|
|
170
|
+
};
|
|
60
171
|
};
|
|
61
172
|
branding?: {
|
|
173
|
+
logo?: string;
|
|
174
|
+
companyName?: string;
|
|
175
|
+
favicon?: string;
|
|
62
176
|
primaryColor?: string;
|
|
63
177
|
};
|
|
178
|
+
glow?: {
|
|
179
|
+
primary?: string;
|
|
180
|
+
secondary?: string;
|
|
181
|
+
card?: string;
|
|
182
|
+
cardHover?: string;
|
|
183
|
+
button?: string;
|
|
184
|
+
focus?: string;
|
|
185
|
+
scrollbar?: string;
|
|
186
|
+
};
|
|
187
|
+
gradients?: {
|
|
188
|
+
start?: string;
|
|
189
|
+
end?: string;
|
|
190
|
+
hoverStart?: string;
|
|
191
|
+
hoverEnd?: string;
|
|
192
|
+
};
|
|
64
193
|
}
|
|
65
194
|
export type PortalThemePreset = 'dark' | 'light' | 'corporateBlue' | 'purple' | 'green' | 'orange';
|
|
66
195
|
export interface PortalTheme {
|