/**
 * Comprehensive list of IB-options-tradable instruments, organised by category.
 * Used in PatternExplorer (Instrument Lens) and PatternLab (Instrument Scan).
 */

export interface Instrument {
  ticker: string
  name: string
  category: string
  flag?: string
}

export const INSTRUMENT_CATEGORIES = [
  'US Indices',
  'Europe',
  'Asia-Pacific',
  'Emerging Markets',
  'Sectors',
  'Forex',
  'Bonds',
  'Metals',
  'Energy',
  'Agriculture',
  'Crypto',
  'Volatility',
]

export const INSTRUMENTS: Instrument[] = [
  // ── US Indices ──────────────────────────────────────────────────────────────
  { ticker: 'SPY',     name: 'S&P 500',          category: 'US Indices' },
  { ticker: 'QQQ',     name: 'Nasdaq 100',        category: 'US Indices' },
  { ticker: 'IWM',     name: 'Russell 2000',      category: 'US Indices' },
  { ticker: 'DIA',     name: 'Dow Jones',         category: 'US Indices' },
  { ticker: 'MDY',     name: 'S&P MidCap 400',   category: 'US Indices' },
  { ticker: 'SPY',     name: 'S&P 500',           category: 'US Indices' },

  // ── Europe ──────────────────────────────────────────────────────────────────
  { ticker: 'EWG',     name: 'Germany (DAX)',     category: 'Europe',        flag: '🇩🇪' },
  { ticker: 'EWU',     name: 'UK (FTSE 100)',     category: 'Europe',        flag: '🇬🇧' },
  { ticker: 'EWI',     name: 'Italy (MIB)',       category: 'Europe',        flag: '🇮🇹' },
  { ticker: 'EWP',     name: 'Spain (IBEX)',      category: 'Europe',        flag: '🇪🇸' },
  { ticker: 'EWL',     name: 'Switzerland',       category: 'Europe',        flag: '🇨🇭' },
  { ticker: 'EWQ',     name: 'France (CAC)',      category: 'Europe',        flag: '🇫🇷' },
  { ticker: 'EWN',     name: 'Netherlands',       category: 'Europe',        flag: '🇳🇱' },
  { ticker: 'EWD',     name: 'Sweden',            category: 'Europe',        flag: '🇸🇪' },

  // ── Asia-Pacific ─────────────────────────────────────────────────────────────
  { ticker: 'EWJ',     name: 'Japan (Nikkei)',    category: 'Asia-Pacific',   flag: '🇯🇵' },
  { ticker: 'FXI',     name: 'China (CSI 300)',   category: 'Asia-Pacific',   flag: '🇨🇳' },
  { ticker: 'KWEB',    name: 'China Internet',    category: 'Asia-Pacific',   flag: '🇨🇳' },
  { ticker: 'EWY',     name: 'South Korea',       category: 'Asia-Pacific',   flag: '🇰🇷' },
  { ticker: 'EWT',     name: 'Taiwan',            category: 'Asia-Pacific',   flag: '🇹🇼' },
  { ticker: 'EWA',     name: 'Australia',         category: 'Asia-Pacific',   flag: '🇦🇺' },
  { ticker: 'EWS',     name: 'Singapore',         category: 'Asia-Pacific',   flag: '🇸🇬' },
  { ticker: 'INDA',    name: 'India',             category: 'Asia-Pacific',   flag: '🇮🇳' },

  // ── Emerging Markets ─────────────────────────────────────────────────────────
  { ticker: 'EEM',     name: 'Emerging Markets',  category: 'Emerging Markets' },
  { ticker: 'EWZ',     name: 'Brazil',            category: 'Emerging Markets', flag: '🇧🇷' },
  { ticker: 'TUR',     name: 'Turkey',            category: 'Emerging Markets', flag: '🇹🇷' },
  { ticker: 'EWW',     name: 'Mexico',            category: 'Emerging Markets', flag: '🇲🇽' },
  { ticker: 'EWH',     name: 'Hong Kong',         category: 'Emerging Markets', flag: '🇭🇰' },
  { ticker: 'EZA',     name: 'South Africa',      category: 'Emerging Markets', flag: '🇿🇦' },
  { ticker: 'THD',     name: 'Thailand',          category: 'Emerging Markets', flag: '🇹🇭' },

  // ── Sectors ───────────────────────────────────────────────────────────────────
  { ticker: 'XLF',     name: 'Financials',        category: 'Sectors' },
  { ticker: 'XLE',     name: 'Energy',            category: 'Sectors' },
  { ticker: 'XLK',     name: 'Technology',        category: 'Sectors' },
  { ticker: 'XLV',     name: 'Healthcare',        category: 'Sectors' },
  { ticker: 'XLI',     name: 'Industrials',       category: 'Sectors' },
  { ticker: 'XLB',     name: 'Materials',         category: 'Sectors' },
  { ticker: 'XLU',     name: 'Utilities',         category: 'Sectors' },
  { ticker: 'XLP',     name: 'Consumer Staples',  category: 'Sectors' },
  { ticker: 'XLY',     name: 'Consumer Discret.', category: 'Sectors' },
  { ticker: 'XLC',     name: 'Communication',     category: 'Sectors' },
  { ticker: 'SMH',     name: 'Semiconductors',    category: 'Sectors' },
  { ticker: 'IBB',     name: 'Biotech',           category: 'Sectors' },
  { ticker: 'ARKK',    name: 'ARK Innovation',    category: 'Sectors' },

  // ── Forex ─────────────────────────────────────────────────────────────────────
  { ticker: 'EURUSD=X', name: 'EUR/USD',          category: 'Forex' },
  { ticker: 'GBPUSD=X', name: 'GBP/USD',          category: 'Forex' },
  { ticker: 'USDJPY=X', name: 'USD/JPY',          category: 'Forex' },
  { ticker: 'USDCHF=X', name: 'USD/CHF',          category: 'Forex' },
  { ticker: 'EURCHF=X', name: 'EUR/CHF',          category: 'Forex' },
  { ticker: 'AUDUSD=X', name: 'AUD/USD',          category: 'Forex' },
  { ticker: 'USDCAD=X', name: 'USD/CAD',          category: 'Forex' },
  { ticker: 'USDCNH=X', name: 'USD/CNH',          category: 'Forex' },
  { ticker: 'NZDUSD=X', name: 'NZD/USD',          category: 'Forex' },
  { ticker: 'USDMXN=X', name: 'USD/MXN',          category: 'Forex' },
  { ticker: 'EURGBP=X', name: 'EUR/GBP',          category: 'Forex' },
  { ticker: 'EURJPY=X', name: 'EUR/JPY',          category: 'Forex' },
  { ticker: 'GBPJPY=X', name: 'GBP/JPY',          category: 'Forex' },
  { ticker: 'USDSEK=X', name: 'USD/SEK',          category: 'Forex' },
  { ticker: 'USDNOK=X', name: 'USD/NOK',          category: 'Forex' },
  { ticker: 'USDTRY=X', name: 'USD/TRY',          category: 'Forex' },
  { ticker: 'USDZAR=X', name: 'USD/ZAR',          category: 'Forex' },

  // ── Bonds ─────────────────────────────────────────────────────────────────────
  { ticker: 'TLT',     name: '20Y+ US Treasury',  category: 'Bonds' },
  { ticker: 'IEF',     name: '7-10Y Treasury',    category: 'Bonds' },
  { ticker: 'SHY',     name: '1-3Y Treasury',     category: 'Bonds' },
  { ticker: 'HYG',     name: 'High Yield Corp',   category: 'Bonds' },
  { ticker: 'LQD',     name: 'Investment Grade',  category: 'Bonds' },
  { ticker: 'TIP',     name: 'TIPS (Inflation)',  category: 'Bonds' },
  { ticker: 'BIL',     name: 'T-Bills 1-3M',      category: 'Bonds' },
  { ticker: 'EMB',     name: 'EM Sovereign',      category: 'Bonds' },
  { ticker: 'MBB',     name: 'Mortgage-Backed',   category: 'Bonds' },

  // ── Metals ────────────────────────────────────────────────────────────────────
  { ticker: 'GLD',     name: 'Gold',              category: 'Metals' },
  { ticker: 'SLV',     name: 'Silver',            category: 'Metals' },
  { ticker: 'PPLT',    name: 'Platinum',          category: 'Metals' },
  { ticker: 'PALL',    name: 'Palladium',         category: 'Metals' },
  { ticker: 'COPX',    name: 'Copper Miners',     category: 'Metals' },
  { ticker: 'DBB',     name: 'Base Metals',       category: 'Metals' },

  // ── Energy ────────────────────────────────────────────────────────────────────
  { ticker: 'USO',     name: 'WTI Crude Oil',     category: 'Energy' },
  { ticker: 'BNO',     name: 'Brent Crude Oil',   category: 'Energy' },
  { ticker: 'UNG',     name: 'Natural Gas (US)',  category: 'Energy' },
  { ticker: 'UGA',     name: 'Gasoline RBOB',     category: 'Energy' },
  { ticker: 'AMLP',    name: 'Pipelines MLP',     category: 'Energy' },

  // ── Agriculture ───────────────────────────────────────────────────────────────
  { ticker: 'WEAT',    name: 'Wheat',             category: 'Agriculture' },
  { ticker: 'CORN',    name: 'Corn',              category: 'Agriculture' },
  { ticker: 'SOYB',    name: 'Soybeans',          category: 'Agriculture' },
  { ticker: 'BAL',     name: 'Cotton',            category: 'Agriculture' },
  { ticker: 'CANE',    name: 'Sugar',             category: 'Agriculture' },
  { ticker: 'NIB',     name: 'Cocoa',             category: 'Agriculture' },
  { ticker: 'JO',      name: 'Coffee',            category: 'Agriculture' },
  { ticker: 'DBA',     name: 'Agri Diversified',  category: 'Agriculture' },

  // ── Crypto ────────────────────────────────────────────────────────────────────
  { ticker: 'BTC-USD', name: 'Bitcoin',           category: 'Crypto' },
  { ticker: 'ETH-USD', name: 'Ethereum',          category: 'Crypto' },
  { ticker: 'SOL-USD', name: 'Solana',            category: 'Crypto' },

  // ── Volatility ────────────────────────────────────────────────────────────────
  { ticker: '^VIX',    name: 'CBOE VIX',          category: 'Volatility' },
  { ticker: 'VXX',     name: 'VIX Short-Term',    category: 'Volatility' },
  { ticker: 'UVXY',    name: 'Ultra VIX 1.5x',   category: 'Volatility' },
  { ticker: 'SVXY',    name: 'Short VIX -0.5x',  category: 'Volatility' },
]
