FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
news tab update
tilakpatel22905ebaa51277
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/bea.rs b/fincept-terminal-desktop/src-tauri/src/commands/bea.rsindex 60ef08d52..36bd22f48 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/bea.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/bea.rs@@ -1,6 +1,5 @@use tauri::command;use std::process::Command;-use std::collections::HashMap;// ==================== METADATA COMMANDS ====================diff --git a/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs b/fincept-terminal-desktop/src-tauri/src/commands/cftc.rsindex 8dc252895..d33595c69 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/cftc.rs@@ -297,7 +297,7 @@ pub async fn get_cftc_precious_metals_cot(futures_only: Option<bool>,limit: Option<i32>,) -> Result<String, String> {- let mut args = vec!["gold,silver,platinum,palladium"];+ let mut args = vec!["gold,silver,platinum,palladium".to_string()];if let Some(report_type) = report_type {args.push(report_type);} else {@@ -323,7 +323,7 @@ pub async fn get_cftc_energy_cot(futures_only: Option<bool>,limit: Option<i32>,) -> Result<String, String> {- let mut args = vec!["crude_oil,natural_gas,gasoline,heating_oil"];+ let mut args = vec!["crude_oil,natural_gas,gasoline,heating_oil".to_string()];if let Some(report_type) = report_type {args.push(report_type);} else {@@ -349,7 +349,7 @@ pub async fn get_cftc_agricultural_cot(futures_only: Option<bool>,limit: Option<i32>,) -> Result<String, String> {- let mut args = vec!["corn,wheat,soybeans,cotton,cocoa,coffee,sugar"];+ let mut args = vec!["corn,wheat,soybeans,cotton,cocoa,coffee,sugar".to_string()];if let Some(report_type) = report_type {args.push(report_type);} else {@@ -374,7 +374,7 @@ pub async fn get_cftc_financial_cot(futures_only: Option<bool>,limit: Option<i32>,) -> Result<String, String> {- let mut args = vec!["euro,jpy,british_pound,s&p_500,nasdaq_100"];+ let mut args = vec!["euro,jpy,british_pound,s&p_500,nasdaq_100".to_string()];args.push("financial".to_string());if let Some(futures_only) = futures_only {args.push(futures_only.to_string());@@ -396,7 +396,7 @@ pub async fn get_cftc_crypto_cot(futures_only: Option<bool>,limit: Option<i32>,) -> Result<String, String> {- let mut args = vec!["bitcoin,ether"];+ let mut args = vec!["bitcoin,ether".to_string()];if let Some(report_type) = report_type {args.push(report_type);} else {diff --git a/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs b/fincept-terminal-desktop/src-tauri/src/commands/ecb.rsindex 56433f9c4..309074838 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/ecb.rs@@ -463,7 +463,7 @@ pub async fn get_ecb_major_economies_bop_analysis(("FR", "France"),];- for (code, name) in countries {+ for (code, _name) in countries {match get_ecb_bop_main(code.to_string(), frequency.clone()).await {Ok(data) => results.push((format!("bop_{}", code.to_lowercase()), data)),Err(e) => results.push((format!("bop_{}", code.to_lowercase()), format!("Error: {}", e))),diff --git a/fincept-terminal-desktop/src-tauri/src/commands/eia.rs b/fincept-terminal-desktop/src-tauri/src/commands/eia.rsindex 2ea06bd85..715f40590 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/eia.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/eia.rs@@ -449,6 +449,8 @@ pub async fn get_eia_petroleum_markets_overview() -> Result<String, String> {("spot_prices_crude_gas_heating", "crude,conventional_gas")];+ let categories_len = categories.len();+for (category, tables) in categories {match get_eia_petroleum_status_report(category.to_string(),@@ -463,7 +465,7 @@ pub async fn get_eia_petroleum_markets_overview() -> Result<String, String> {Ok(serde_json::json!({"petroleum_markets_overview": results,- "categories_analyzed": categories.len()+ "categories_analyzed": categories_len}).to_string())}@@ -478,7 +480,7 @@ pub async fn get_eia_natural_gas_markets_overview() -> Result<String, String> {("05b", "US Regional Natural Gas Prices")];- for (table, description) in gas_tables {+ for (table, _description) in gas_tables {match get_eia_short_term_energy_outlook(table.to_string(),None,@@ -579,9 +581,9 @@ pub async fn get_eia_energy_consumption_analysis() -> Result<String, String> {// Get consumption data from STEOlet consumption_tables = vec![- ("04a", "PATCPUSX,PAFPPUS,PANIPUS"), # Petroleum consumption- ("05a", "NGNWPUS,NGSFPUS,NGNIPUS"), # Natural gas consumption- ("07a", "EPEOTWH,INEOTWH,CMEOTWH"), # Electricity consumption+ ("04a", "PATCPUSX,PAFPPUS,PANIPUS"), // Petroleum consumption+ ("05a", "NGNWPUS,NGSFPUS,NGNIPUS"), // Natural gas consumption+ ("07a", "EPEOTWH,INEOTWH,CMEOTWH"), // Electricity consumption];for (table, symbols) in consumption_tables {diff --git a/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs b/fincept-terminal-desktop/src-tauri/src/commands/multpl.rsindex df1ef2cf5..0bf554e04 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/multpl.rs@@ -531,7 +531,7 @@ pub async fn get_multpl_year_over_year_comparison(.format("%Y-%m-%d").to_string();- match get_multpl_series(series_name, Some(start_date), Some(end_date)).await {+ match get_multpl_series(series_name.clone(), Some(start_date), Some(end_date)).await {Ok(data) => {Ok(serde_json::json!({"year_over_year_comparison": data,diff --git a/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs b/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rsindex 888d6cb10..efbc912ff 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/nasdaq.rs@@ -1,5 +1,6 @@// NASDAQ data commands based on OpenBB nasdaq provideruse std::process::Command;+use chrono::Datelike;/// Execute NASDAQ Python script command#[tauri::command]@@ -466,6 +467,7 @@ pub async fn get_nasdaq_sector_analysis() -> Result<String, String> {"utilities", "real_estate", "basic_materials"];+ let sectors_clone = sectors.clone();for sector in sectors {match get_nasdaq_stocks_by_sector(sector.to_string(), Some(20)).await {Ok(data) => results.push((format!("sector_{}", sector), data)),@@ -475,7 +477,7 @@ pub async fn get_nasdaq_sector_analysis() -> Result<String, String> {Ok(serde_json::json!({"sector_analysis": results,- "sectors_analyzed": sectors+ "sectors_analyzed": sectors_clone}).to_string())}@@ -487,6 +489,7 @@ pub async fn get_nasdaq_market_cap_analysis() -> Result<String, String> {// Get data for each market cap categorylet market_caps = vec!["mega", "large", "mid", "small", "micro"];+ let market_caps_clone = market_caps.clone();for market_cap in market_caps {match get_nasdaq_stocks_by_market_cap(market_cap.to_string(), Some(20)).await {Ok(data) => results.push((format!("market_cap_{}", market_cap), data)),@@ -496,7 +499,7 @@ pub async fn get_nasdaq_market_cap_analysis() -> Result<String, String> {Ok(serde_json::json!({"market_cap_analysis": results,- "market_caps_analyzed": market_caps+ "market_caps_analyzed": market_caps_clone}).to_string())}@@ -508,6 +511,7 @@ pub async fn get_nasdaq_exchange_comparison() -> Result<String, String> {// Get data for each exchangelet exchanges = vec!["nasdaq", "nyse", "amex"];+ let exchanges_clone = exchanges.clone();for exchange in exchanges {match get_nasdaq_stocks_by_exchange(exchange.to_string(), Some(25)).await {Ok(data) => results.push((format!("exchange_{}", exchange), data)),@@ -517,7 +521,7 @@ pub async fn get_nasdaq_exchange_comparison() -> Result<String, String> {Ok(serde_json::json!({"exchange_comparison": results,- "exchanges_analyzed": exchanges+ "exchanges_analyzed": exchanges_clone}).to_string())}@@ -574,6 +578,7 @@ pub async fn get_nasdaq_directory_info() -> Result<String, String> {// Search for popular stockslet popular_searches = vec!["AAPL", "MSFT", "GOOGL", "AMZN", "TSLA"];+ let popular_searches_clone = popular_searches.clone();for search_term in popular_searches {match search_nasdaq_equities(Some(search_term.to_string()), None).await {Ok(data) => results.push((format!("search_{}", search_term), data)),@@ -595,6 +600,6 @@ pub async fn get_nasdaq_directory_info() -> Result<String, String> {Ok(serde_json::json!({"directory_info": results,- "popular_searches": popular_searches+ "popular_searches": popular_searches_clone}).to_string())}\ No newline at end of filediff --git a/fincept-terminal-desktop/src-tauri/src/commands/wto.rs b/fincept-terminal-desktop/src-tauri/src/commands/wto.rsindex b0693dc76..e62d68b27 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/wto.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/wto.rs@@ -731,7 +731,7 @@ pub async fn get_wto_global_trade_overview() -> Result<String, String> {None,None,None,- Some(100).to_string(),+ Some(100),None,Some(1),None@@ -783,7 +783,7 @@ pub async fn get_wto_sector_trade_analysis(None,None,None,- Some(100).to_string(),+ Some(100),None,Some(1),None@@ -831,7 +831,7 @@ pub async fn get_wto_comparative_trade_analysis(None,None,None,- Some(100).to_string(),+ Some(100),None,Some(1),Nonediff --git a/fincept-terminal-desktop/src-tauri/src/data_sources/yfinance.rs b/fincept-terminal-desktop/src-tauri/src/data_sources/yfinance.rsindex 8a07f1f9d..1b55b973d 100644--- a/fincept-terminal-desktop/src-tauri/src/data_sources/yfinance.rs+++ b/fincept-terminal-desktop/src-tauri/src/data_sources/yfinance.rs@@ -187,7 +187,7 @@ impl YFinanceProvider {pub async fn get_period_returns(&self, symbol: &str) -> Option<(f64, f64)> {// Get current date and past dateslet today = chrono::Utc::now().format("%Y-%m-%d").to_string();- let seven_days_ago = (chrono::Utc::now() - chrono::Duration::days(10)).format("%Y-%m-%d").to_string();+ let _seven_days_ago = (chrono::Utc::now() - chrono::Duration::days(10)).format("%Y-%m-%d").to_string();let thirty_days_ago = (chrono::Utc::now() - chrono::Duration::days(35)).format("%Y-%m-%d").to_string();// Fetch historical datadiff --git a/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx b/fincept-terminal-desktop/src/components/tabs/NewsTab.tsxindex 0bf85eec1..24f8f3391 100644--- a/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx@@ -1,237 +1,90 @@import React, { useState, useEffect } from 'react';--interface NewsArticle {- id: string;- time: string;- priority: 'FLASH' | 'URGENT' | 'BREAKING' | 'ROUTINE';- category: string;- headline: string;- summary: string;- source: string;- region: string;- sentiment: 'BULLISH' | 'BEARISH' | 'NEUTRAL';- impact: 'HIGH' | 'MEDIUM' | 'LOW';- tickers: string[];- classification: string;-}--interface MarketAlert {- time: string;- type: 'EARNINGS' | 'MERGER' | 'REGULATORY' | 'ECONOMIC' | 'TECHNICAL';- message: string;- severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';- affected: string[];-}+import { fetchNewsWithCache, type NewsArticle, getRSSFeedCount, getActiveSources, isUsingMockData } from '../../services/newsService';const NewsTab: React.FC = () => {const [currentTime, setCurrentTime] = useState(new Date());const [activeFilter, setActiveFilter] = useState('ALL');- const [newsTicker, setNewsTicker] = useState(0);- const [alertCount, setAlertCount] = useState(47);-- // Bloomberg color scheme (exact from DearPyGUI)- const BLOOMBERG_ORANGE = '#FFA500';- const BLOOMBERG_WHITE = '#FFFFFF';- const BLOOMBERG_RED = '#FF0000';- const BLOOMBERG_GREEN = '#00C800';- const BLOOMBERG_YELLOW = '#FFFF00';- const BLOOMBERG_GRAY = '#787878';- const BLOOMBERG_BLUE = '#6496FA';- const BLOOMBERG_PURPLE = '#C864FF';- const BLOOMBERG_CYAN = '#00FFFF';- const BLOOMBERG_DARK_BG = '#000000';- const BLOOMBERG_PANEL_BG = '#0a0a0a';+ const [newsUpdateCount, setNewsUpdateCount] = useState(0);+ const [alertCount, setAlertCount] = useState(0);+ const [newsArticles, setNewsArticles] = useState<NewsArticle[]>([]);+ const [loading, setLoading] = useState(true);+ const [activeSources, setActiveSources] = useState<string[]>([]);++ // Professional Financial Terminal Colors+ const TERMINAL_ORANGE = '#FFA500';+ const TERMINAL_WHITE = '#FFFFFF';+ const TERMINAL_RED = '#FF0000';+ const TERMINAL_GREEN = '#00C800';+ const TERMINAL_YELLOW = '#FFFF00';+ const TERMINAL_GRAY = '#787878';+ const TERMINAL_BLUE = '#6496FA';+ const TERMINAL_PURPLE = '#C864FF';+ const TERMINAL_CYAN = '#00FFFF';+ const TERMINAL_DARK_BG = '#000000';+ const TERMINAL_PANEL_BG = '#0a0a0a';++ // Fetch real news on mount and every 5 minutes+ useEffect(() => {+ const loadNews = async () => {+ setLoading(true);+ try {+ const articles = await fetchNewsWithCache();+ setNewsArticles(articles);+ setAlertCount(articles.filter(a => a.priority === 'FLASH' || a.priority === 'URGENT').length);+ setActiveSources(getActiveSources());+ setNewsUpdateCount(prev => prev + 1);+ } catch (error) {+ console.error('Error fetching news:', error);+ } finally {+ setLoading(false);+ }+ };++ loadNews();++ // Refresh news every 5 minutes+ const newsRefreshInterval = setInterval(loadNews, 5 * 60 * 1000);++ return () => clearInterval(newsRefreshInterval);+ }, []);useEffect(() => {const timer = setInterval(() => {setCurrentTime(new Date());- setNewsTicker(prev => prev + 1);- if (Math.random() > 0.7) setAlertCount(prev => prev + 1);- }, 3000);+ }, 1000);return () => clearInterval(timer);}, []);- const newsArticles: NewsArticle[] = [- {- id: '1',- time: '16:47:23',- priority: 'FLASH',- category: 'MARKETS',- headline: 'Federal Reserve Signals Emergency Rate Cut - 75bps Expected',- summary: 'Fed Chair Powell indicates potential emergency monetary policy action following inflation data showing 2.8% core PCE. Markets rally on dovish pivot expectations.',- source: 'BLOOMBERG',- region: 'US',- sentiment: 'BULLISH',- impact: 'HIGH',- tickers: ['SPY', 'QQQ', 'TLT', 'USD'],- classification: 'PUBLIC'- },- {- id: '2',- time: '16:45:12',- priority: 'URGENT',- category: 'EARNINGS',- headline: 'Apple Q4 Earnings Beat - iPhone Sales Surge 18% YoY',- summary: 'AAPL reports $1.89 EPS vs $1.70 est. Revenue $89.5B vs $94.5B est. Services revenue hits record $22.3B. China sales rebound strongly.',- source: 'REUTERS',- region: 'US',- sentiment: 'BULLISH',- impact: 'HIGH',- tickers: ['AAPL', 'NASDAQ', 'QQQ'],- classification: 'PUBLIC'- },- {- id: '3',- time: '16:43:56',- priority: 'BREAKING',- category: 'GEOPOLITICS',- headline: 'China Announces $2.8T Infrastructure Investment Plan',- summary: 'Beijing unveils massive Belt & Road 2.0 initiative targeting Southeast Asia and Africa. Focus on AI, renewable energy, and digital infrastructure.',- source: 'XINHUA',- region: 'ASIA',- sentiment: 'BULLISH',- impact: 'MEDIUM',- tickers: ['FXI', 'ASHR', 'MCHI', 'EEM'],- classification: 'PUBLIC'- },- {- id: '4',- time: '16:42:31',- priority: 'URGENT',- category: 'ENERGY',- headline: 'Saudi Arabia Extends Oil Production Cuts Through Q2 2024',- summary: 'Kingdom maintains 1M bpd voluntary cut. OPEC+ meeting confirms coordinated supply management. Brent crude jumps 4.2% to $87.45.',- source: 'WSJ',- region: 'MIDEAST',- sentiment: 'BULLISH',- impact: 'HIGH',- tickers: ['USO', 'XLE', 'CVX', 'XOM'],- classification: 'PUBLIC'- },- {- id: '5',- time: '16:41:08',- priority: 'FLASH',- category: 'CRYPTO',- headline: 'Bitcoin ETF Approval - SEC Greenlights 11 Spot ETFs',- summary: 'Historic regulatory milestone as SEC approves spot Bitcoin ETFs from BlackRock, Fidelity, Grayscale. BTC surges 12% to $48,500.',- source: 'COINDESK',- region: 'US',- sentiment: 'BULLISH',- impact: 'HIGH',- tickers: ['BTC', 'GBTC', 'COIN', 'MSTR'],- classification: 'PUBLIC'- },- {- id: '6',- time: '16:39:45',- priority: 'URGENT',- category: 'TECH',- headline: 'Microsoft Azure AI Revenue Hits $1B Quarterly Run Rate',- summary: 'MSFT Azure OpenAI services exceed $1B ARR. Enterprise AI adoption accelerates. Cloud segment shows 28% growth. Stock up 6% after hours.',- source: 'CNBC',- region: 'US',- sentiment: 'BULLISH',- impact: 'MEDIUM',- tickers: ['MSFT', 'NVDA', 'GOOGL', 'META'],- classification: 'PUBLIC'- },- {- id: '7',- time: '16:38:22',- priority: 'BREAKING',- category: 'BANKING',- headline: 'JPMorgan Reports Record Q4 Net Income - $15.2B',- summary: 'JPM beats on all metrics. Net interest income $22.9B vs $22.1B est. Credit loss provisions down 34%. Jamie Dimon optimistic on 2024 outlook.',- source: 'FINANCIAL TIMES',- region: 'US',- sentiment: 'BULLISH',- impact: 'MEDIUM',- tickers: ['JPM', 'BAC', 'WFC', 'XLF'],- classification: 'PUBLIC'- },- {- id: '8',- time: '16:37:01',- priority: 'ROUTINE',- category: 'ECONOMIC',- headline: 'EU GDP Growth Revised Higher - 0.6% QoQ vs 0.4% Est',- summary: 'Eurostat revises Q3 GDP growth upward. German manufacturing shows resilience. ECB likely to pause rate hikes. EUR/USD rallies to 1.0890.',- source: 'EUROSTAT',- region: 'EUROPE',- sentiment: 'NEUTRAL',- impact: 'LOW',- tickers: ['EZU', 'FEZ', 'VGK', 'EUR'],- classification: 'PUBLIC'- }- ];-- const marketAlerts: MarketAlert[] = [- {- time: '16:48:15',- type: 'TECHNICAL',- message: 'S&P 500 breaks above 4,800 resistance - Bullish momentum building',- severity: 'HIGH',- affected: ['SPY', 'SPX', 'ES']- },- {- time: '16:46:33',- type: 'ECONOMIC',- message: 'VIX drops below 12 - Complacency levels reaching extremes',- severity: 'MEDIUM',- affected: ['VIX', 'VXX', 'UVXY']- },- {- time: '16:44:27',- type: 'EARNINGS',- message: 'Tesla earnings whisper numbers suggest 15% beat possible',- severity: 'HIGH',- affected: ['TSLA', 'EV sector']- },- {- time: '16:42:18',- type: 'REGULATORY',- message: 'FDA fast-tracks Alzheimer drug - Biotech sector surge expected',- severity: 'MEDIUM',- affected: ['XBI', 'BIIB', 'SGEN']- }- ];+ // Generate news ticker from articles+ const newsTickerText = newsArticles.slice(0, 15).map(a =>+ `🔴 ${a.headline.toUpperCase().slice(0, 100)}`+ ).join(' • ') || 'Loading news feeds...';const getPriorityColor = (priority: string) => {switch (priority) {- case 'FLASH': return BLOOMBERG_RED;- case 'URGENT': return BLOOMBERG_ORANGE;- case 'BREAKING': return BLOOMBERG_YELLOW;- case 'ROUTINE': return BLOOMBERG_GREEN;- default: return BLOOMBERG_GRAY;+ case 'FLASH': return TERMINAL_RED;+ case 'URGENT': return TERMINAL_ORANGE;+ case 'BREAKING': return TERMINAL_YELLOW;+ case 'ROUTINE': return TERMINAL_GREEN;+ default: return TERMINAL_GRAY;}};const getSentimentColor = (sentiment: string) => {switch (sentiment) {- case 'BULLISH': return BLOOMBERG_GREEN;- case 'BEARISH': return BLOOMBERG_RED;- case 'NEUTRAL': return BLOOMBERG_YELLOW;- default: return BLOOMBERG_GRAY;+ case 'BULLISH': return TERMINAL_GREEN;+ case 'BEARISH': return TERMINAL_RED;+ case 'NEUTRAL': return TERMINAL_YELLOW;+ default: return TERMINAL_GRAY;}};const getImpactColor = (impact: string) => {switch (impact) {- case 'HIGH': return BLOOMBERG_RED;- case 'MEDIUM': return BLOOMBERG_YELLOW;- case 'LOW': return BLOOMBERG_GREEN;- default: return BLOOMBERG_GRAY;- }- };-- const getSeverityColor = (severity: string) => {- switch (severity) {- case 'CRITICAL': return BLOOMBERG_RED;- case 'HIGH': return BLOOMBERG_ORANGE;- case 'MEDIUM': return BLOOMBERG_YELLOW;- case 'LOW': return BLOOMBERG_GREEN;- default: return BLOOMBERG_GRAY;+ case 'HIGH': return TERMINAL_RED;+ case 'MEDIUM': return TERMINAL_YELLOW;+ case 'LOW': return TERMINAL_GREEN;+ default: return TERMINAL_GRAY;}};@@ -239,11 +92,23 @@ const NewsTab: React.FC = () => {? newsArticles: newsArticles.filter(article => article.category === activeFilter);+ // Calculate stats from real data+ const bullishCount = newsArticles.filter(a => a.sentiment === 'BULLISH').length;+ const bearishCount = newsArticles.filter(a => a.sentiment === 'BEARISH').length;+ const neutralCount = newsArticles.filter(a => a.sentiment === 'NEUTRAL').length;+ const totalCount = newsArticles.length || 1;+ const sentimentScore = ((bullishCount - bearishCount) / totalCount).toFixed(2);++ // Category counts+ const breakingCount = newsArticles.filter(a => a.priority === 'BREAKING' || a.priority === 'FLASH').length;+ const earningsCount = newsArticles.filter(a => a.category === 'EARNINGS').length;+ const economicCount = newsArticles.filter(a => a.category === 'ECONOMIC').length;+return (<div style={{height: '100%',- backgroundColor: BLOOMBERG_DARK_BG,- color: BLOOMBERG_WHITE,+ backgroundColor: TERMINAL_DARK_BG,+ color: TERMINAL_WHITE,fontFamily: 'Consolas, monospace',overflow: 'hidden',display: 'flex',@@ -252,29 +117,27 @@ const NewsTab: React.FC = () => {}}>{/* Complex Header with News Ticker */}<div style={{- backgroundColor: BLOOMBERG_PANEL_BG,- borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ backgroundColor: TERMINAL_PANEL_BG,+ borderBottom: `1px solid ${TERMINAL_GRAY}`,padding: '4px 8px',flexShrink: 0}}>{/* Main Status Line */}<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '13px', marginBottom: '2px' }}>- <span style={{ color: BLOOMBERG_ORANGE, fontWeight: 'bold' }}>BLOOMBERG PROFESSIONAL NEWS</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_RED, fontWeight: 'bold', animation: 'blink 1s infinite' }}>BREAKING NEWS</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_YELLOW }}>ALERTS: {alertCount}</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_GREEN }}>● LIVE FEED</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_WHITE }}>{currentTime.toISOString().replace('T', ' ').substring(0, 19)} UTC</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_BLUE }}>UPDATES: {newsTicker}</span>+ <span style={{ color: TERMINAL_ORANGE, fontWeight: 'bold' }}>FINCEPT TERMINAL PROFESSIONAL NEWS</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_RED, fontWeight: 'bold', animation: 'blink 1s infinite' }}>LIVE FEED</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_YELLOW }}>ALERTS: {alertCount}</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_GREEN }}>● {getRSSFeedCount()} SOURCES</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_WHITE }}>{currentTime.toISOString().replace('T', ' ').substring(0, 19)} UTC</span></div>{/* News Ticker */}<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '11px', marginBottom: '2px' }}>- <span style={{ color: BLOOMBERG_YELLOW, fontWeight: 'bold' }}>TICKER:</span>+ <span style={{ color: TERMINAL_YELLOW, fontWeight: 'bold' }}>BREAKING:</span><div style={{flex: 1,overflow: 'hidden',@@ -282,38 +145,35 @@ const NewsTab: React.FC = () => {}}><div style={{display: 'inline-block',- animation: 'scroll-left 60s linear infinite',- color: BLOOMBERG_WHITE+ animation: 'scroll-left 90s linear infinite',+ color: TERMINAL_WHITE}}>- 🔴 FED RATE CUT EXPECTED • AAPL BEATS Q4 EARNINGS • CHINA $2.8T INFRASTRUCTURE PLAN • SAUDI EXTENDS OIL CUTS •- BITCOIN ETF APPROVED • MSFT AZURE AI $1B+ • JPM RECORD Q4 PROFIT • EU GDP REVISED HIGHER •- S&P 500 BREAKS 4800 • VIX BELOW 12 • TESLA EARNINGS BEAT EXPECTED • FDA BIOTECH APPROVAL+ {newsTickerText}</div></div></div>{/* Sources and Stats */}- <div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '11px' }}>- <span style={{ color: BLOOMBERG_GRAY }}>SOURCES:</span>- <span style={{ color: BLOOMBERG_GREEN }}>BLOOMBERG●</span>- <span style={{ color: BLOOMBERG_GREEN }}>REUTERS●</span>- <span style={{ color: BLOOMBERG_GREEN }}>WSJ●</span>- <span style={{ color: BLOOMBERG_GREEN }}>FT●</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_GRAY }}>PROCESSING:</span>- <span style={{ color: BLOOMBERG_CYAN }}>2.3M articles/day</span>- <span style={{ color: BLOOMBERG_WHITE }}>|</span>- <span style={{ color: BLOOMBERG_GRAY }}>SENTIMENT:</span>- <span style={{ color: BLOOMBERG_GREEN }}>BULLISH 62%</span>- <span style={{ color: BLOOMBERG_RED }}>BEARISH 23%</span>- <span style={{ color: BLOOMBERG_YELLOW }}>NEUTRAL 15%</span>+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '10px', flexWrap: 'wrap' }}>+ <span style={{ color: TERMINAL_GRAY }}>ACTIVE SOURCES:</span>+ {activeSources.slice(0, 12).map((source, idx) => (+ <span key={idx} style={{ color: TERMINAL_GREEN }}>{source}●</span>+ ))}+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_GRAY }}>ARTICLES:</span>+ <span style={{ color: TERMINAL_CYAN }}>{newsArticles.length}</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: TERMINAL_GRAY }}>STATUS:</span>+ <span style={{ color: loading ? TERMINAL_YELLOW : TERMINAL_GREEN }}>+ {loading ? 'UPDATING...' : (isUsingMockData() ? '● DEMO MODE' : '● LIVE')}+ </span></div></div>{/* Function Keys Bar */}<div style={{- backgroundColor: BLOOMBERG_PANEL_BG,- borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ backgroundColor: TERMINAL_PANEL_BG,+ borderBottom: `1px solid ${TERMINAL_GRAY}`,padding: '2px 4px',flexShrink: 0}}>@@ -328,320 +188,263 @@ const NewsTab: React.FC = () => {{ key: "F7", label: "BANKING", filter: "BANKING" },{ key: "F8", label: "CRYPTO", filter: "CRYPTO" },{ key: "F9", label: "GEOPO", filter: "GEOPOLITICS" },- { key: "F10", label: "ALERTS", filter: "ALERTS" },- { key: "F11", label: "SEARCH", filter: "SEARCH" },- { key: "F12", label: "SETTINGS", filter: "SETTINGS" }+ { key: "F10", label: "FLASH", filter: "FLASH" },+ { key: "F11", label: "URGENT", filter: "URGENT" },+ { key: "F12", label: "REFRESH", filter: "REFRESH" }].map(item => (<button key={item.key}- onClick={() => setActiveFilter(item.filter)}+ onClick={() => {+ if (item.filter === 'REFRESH') {+ window.location.reload();+ } else if (item.filter === 'FLASH') {+ setActiveFilter('ALL');+ setNewsArticles(prev => prev.filter(a => a.priority === 'FLASH'));+ } else if (item.filter === 'URGENT') {+ setActiveFilter('ALL');+ setNewsArticles(prev => prev.filter(a => a.priority === 'URGENT' || a.priority === 'FLASH'));+ } else {+ setActiveFilter(item.filter);+ }+ }}style={{- backgroundColor: activeFilter === item.filter ? BLOOMBERG_ORANGE : BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: activeFilter === item.filter ? BLOOMBERG_DARK_BG : BLOOMBERG_WHITE,+ backgroundColor: activeFilter === item.filter ? TERMINAL_ORANGE : TERMINAL_DARK_BG,+ border: `1px solid ${TERMINAL_GRAY}`,+ color: activeFilter === item.filter ? TERMINAL_DARK_BG : TERMINAL_WHITE,padding: '2px 4px',fontSize: '9px',height: '16px',display: 'flex',alignItems: 'center',justifyContent: 'center',- fontWeight: activeFilter === item.filter ? 'bold' : 'normal'+ fontWeight: activeFilter === item.filter ? 'bold' : 'normal',+ cursor: 'pointer'}}>- <span style={{ color: BLOOMBERG_YELLOW }}>{item.key}:</span>+ <span style={{ color: TERMINAL_YELLOW }}>{item.key}:</span><span style={{ marginLeft: '2px' }}>{item.label}</span></button>))}</div></div>- {/* Main Content - 3 Panel Layout */}+ {/* Main Content - 3 Column Dense News Layout */}<div style={{ flex: 1, overflow: 'auto', padding: '4px', backgroundColor: '#050505' }}><div style={{ display: 'flex', gap: '4px', height: '100%' }}>- {/* Left Panel - Breaking News Stream */}+ {/* Left Panel - Breaking News Stream (Primary Feed) */}<div style={{- width: '400px',- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,+ flex: 1,+ backgroundColor: TERMINAL_PANEL_BG,+ border: `1px solid ${TERMINAL_GRAY}`,padding: '4px',overflow: 'auto'}}>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>- BREAKING NEWS STREAM [{activeFilter}]+ <div style={{ color: TERMINAL_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>+ PRIMARY NEWS FEED [{activeFilter}]</div>- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '4px' }}></div>+ <div style={{ borderBottom: `1px solid ${TERMINAL_GRAY}`, marginBottom: '4px' }}></div>++ {loading && newsArticles.length === 0 ? (+ <div style={{ color: TERMINAL_YELLOW, fontSize: '10px', textAlign: 'center', padding: '20px' }}>+ Loading news from {getRSSFeedCount()} RSS feeds...+ </div>+ ) : filteredNews.length === 0 ? (+ <div style={{ color: TERMINAL_GRAY, fontSize: '10px', textAlign: 'center', padding: '20px' }}>+ No articles found for filter: {activeFilter}+ </div>+ ) : null}- {filteredNews.map((article, index) => (+ {filteredNews.slice(0, Math.ceil(filteredNews.length / 3)).map((article, index) => (<div key={article.id} style={{marginBottom: '6px',borderLeft: `3px solid ${getPriorityColor(article.priority)}`,paddingLeft: '4px',- backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent'- }}>+ backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',+ cursor: article.link ? 'pointer' : 'default'+ }}+ onClick={() => article.link && window.open(article.link, '_blank')}+ ><div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}>- <span style={{ color: BLOOMBERG_GRAY, minWidth: '50px' }}>{article.time}</span>+ <span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span><span style={{ color: getPriorityColor(article.priority), fontWeight: 'bold', minWidth: '60px' }}>[{article.priority}]</span>- <span style={{ color: BLOOMBERG_BLUE, minWidth: '50px' }}>[{article.category}]</span>- <span style={{ color: BLOOMBERG_PURPLE, minWidth: '30px' }}>{article.region}</span>+ <span style={{ color: TERMINAL_BLUE, minWidth: '50px' }}>[{article.category}]</span>+ <span style={{ color: TERMINAL_PURPLE, minWidth: '30px' }}>{article.region}</span><span style={{ color: getSentimentColor(article.sentiment), minWidth: '50px' }}>{article.sentiment}</span></div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', fontSize: '10px', lineHeight: '1.2', marginBottom: '2px' }}>+ <div style={{ color: TERMINAL_WHITE, fontWeight: 'bold', fontSize: '10px', lineHeight: '1.2', marginBottom: '2px' }}>{article.headline}</div>- <div style={{ color: BLOOMBERG_GRAY, fontSize: '9px', lineHeight: '1.2', marginBottom: '2px' }}>+ <div style={{ color: TERMINAL_GRAY, fontSize: '9px', lineHeight: '1.2', marginBottom: '2px' }}>{article.summary}</div><div style={{ display: 'flex', justifyContent: 'space-between', fontSize: '8px' }}>- <span style={{ color: BLOOMBERG_CYAN }}>{article.source}</span>+ <span style={{ color: TERMINAL_CYAN }}>{article.source}</span><span style={{ color: getImpactColor(article.impact) }}>IMPACT: {article.impact}</span></div>-- <div style={{ fontSize: '8px', marginTop: '1px' }}>- <span style={{ color: BLOOMBERG_YELLOW }}>TICKERS: </span>- {article.tickers.map((ticker, i) => (- <span key={i} style={{ color: BLOOMBERG_GREEN, marginRight: '4px' }}>{ticker}</span>- ))}- </div></div>))}</div>- {/* Center Panel - Market Alerts & Analysis */}+ {/* Center Panel - Secondary News Feed */}<div style={{flex: 1,- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,+ backgroundColor: TERMINAL_PANEL_BG,+ border: `1px solid ${TERMINAL_GRAY}`,padding: '4px',overflow: 'auto'}}>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>- REAL-TIME MARKET ALERTS & ANALYSIS+ <div style={{ color: TERMINAL_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>+ SECONDARY NEWS FEED [{activeFilter}]</div>- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '8px' }}></div>+ <div style={{ borderBottom: `1px solid ${TERMINAL_GRAY}`, marginBottom: '4px' }}></div>- {/* Market Alerts Section */}- <div style={{ marginBottom: '12px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- ACTIVE MARKET ALERTS- </div>- {marketAlerts.map((alert, index) => (- <div key={index} style={{- marginBottom: '4px',- padding: '3px',- backgroundColor: 'rgba(255,0,0,0.1)',- border: `1px solid ${getSeverityColor(alert.severity)}`,- borderRadius: '2px'- }}>- <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: '8px', marginBottom: '1px' }}>- <span style={{ color: BLOOMBERG_GRAY }}>{alert.time}</span>- <span style={{ color: getSeverityColor(alert.severity), fontWeight: 'bold' }}>[{alert.severity}]</span>- <span style={{ color: BLOOMBERG_BLUE }}>[{alert.type}]</span>- </div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '9px', lineHeight: '1.2', marginBottom: '1px' }}>- {alert.message}- </div>- <div style={{ fontSize: '8px' }}>- <span style={{ color: BLOOMBERG_YELLOW }}>AFFECTED: </span>- {alert.affected.map((item, i) => (- <span key={i} style={{ color: BLOOMBERG_GREEN, marginRight: '4px' }}>{item}</span>- ))}- </div>+ {filteredNews.slice(Math.ceil(filteredNews.length / 3), Math.ceil(filteredNews.length * 2 / 3)).map((article, index) => (+ <div key={article.id} style={{+ marginBottom: '6px',+ borderLeft: `3px solid ${getPriorityColor(article.priority)}`,+ paddingLeft: '4px',+ backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',+ cursor: article.link ? 'pointer' : 'default'+ }}+ onClick={() => article.link && window.open(article.link, '_blank')}+ >+ <div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}>+ <span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span>+ <span style={{ color: getPriorityColor(article.priority), fontWeight: 'bold', minWidth: '60px' }}>+ [{article.priority}]+ </span>+ <span style={{ color: TERMINAL_BLUE, minWidth: '50px' }}>[{article.category}]</span>+ <span style={{ color: TERMINAL_PURPLE, minWidth: '30px' }}>{article.region}</span>+ <span style={{ color: getSentimentColor(article.sentiment), minWidth: '50px' }}>{article.sentiment}</span></div>- ))}- </div>- {/* Market Movers Section */}- <div style={{ marginBottom: '12px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- TOP MARKET MOVERS - NEWS DRIVEN- </div>- <div style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr 1fr',- gap: '4px',- fontSize: '9px',- marginBottom: '4px'- }}>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold' }}>TICKER</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold' }}>PRICE</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold' }}>CHANGE</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold' }}>NEWS IMPACT</div>- </div>+ <div style={{ color: TERMINAL_WHITE, fontWeight: 'bold', fontSize: '10px', lineHeight: '1.2', marginBottom: '2px' }}>+ {article.headline}+ </div>- {[- { ticker: 'AAPL', price: '184.92', change: '+8.34%', impact: 'EARNINGS BEAT' },- { ticker: 'MSFT', price: '378.45', change: '+6.12%', impact: 'AI REVENUE' },- { ticker: 'TSLA', price: '251.78', change: '+4.89%', impact: 'DELIVERY BEAT' },- { ticker: 'XLE', price: '89.23', change: '+4.21%', impact: 'SAUDI CUTS' },- { ticker: 'BTC', price: '48,567', change: '+12.45%', impact: 'ETF APPROVAL' },- { ticker: 'JPM', price: '178.34', change: '+3.67%', impact: 'RECORD PROFIT' }- ].map((stock, index) => (- <div key={index} style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr 1fr',- gap: '4px',- fontSize: '9px',- marginBottom: '1px',- backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.03)' : 'transparent'- }}>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold' }}>{stock.ticker}</div>- <div style={{ color: BLOOMBERG_WHITE }}>{stock.price}</div>- <div style={{ color: BLOOMBERG_GREEN }}>{stock.change}</div>- <div style={{ color: BLOOMBERG_CYAN }}>{stock.impact}</div>+ <div style={{ color: TERMINAL_GRAY, fontSize: '9px', lineHeight: '1.2', marginBottom: '2px' }}>+ {article.summary}</div>- ))}- </div>- {/* Sector Impact */}- <div>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- NEWS IMPACT BY SECTOR- </div>- {[- { sector: 'Technology', impact: '+4.2%', news: 'AI revenue surge, cloud growth' },- { sector: 'Energy', impact: '+3.8%', news: 'OPEC cuts, geopolitical tensions' },- { sector: 'Financials', impact: '+2.9%', news: 'Strong earnings, rate environment' },- { sector: 'Healthcare', impact: '+1.4%', news: 'FDA approvals, M&A activity' },- { sector: 'Consumer', impact: '-0.8%', news: 'Inflation concerns, spending data' }- ].map((sector, index) => (- <div key={index} style={{- display: 'flex',- justifyContent: 'space-between',- fontSize: '9px',- marginBottom: '2px',- padding: '1px 2px'- }}>- <span style={{ color: BLOOMBERG_WHITE, minWidth: '80px' }}>{sector.sector}</span>- <span style={{ color: sector.impact.startsWith('+') ? BLOOMBERG_GREEN : BLOOMBERG_RED, minWidth: '50px' }}>- {sector.impact}- </span>- <span style={{ color: BLOOMBERG_GRAY, flex: 1, marginLeft: '8px' }}>{sector.news}</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: '8px' }}>+ <span style={{ color: TERMINAL_CYAN }}>{article.source}</span>+ <span style={{ color: getImpactColor(article.impact) }}>IMPACT: {article.impact}</span></div>- ))}- </div>+ </div>+ ))}</div>- {/* Right Panel - News Analytics */}+ {/* Right Panel - Tertiary Feed + Analytics */}<div style={{- width: '300px',- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,+ width: '400px',+ backgroundColor: TERMINAL_PANEL_BG,+ border: `1px solid ${TERMINAL_GRAY}`,padding: '4px',overflow: 'auto'}}>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>- NEWS ANALYTICS DASHBOARD- </div>- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '8px' }}></div>-- {/* Sentiment Analysis */}- <div style={{ marginBottom: '10px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- REAL-TIME SENTIMENT+ {/* News Analytics Section */}+ <div style={{ marginBottom: '12px' }}>+ <div style={{ color: TERMINAL_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>+ REAL-TIME NEWS ANALYTICS</div>- <div style={{ fontSize: '9px', lineHeight: '1.3' }}>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Bullish Articles:</span>- <span style={{ color: BLOOMBERG_GREEN }}>162 (62%)</span>+ <div style={{ borderBottom: `1px solid ${TERMINAL_GRAY}`, marginBottom: '6px' }}></div>++ {/* Sentiment Analysis */}+ <div style={{ marginBottom: '8px', fontSize: '9px' }}>+ <div style={{ color: TERMINAL_YELLOW, fontWeight: 'bold', marginBottom: '3px' }}>+ SENTIMENT ANALYSIS+ </div>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Bullish Articles:</span>+ <span style={{ color: TERMINAL_GREEN }}>{bullishCount} ({Math.round((bullishCount/totalCount)*100)}%)</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Bearish Articles:</span>- <span style={{ color: BLOOMBERG_RED }}>59 (23%)</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Bearish Articles:</span>+ <span style={{ color: TERMINAL_RED }}>{bearishCount} ({Math.round((bearishCount/totalCount)*100)}%)</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Neutral Articles:</span>- <span style={{ color: BLOOMBERG_YELLOW }}>41 (15%)</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Neutral Articles:</span>+ <span style={{ color: TERMINAL_YELLOW }}>{neutralCount} ({Math.round((neutralCount/totalCount)*100)}%)</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '2px', paddingTop: '2px', borderTop: `1px solid ${BLOOMBERG_GRAY}` }}>- <span style={{ color: BLOOMBERG_CYAN }}>Sentiment Score:</span>- <span style={{ color: BLOOMBERG_GREEN, fontWeight: 'bold' }}>+0.73 (BULLISH)</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '2px', paddingTop: '2px', borderTop: `1px solid ${TERMINAL_GRAY}` }}>+ <span style={{ color: TERMINAL_CYAN, fontWeight: 'bold' }}>Sentiment Score:</span>+ <span style={{ color: parseFloat(sentimentScore) > 0 ? TERMINAL_GREEN : parseFloat(sentimentScore) < 0 ? TERMINAL_RED : TERMINAL_YELLOW, fontWeight: 'bold' }}>+ {sentimentScore} ({parseFloat(sentimentScore) > 0 ? 'BULLISH' : parseFloat(sentimentScore) < 0 ? 'BEARISH' : 'NEUTRAL'})+ </span></div></div>- </div>- {/* News Flow Statistics */}- <div style={{ marginBottom: '10px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- NEWS FLOW STATISTICS- </div>- <div style={{ fontSize: '9px', lineHeight: '1.3' }}>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Articles Today:</span>- <span style={{ color: BLOOMBERG_WHITE }}>2,847</span>+ {/* News Flow Statistics */}+ <div style={{ marginBottom: '8px', fontSize: '9px' }}>+ <div style={{ color: TERMINAL_YELLOW, fontWeight: 'bold', marginBottom: '3px' }}>+ NEWS FLOW STATS</div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Breaking News:</span>- <span style={{ color: BLOOMBERG_RED }}>23</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Total Articles:</span>+ <span style={{ color: TERMINAL_WHITE }}>{newsArticles.length}</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Earnings Reports:</span>- <span style={{ color: BLOOMBERG_BLUE }}>78</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Breaking News:</span>+ <span style={{ color: TERMINAL_RED }}>{breakingCount}</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Economic Data:</span>- <span style={{ color: BLOOMBERG_PURPLE }}>12</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Earnings Reports:</span>+ <span style={{ color: TERMINAL_BLUE }}>{earningsCount}</span></div>- <div style={{ display: 'flex', justifyContent: 'space-between' }}>- <span style={{ color: BLOOMBERG_GRAY }}>Fed News:</span>- <span style={{ color: BLOOMBERG_ORANGE }}>8</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>Economic Data:</span>+ <span style={{ color: TERMINAL_PURPLE }}>{economicCount}</span>+ </div>+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>+ <span style={{ color: TERMINAL_GRAY }}>High Priority:</span>+ <span style={{ color: TERMINAL_ORANGE }}>{alertCount}</span></div></div></div>- {/* Trending Topics */}- <div style={{ marginBottom: '10px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- TRENDING TOPICS (1H)+ {/* Tertiary News Feed */}+ <div style={{ borderTop: `2px solid ${TERMINAL_GRAY}`, paddingTop: '4px' }}>+ <div style={{ color: TERMINAL_ORANGE, fontSize: '11px', fontWeight: 'bold', marginBottom: '4px' }}>+ ADDITIONAL HEADLINES</div>- <div style={{ fontSize: '9px' }}>- {[- { topic: 'Federal Reserve', mentions: 156, trend: 'up' },- { topic: 'Artificial Intelligence', mentions: 134, trend: 'up' },- { topic: 'Bitcoin ETF', mentions: 89, trend: 'up' },- { topic: 'Oil Prices', mentions: 67, trend: 'up' },- { topic: 'Bank Earnings', mentions: 45, trend: 'stable' },- { topic: 'China Economy', mentions: 38, trend: 'down' }- ].map((item, index) => (- <div key={index} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1px' }}>- <span style={{ color: BLOOMBERG_WHITE }}>{item.topic}</span>- <div style={{ display: 'flex', gap: '4px', alignItems: 'center' }}>- <span style={{ color: BLOOMBERG_CYAN }}>{item.mentions}</span>- <span style={{- color: item.trend === 'up' ? BLOOMBERG_GREEN :- item.trend === 'down' ? BLOOMBERG_RED : BLOOMBERG_YELLOW- }}>- {item.trend === 'up' ? '↑' : item.trend === 'down' ? '↓' : '→'}- </span>- </div>+ <div style={{ borderBottom: `1px solid ${TERMINAL_GRAY}`, marginBottom: '4px' }}></div>++ {filteredNews.slice(Math.ceil(filteredNews.length * 2 / 3)).map((article, index) => (+ <div key={article.id} style={{+ marginBottom: '6px',+ borderLeft: `3px solid ${getPriorityColor(article.priority)}`,+ paddingLeft: '4px',+ backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',+ cursor: article.link ? 'pointer' : 'default'+ }}+ onClick={() => article.link && window.open(article.link, '_blank')}+ >+ <div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}>+ <span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span>+ <span style={{ color: getPriorityColor(article.priority), fontWeight: 'bold', minWidth: '60px' }}>+ [{article.priority}]+ </span>+ <span style={{ color: TERMINAL_BLUE, minWidth: '50px' }}>[{article.category}]</span></div>- ))}- </div>- </div>- {/* Key Economic Events */}- <div>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px', fontWeight: 'bold', marginBottom: '4px' }}>- UPCOMING EVENTS- </div>- <div style={{ fontSize: '8px' }}>- {[- { time: '18:00', event: 'Fed Chair Powell Speech', impact: 'HIGH' },- { time: '22:30', event: 'Core PCE Data Release', impact: 'HIGH' },- { time: 'Thu 08:30', event: 'Initial Jobless Claims', impact: 'MEDIUM' },- { time: 'Thu 10:00', event: 'ISM Manufacturing PMI', impact: 'MEDIUM' },- { time: 'Fri 08:30', event: 'Non-Farm Payrolls', impact: 'HIGH' }- ].map((event, index) => (- <div key={index} style={{ marginBottom: '2px', display: 'flex', gap: '4px' }}>- <span style={{ color: BLOOMBERG_GRAY, minWidth: '55px' }}>{event.time}</span>- <span style={{ color: BLOOMBERG_WHITE, flex: 1 }}>{event.event}</span>- <span style={{ color: getImpactColor(event.impact), minWidth: '40px' }}>[{event.impact}]</span>+ <div style={{ color: TERMINAL_WHITE, fontWeight: 'bold', fontSize: '10px', lineHeight: '1.2', marginBottom: '2px' }}>+ {article.headline}</div>- ))}- </div>++ <div style={{ color: TERMINAL_GRAY, fontSize: '9px', lineHeight: '1.2', marginBottom: '2px' }}>+ {article.summary.slice(0, 150)}...+ </div>++ <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: '8px' }}>+ <span style={{ color: TERMINAL_CYAN }}>{article.source}</span>+ <span style={{ color: getSentimentColor(article.sentiment) }}>{article.sentiment}</span>+ </div>+ </div>+ ))}</div></div></div>@@ -649,27 +452,29 @@ const NewsTab: React.FC = () => {{/* Status Bar */}<div style={{- borderTop: `1px solid ${BLOOMBERG_GRAY}`,- backgroundColor: BLOOMBERG_PANEL_BG,+ borderTop: `1px solid ${TERMINAL_GRAY}`,+ backgroundColor: TERMINAL_PANEL_BG,padding: '2px 8px',fontSize: '10px',- color: BLOOMBERG_GRAY,+ color: TERMINAL_GRAY,flexShrink: 0}}><div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', gap: '16px' }}>- <span>Bloomberg News Terminal v4.1.2 | Real-time financial news analysis</span>- <span>Sources: 47 Active | Processing: 2.3M articles/day | Sentiment: +0.73 Bullish</span>+ <span>FinceptTerminal Professional News v1.0.0 | Real-time from {getRSSFeedCount()} RSS feeds</span>+ <span>Articles: {newsArticles.length} | Filter: {activeFilter} | Updates: {newsUpdateCount}</span></div><div style={{ display: 'flex', gap: '16px' }}>- <span>Alerts: {alertCount} | Updates: {newsTicker}</span>+ <span>High Priority: {alertCount} | Sentiment: {sentimentScore}</span><span>Session: {currentTime.toTimeString().substring(0, 8)}</span>- <span style={{ color: BLOOMBERG_GREEN }}>FEED: LIVE</span>+ <span style={{ color: loading ? TERMINAL_YELLOW : TERMINAL_GREEN }}>+ {loading ? 'UPDATING...' : 'FEED: LIVE'}+ </span></div></div></div>- {/* CSS for animations */}+ {/* CSS for animations and transparent scrollbars */}<style>{`@keyframes scroll-left {0% { transform: translateX(100%); }@@ -679,9 +484,38 @@ const NewsTab: React.FC = () => {0%, 50% { opacity: 1; }51%, 100% { opacity: 0.3; }}++ /* Transparent scrollbars for all browsers */+ * {+ scrollbar-width: thin;+ scrollbar-color: rgba(120, 120, 120, 0.3) transparent;+ }++ *::-webkit-scrollbar {+ width: 8px;+ height: 8px;+ }++ *::-webkit-scrollbar-track {+ background: transparent;+ }++ *::-webkit-scrollbar-thumb {+ background-color: rgba(120, 120, 120, 0.3);+ border-radius: 4px;+ border: 2px solid transparent;+ }++ *::-webkit-scrollbar-thumb:hover {+ background-color: rgba(120, 120, 120, 0.5);+ }++ *::-webkit-scrollbar-corner {+ background: transparent;+ }`}</style></div>);};-export default NewsTab;\ No newline at end of file+export default NewsTab;diff --git a/fincept-terminal-desktop/src/services/newsService.ts b/fincept-terminal-desktop/src/services/newsService.tsnew file mode 100644index 000000000..e1952bb8f--- /dev/null+++ b/fincept-terminal-desktop/src/services/newsService.ts@@ -0,0 +1,584 @@+// FinceptTerminal Professional News RSS Feed Service+// Fetches real-time news from 20+ financial RSS feeds++export interface NewsArticle {+ id: string;+ time: string;+ priority: 'FLASH' | 'URGENT' | 'BREAKING' | 'ROUTINE';+ category: string;+ headline: string;+ summary: string;+ source: string;+ region: string;+ sentiment: 'BULLISH' | 'BEARISH' | 'NEUTRAL';+ impact: 'HIGH' | 'MEDIUM' | 'LOW';+ tickers: string[];+ classification: string;+ link?: string;+ pubDate?: Date;+}++// 20+ RSS Feed Sources - Real working feeds+const RSS_FEEDS = [+ // Major Financial News+ {+ name: 'Reuters Business',+ url: 'https://www.reutersagency.com/feed/?taxonomy=best-topics&post_type=best',+ category: 'MARKETS',+ region: 'GLOBAL',+ source: 'REUTERS'+ },+ {+ name: 'CNBC Top News',+ url: 'https://www.cnbc.com/id/100003114/device/rss/rss.html',+ category: 'MARKETS',+ region: 'US',+ source: 'CNBC'+ },+ {+ name: 'MarketWatch',+ url: 'https://www.marketwatch.com/rss/topstories',+ category: 'MARKETS',+ region: 'US',+ source: 'MARKETWATCH'+ },+ {+ name: 'WSJ Markets',+ url: 'https://feeds.a.dj.com/rss/RSSMarketsMain.xml',+ category: 'MARKETS',+ region: 'US',+ source: 'WSJ'+ },+ {+ name: 'Yahoo Finance',+ url: 'https://finance.yahoo.com/news/rssindex',+ category: 'MARKETS',+ region: 'US',+ source: 'YAHOO'+ },+ {+ name: 'Seeking Alpha',+ url: 'https://seekingalpha.com/feed.xml',+ category: 'MARKETS',+ region: 'US',+ source: 'SEEKING ALPHA'+ },+ {+ name: 'Investing.com',+ url: 'https://www.investing.com/rss/news.rss',+ category: 'MARKETS',+ region: 'GLOBAL',+ source: 'INVESTING.COM'+ },+ {+ name: 'Barrons',+ url: 'https://www.barrons.com/articles/rss',+ category: 'MARKETS',+ region: 'US',+ source: 'BARRONS'+ },++ // Cryptocurrency+ {+ name: 'CoinDesk',+ url: 'https://www.coindesk.com/arc/outboundfeeds/rss/',+ category: 'CRYPTO',+ region: 'GLOBAL',+ source: 'COINDESK'+ },+ {+ name: 'CoinTelegraph',+ url: 'https://cointelegraph.com/rss',+ category: 'CRYPTO',+ region: 'GLOBAL',+ source: 'COINTELEGRAPH'+ },+ {+ name: 'Decrypt',+ url: 'https://decrypt.co/feed',+ category: 'CRYPTO',+ region: 'GLOBAL',+ source: 'DECRYPT'+ },++ // Technology+ {+ name: 'TechCrunch',+ url: 'https://techcrunch.com/feed/',+ category: 'TECH',+ region: 'US',+ source: 'TECHCRUNCH'+ },+ {+ name: 'The Verge',+ url: 'https://www.theverge.com/rss/index.xml',+ category: 'TECH',+ region: 'US',+ source: 'THE VERGE'+ },+ {+ name: 'Ars Technica',+ url: 'https://feeds.arstechnica.com/arstechnica/index',+ category: 'TECH',+ region: 'US',+ source: 'ARS TECHNICA'+ },++ // Business & Economics+ {+ name: 'Forbes',+ url: 'https://www.forbes.com/business/feed/',+ category: 'MARKETS',+ region: 'US',+ source: 'FORBES'+ },+ {+ name: 'Business Insider',+ url: 'https://www.businessinsider.com/rss',+ category: 'MARKETS',+ region: 'US',+ source: 'BUSINESS INSIDER'+ },+ {+ name: 'The Economist',+ url: 'https://www.economist.com/finance-and-economics/rss.xml',+ category: 'ECONOMIC',+ region: 'GLOBAL',+ source: 'THE ECONOMIST'+ },++ // Energy & Commodities+ {+ name: 'Oil Price',+ url: 'https://oilprice.com/rss/main',+ category: 'ENERGY',+ region: 'GLOBAL',+ source: 'OILPRICE'+ },+ {+ name: 'Rigzone',+ url: 'https://www.rigzone.com/news/rss.asp',+ category: 'ENERGY',+ region: 'GLOBAL',+ source: 'RIGZONE'+ },++ // Global Markets+ {+ name: 'FXStreet',+ url: 'https://www.fxstreet.com/rss/news',+ category: 'MARKETS',+ region: 'GLOBAL',+ source: 'FXSTREET'+ },+ {+ name: 'Benzinga',+ url: 'https://www.benzinga.com/feed',+ category: 'MARKETS',+ region: 'US',+ source: 'BENZINGA'+ }+];++// Multiple CORS proxies for fallback+const CORS_PROXIES = [+ 'https://api.allorigins.win/raw?url=',+ 'https://corsproxy.io/?',+ 'https://api.codetabs.com/v1/proxy?quest='+];++// Parse RSS XML to articles+function parseRSSFeed(xmlText: string, feedConfig: typeof RSS_FEEDS[0]): NewsArticle[] {+ const articles: NewsArticle[] = [];++ try {+ const parser = new DOMParser();+ const xmlDoc = parser.parseFromString(xmlText, 'text/xml');++ // Check for parsing errors+ const parserError = xmlDoc.querySelector('parsererror');+ if (parserError) {+ console.error('XML parsing error:', parserError.textContent);+ return articles;+ }++ // Handle both RSS 2.0 and Atom feeds+ const items = xmlDoc.querySelectorAll('item, entry');++ items.forEach((item, index) => {+ try {+ const title = item.querySelector('title')?.textContent || '';+ const description = item.querySelector('description, summary')?.textContent || '';+ const link = item.querySelector('link')?.textContent || item.querySelector('link')?.getAttribute('href') || '';+ const pubDateText = item.querySelector('pubDate, published, updated')?.textContent || '';++ if (!title) return; // Skip items without title++ const pubDate = pubDateText ? new Date(pubDateText) : new Date();+ const timeStr = pubDate.toLocaleTimeString('en-US', { hour12: false });++ // Extract tickers from title and description (simple regex)+ const tickerRegex = /\b[A-Z]{1,5}\b/g;+ const tickersFound = (title + ' ' + description).match(tickerRegex) || [];+ const tickers = [...new Set(tickersFound.slice(0, 5))]; // Limit to 5 unique tickers++ // Determine priority based on keywords+ let priority: NewsArticle['priority'] = 'ROUTINE';+ const titleLower = title.toLowerCase();+ if (titleLower.includes('breaking') || titleLower.includes('alert')) {+ priority = 'FLASH';+ } else if (titleLower.includes('urgent') || titleLower.includes('emergency')) {+ priority = 'URGENT';+ } else if (titleLower.includes('announce') || titleLower.includes('report')) {+ priority = 'BREAKING';+ }++ // Determine sentiment based on keywords+ let sentiment: NewsArticle['sentiment'] = 'NEUTRAL';+ const textLower = (title + ' ' + description).toLowerCase();+ const bullishWords = ['surge', 'rally', 'gain', 'beat', 'growth', 'up', 'rise', 'jump', 'soar', 'high', 'record'];+ const bearishWords = ['fall', 'drop', 'decline', 'loss', 'down', 'crash', 'plunge', 'miss', 'weak', 'low'];++ const bullishCount = bullishWords.filter(word => textLower.includes(word)).length;+ const bearishCount = bearishWords.filter(word => textLower.includes(word)).length;++ if (bullishCount > bearishCount && bullishCount > 0) sentiment = 'BULLISH';+ else if (bearishCount > bullishCount && bearishCount > 0) sentiment = 'BEARISH';++ // Determine impact+ let impact: NewsArticle['impact'] = 'LOW';+ if (priority === 'FLASH' || priority === 'URGENT') impact = 'HIGH';+ else if (priority === 'BREAKING') impact = 'MEDIUM';++ // Determine category from feed config or keywords+ let category = feedConfig.category;+ if (textLower.includes('earnings') || textLower.includes('profit') || textLower.includes('revenue')) category = 'EARNINGS';+ else if (textLower.includes('fed') || textLower.includes('inflation') || textLower.includes('gdp') || textLower.includes('jobs')) category = 'ECONOMIC';+ else if (textLower.includes('tech') || textLower.includes('ai') || textLower.includes('software') || textLower.includes('cloud')) category = 'TECH';+ else if (textLower.includes('energy') || textLower.includes('oil') || textLower.includes('gas') || textLower.includes('opec')) category = 'ENERGY';+ else if (textLower.includes('bank') || textLower.includes('financial') || textLower.includes('credit')) category = 'BANKING';+ else if (textLower.includes('crypto') || textLower.includes('bitcoin') || textLower.includes('ethereum') || textLower.includes('blockchain')) category = 'CRYPTO';+ else if (textLower.includes('china') || textLower.includes('russia') || textLower.includes('ukraine') || textLower.includes('war')) category = 'GEOPOLITICS';++ articles.push({+ id: `${feedConfig.source}-${Date.now()}-${index}`,+ time: timeStr,+ priority,+ category,+ headline: title.slice(0, 200), // Limit headline length+ summary: description.slice(0, 300).replace(/<[^>]*>/g, ''), // Remove HTML tags+ source: feedConfig.source,+ region: feedConfig.region,+ sentiment,+ impact,+ tickers,+ classification: 'PUBLIC',+ link,+ pubDate+ });+ } catch (err) {+ console.error('Error parsing item:', err);+ }+ });+ } catch (error) {+ console.error('Error parsing RSS feed:', error);+ }++ return articles;+}++// Fetch single RSS feed with single proxy attempt (optimized for speed)+async function fetchRSSFeed(feedConfig: typeof RSS_FEEDS[0]): Promise<NewsArticle[]> {+ try {+ // Only use first proxy for speed+ const proxyUrl = `${CORS_PROXIES[0]}${encodeURIComponent(feedConfig.url)}`;++ const response = await fetch(proxyUrl, {+ headers: {+ 'Accept': 'application/rss+xml, application/xml, text/xml, */*'+ },+ signal: AbortSignal.timeout(5000) // Reduced to 5 second timeout+ });++ if (!response.ok) {+ return [];+ }++ const xmlText = await response.text();+ const articles = parseRSSFeed(xmlText, feedConfig);++ if (articles.length > 0) {+ console.log(`✓ Fetched ${articles.length} articles from ${feedConfig.name}`);+ }++ return articles;+ } catch (error) {+ // Silent fail for speed+ return [];+ }+}++// Fetch all RSS feeds with batching (optimized for speed)+export async function fetchAllNews(): Promise<NewsArticle[]> {+ console.log('Fetching news feeds (optimized batch mode)...');++ const allArticles: NewsArticle[] = [];+ const BATCH_SIZE = 5; // Fetch 5 feeds at a time+ const TARGET_ARTICLES = 30; // Stop early if we get enough articles++ // Process feeds in batches+ for (let i = 0; i < RSS_FEEDS.length; i += BATCH_SIZE) {+ const batch = RSS_FEEDS.slice(i, i + BATCH_SIZE);+ const promises = batch.map(feed => fetchRSSFeed(feed));+ const results = await Promise.allSettled(promises);++ results.forEach((result) => {+ if (result.status === 'fulfilled' && result.value.length > 0) {+ allArticles.push(...result.value);+ }+ });++ console.log(`Batch ${Math.floor(i / BATCH_SIZE) + 1}: Total articles: ${allArticles.length}`);++ // Early exit if we have enough articles+ if (allArticles.length >= TARGET_ARTICLES) {+ console.log(`✓ Reached ${allArticles.length} articles, stopping fetch`);+ break;+ }+ }++ // Sort by publication date (newest first)+ allArticles.sort((a, b) => {+ const dateA = a.pubDate || new Date(0);+ const dateB = b.pubDate || new Date(0);+ return dateB.getTime() - dateA.getTime();+ });++ console.log(`✓ Total articles loaded: ${allArticles.length}`);+ return allArticles;+}++// Fetch news with caching (cache for 5 minutes)+let cachedNews: NewsArticle[] = [];+let lastFetchTime = 0;+const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes+let useMockData = false;++export async function fetchNewsWithCache(): Promise<NewsArticle[]> {+ const now = Date.now();++ // Return cached news if still valid+ if (cachedNews.length > 0 && (now - lastFetchTime) < CACHE_DURATION) {+ console.log('Returning cached news');+ return cachedNews;+ }++ console.log('Fetching fresh news...');++ // Start with mock data immediately for instant display+ if (cachedNews.length === 0) {+ cachedNews = generateMockNews();+ useMockData = true;+ }++ // Try to fetch real news in background+ fetchAllNews().then(fetchedNews => {+ // If we got at least 10 articles, replace with real data+ if (fetchedNews.length >= 10) {+ console.log(`✓ Successfully loaded ${fetchedNews.length} real news articles`);+ cachedNews = fetchedNews;+ useMockData = false;+ lastFetchTime = Date.now();+ } else {+ console.warn(`⚠ Only fetched ${fetchedNews.length} articles, keeping mock data`);+ }+ }).catch(err => {+ console.error('Failed to fetch news:', err);+ });++ lastFetchTime = now;+ return cachedNews;+}++// Check if currently using mock data+export function isUsingMockData(): boolean {+ return useMockData;+}++// Get RSS feed count+export function getRSSFeedCount(): number {+ return RSS_FEEDS.length;+}++// Get active source names+export function getActiveSources(): string[] {+ return RSS_FEEDS.map(feed => feed.source);+}++// Generate mock news articles as fallback+function generateMockNews(): NewsArticle[] {+ const mockArticles: NewsArticle[] = [+ {+ id: 'mock-1',+ time: new Date().toLocaleTimeString('en-US', { hour12: false }),+ priority: 'FLASH',+ category: 'MARKETS',+ headline: 'BREAKING: S&P 500 Reaches All-Time High on Strong Tech Earnings',+ summary: 'The S&P 500 index surged to a record high today as major technology companies reported better-than-expected quarterly earnings. Investors are optimistic about continued growth in the AI and cloud computing sectors.',+ source: 'REUTERS',+ region: 'US',+ sentiment: 'BULLISH',+ impact: 'HIGH',+ tickers: ['SPY', 'AAPL', 'MSFT', 'GOOGL'],+ classification: 'PUBLIC',+ link: 'https://www.reuters.com',+ pubDate: new Date()+ },+ {+ id: 'mock-2',+ time: new Date(Date.now() - 300000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'URGENT',+ category: 'ECONOMIC',+ headline: 'Federal Reserve Signals Potential Rate Cut in Q4 2025',+ summary: 'Fed Chairman indicated in today\'s speech that the central bank is considering interest rate adjustments based on recent inflation data showing continued cooling in consumer prices.',+ source: 'WSJ',+ region: 'US',+ sentiment: 'BULLISH',+ impact: 'HIGH',+ tickers: ['TLT', 'IEF', 'SHY'],+ classification: 'PUBLIC',+ link: 'https://www.wsj.com',+ pubDate: new Date(Date.now() - 300000)+ },+ {+ id: 'mock-3',+ time: new Date(Date.now() - 600000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'BREAKING',+ category: 'EARNINGS',+ headline: 'Apple Reports Record iPhone Sales, Beats Estimates',+ summary: 'Apple Inc. posted quarterly revenue of $89.5 billion, exceeding analyst expectations. iPhone sales drove the growth with strong demand in China and India markets.',+ source: 'CNBC',+ region: 'US',+ sentiment: 'BULLISH',+ impact: 'MEDIUM',+ tickers: ['AAPL'],+ classification: 'PUBLIC',+ link: 'https://www.cnbc.com',+ pubDate: new Date(Date.now() - 600000)+ },+ {+ id: 'mock-4',+ time: new Date(Date.now() - 900000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'BREAKING',+ category: 'CRYPTO',+ headline: 'Bitcoin Surges Past $75,000 on ETF Inflows',+ summary: 'Bitcoin reached a new milestone as institutional investors continue pouring money into spot Bitcoin ETFs. Total crypto market cap exceeds $2.5 trillion.',+ source: 'COINDESK',+ region: 'GLOBAL',+ sentiment: 'BULLISH',+ impact: 'MEDIUM',+ tickers: ['BTC', 'ETH'],+ classification: 'PUBLIC',+ link: 'https://www.coindesk.com',+ pubDate: new Date(Date.now() - 900000)+ },+ {+ id: 'mock-5',+ time: new Date(Date.now() - 1200000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'ROUTINE',+ category: 'ENERGY',+ headline: 'Oil Prices Steady as OPEC+ Maintains Production Levels',+ summary: 'Crude oil futures traded flat as OPEC+ announced it will maintain current production quotas through the end of the year. WTI crude at $78.50/barrel.',+ source: 'OILPRICE',+ region: 'GLOBAL',+ sentiment: 'NEUTRAL',+ impact: 'LOW',+ tickers: ['USO', 'XLE'],+ classification: 'PUBLIC',+ link: 'https://oilprice.com',+ pubDate: new Date(Date.now() - 1200000)+ },+ {+ id: 'mock-6',+ time: new Date(Date.now() - 1500000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'BREAKING',+ category: 'TECH',+ headline: 'Microsoft Unveils Advanced AI Models for Enterprise',+ summary: 'Microsoft announced new AI capabilities integrated into Azure cloud platform, targeting enterprise customers with enhanced automation and analytics tools.',+ source: 'TECHCRUNCH',+ region: 'US',+ sentiment: 'BULLISH',+ impact: 'MEDIUM',+ tickers: ['MSFT'],+ classification: 'PUBLIC',+ link: 'https://techcrunch.com',+ pubDate: new Date(Date.now() - 1500000)+ },+ {+ id: 'mock-7',+ time: new Date(Date.now() - 1800000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'URGENT',+ category: 'BANKING',+ headline: 'JPMorgan Chase Reports Strong Q3 Results, Raises Guidance',+ summary: 'JPMorgan posted net income of $13.2 billion for the quarter, driven by robust investment banking and trading revenue. Bank raised full-year earnings guidance.',+ source: 'MARKETWATCH',+ region: 'US',+ sentiment: 'BULLISH',+ impact: 'HIGH',+ tickers: ['JPM', 'BAC', 'XLF'],+ classification: 'PUBLIC',+ link: 'https://www.marketwatch.com',+ pubDate: new Date(Date.now() - 1800000)+ },+ {+ id: 'mock-8',+ time: new Date(Date.now() - 2100000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'ROUTINE',+ category: 'MARKETS',+ headline: 'European Markets Close Mixed on Economic Data',+ summary: 'European stock indices ended the session with mixed results. FTSE 100 up 0.3%, DAX down 0.2% as investors digest latest GDP figures from Germany and France.',+ source: 'INVESTING.COM',+ region: 'EUROPE',+ sentiment: 'NEUTRAL',+ impact: 'LOW',+ tickers: ['EWG', 'EWU', 'VGK'],+ classification: 'PUBLIC',+ link: 'https://www.investing.com',+ pubDate: new Date(Date.now() - 2100000)+ },+ {+ id: 'mock-9',+ time: new Date(Date.now() - 2400000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'BREAKING',+ category: 'GEOPOLITICS',+ headline: 'US-China Trade Talks Resume, Markets Rally',+ summary: 'Renewed trade negotiations between Washington and Beijing boosted investor sentiment. Both sides expressed optimism about reaching a comprehensive trade agreement.',+ source: 'REUTERS',+ region: 'GLOBAL',+ sentiment: 'BULLISH',+ impact: 'MEDIUM',+ tickers: ['FXI', 'MCHI', 'SPY'],+ classification: 'PUBLIC',+ link: 'https://www.reuters.com',+ pubDate: new Date(Date.now() - 2400000)+ },+ {+ id: 'mock-10',+ time: new Date(Date.now() - 2700000).toLocaleTimeString('en-US', { hour12: false }),+ priority: 'ROUTINE',+ category: 'EARNINGS',+ headline: 'Tesla Misses Delivery Targets Despite Production Increase',+ summary: 'Tesla reported Q3 deliveries below analyst expectations despite ramping up production. Stock declined 3% in after-hours trading on the news.',+ source: 'CNBC',+ region: 'US',+ sentiment: 'BEARISH',+ impact: 'MEDIUM',+ tickers: ['TSLA'],+ classification: 'PUBLIC',+ link: 'https://www.cnbc.com',+ pubDate: new Date(Date.now() - 2700000)+ }+ ];++ return mockArticles;+}