@copytrade/unified-broker
Version:
Unified broker interface library for Indian stock market brokers with plugin architecture
80 lines • 2.9 kB
TypeScript
/**
* Unified Shoonya Service
* Implements the new IUnifiedBrokerService interface with all business logic encapsulated
* Handles authentication, token management, and provides standardized responses
* Uses comprehensive error handler for consistent error processing
*/
import { IUnifiedBrokerService, UnifiedConnectionResponse, UnifiedOAuthResponse, UnifiedTokenRefreshResponse, UnifiedValidationResponse, UnifiedAccountInfo, UnifiedTokenInfo, AccountStatus } from '../../interfaces/UnifiedBrokerResponse';
export declare class UnifiedShoonyaService implements IUnifiedBrokerService {
private shoonyaService;
private isConnectedFlag;
private accountInfo;
private tokenInfo;
private currentCredentials;
constructor();
getBrokerName(): string;
/**
* Connect to Shoonya broker with direct authentication
* Handles all authentication logic internally and returns standardized response
*/
connect(credentials: any): Promise<UnifiedConnectionResponse>;
/**
* Shoonya doesn't use OAuth, so this method returns an error
*/
completeOAuth(_authCode: string, _credentials: any): Promise<UnifiedOAuthResponse>;
/**
* Shoonya tokens don't expire, so refresh is not needed
*/
refreshToken(_credentials: any): Promise<UnifiedTokenRefreshResponse>;
/**
* Validate current Shoonya session
*/
validateSession(credentials: any): Promise<UnifiedValidationResponse>;
/**
* Disconnect from Shoonya
*/
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;
placeOrder(orderRequest: any): Promise<any>;
cancelOrder(orderId: string): Promise<any>;
modifyOrder(orderId: string, modifications: any): Promise<any>;
private mapProductType;
private mapOrderType;
/**
* Transform Shoonya order status response to unified format
*/
private transformToUnifiedOrderStatus;
/**
* Map Shoonya order status to unified status types
*/
private mapShoonyaStatusToUnified;
/**
* Parse timestamp from Shoonya response
*/
private parseTimestamp;
/**
* Extract exchange from trading symbol
*/
private extractExchange;
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=UnifiedShoonyaService.d.ts.map