UNPKG

@copytrade/broker-fyers

Version:
73 lines 3.07 kB
/** * Fyers Symbol Formatter * Handles proper symbol formatting for Fyers API */ export interface SymbolComponents { underlying: string; expiry: string; strike?: number; optionType?: 'CE' | 'PE'; instrumentType: 'EQUITY' | 'OPTION' | 'FUTURE'; } export declare class FyersSymbolFormatter { /** * Format option symbol for Fyers API * @param underlying - Underlying symbol (e.g., 'NIFTY', 'BANKNIFTY', 'RELIANCE') * @param expiry - Expiry in YYMMMDD format (e.g., '25JAN30', '25JAN') * @param strike - Strike price (e.g., 22000, 3000) * @param optionType - 'CE' for Call, 'PE' for Put * @param exchange - Exchange (default: 'NSE') * @returns Formatted symbol (e.g., 'NSE:NIFTY25JAN22000CE') */ static formatOption(underlying: string, expiry: string, strike: number, optionType: 'CE' | 'PE', exchange?: string): string; /** * Format future symbol for Fyers API * @param underlying - Underlying symbol (e.g., 'NIFTY', 'BANKNIFTY', 'RELIANCE') * @param expiry - Expiry in YYMMMDD format (e.g., '25JAN30', '25JAN') * @param exchange - Exchange (default: 'NSE') * @returns Formatted symbol (e.g., 'NSE:NIFTY25JANFUT') */ static formatFuture(underlying: string, expiry: string, exchange?: string): string; /** * Format equity symbol for Fyers API * @param symbol - Stock symbol (e.g., 'RELIANCE', 'TCS') * @param exchange - Exchange (default: 'NSE') * @returns Formatted symbol (e.g., 'NSE:RELIANCE-EQ') */ static formatEquity(symbol: string, exchange?: string): string; /** * Parse symbol to extract components * Attempts to detect instrument type and extract components * @param symbol - Input symbol * @returns Symbol components or null if parsing fails */ static parseSymbol(symbol: string): SymbolComponents | null; /** * Format symbol based on detected or provided instrument type * @param symbol - Input symbol * @param exchange - Exchange (default: 'NSE') * @param instrumentType - Override instrument type detection * @returns Formatted symbol for Fyers API */ static formatSymbol(symbol: string, exchange?: string, instrumentType?: 'EQUITY' | 'OPTION' | 'FUTURE'): string; /** * Validate if symbol is properly formatted for Fyers API * @param symbol - Symbol to validate * @returns true if valid, false otherwise */ static isValidFyersSymbol(symbol: string): boolean; /** * Get exchange from symbol or default * @param symbol - Input symbol * @param defaultExchange - Default exchange if not found in symbol * @returns Exchange code */ static getExchange(symbol: string, defaultExchange?: string): string; /** * Convert expiry date to Fyers format * @param expiryDate - Date in various formats (ISO, DD-MM-YYYY, etc.) * @returns Expiry in YYMMMDD format */ static formatExpiryDate(expiryDate: string | Date): string; } //# sourceMappingURL=symbolFormatter.d.ts.map