@copytrade/unified-broker
Version:
Unified broker interface library for Indian stock market brokers with plugin architecture
69 lines • 2.57 kB
TypeScript
/**
* Unified Fyers Service
* Implements the new IUnifiedBrokerService interface with all business logic encapsulated
* Handles OAuth flow, token refresh, profile fetching, expiry management, and provides standardized responses
*/
import { IUnifiedBrokerService, UnifiedConnectionResponse, UnifiedOAuthResponse, UnifiedTokenRefreshResponse, UnifiedValidationResponse, UnifiedAccountInfo, UnifiedTokenInfo, AccountStatus } from '../../interfaces/UnifiedBrokerResponse';
export declare class UnifiedFyersService implements IUnifiedBrokerService {
private fyersService;
private isConnectedFlag;
private accountInfo;
private tokenInfo;
private currentCredentials;
constructor();
getBrokerName(): string;
/**
* Connect to Fyers broker - initiates OAuth flow
* Returns OAuth URL for user authentication
*/
connect(credentials: any): Promise<UnifiedConnectionResponse>;
/**
* Complete Fyers OAuth flow with auth code
* Generates access token, fetches profile, and sets up account
*/
completeOAuth(authCode: string, credentials: any): Promise<UnifiedOAuthResponse>;
/**
* Refresh Fyers access token using refresh token
*/
refreshToken(credentials: any): Promise<UnifiedTokenRefreshResponse>;
/**
* Validate current Fyers session and check token expiry
*/
validateSession(credentials: any): Promise<UnifiedValidationResponse>;
/**
* Disconnect from Fyers
*/
disconnect(): Promise<boolean>;
/**
* Get current account information
*/
getAccountInfo(): UnifiedAccountInfo | null;
/**
* Get current token information
*/
getTokenInfo(): UnifiedTokenInfo | null;
/**
* Check if currently connected
*/
isConnected(): boolean;
/**
* Get current account status
*/
getAccountStatus(): AccountStatus;
/**
* Check if token is expired
*/
private isTokenExpired;
placeOrder(orderRequest: any): Promise<any>;
cancelOrder(orderId: string): Promise<any>;
modifyOrder(orderId: string, modifications: any): Promise<any>;
private formatSymbolForFyers;
private mapProductType;
private mapOrderType;
getOrderStatus(accountId: string, orderId: string): Promise<any>;
getOrderHistory(accountId: string): Promise<any>;
getPositions(accountId: string): Promise<any>;
getQuote(symbol: string, exchange: string): Promise<any>;
searchSymbols(query: string, exchange: string): Promise<any>;
}
//# sourceMappingURL=UnifiedFyersService.d.ts.map