Add Alpha Vantage API integration as primary data provider

- Replace FinnHub with Alpha Vantage API in README documentation
- Implement comprehensive Alpha Vantage modules:
  - Stock data (daily OHLCV with date filtering)
  - Technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands, ATR)
  - Fundamental data (overview, balance sheet, cashflow, income statement)
  - News and sentiment data with insider transactions
- Update news analyst tools to use ticker-based news search
- Integrate Alpha Vantage vendor methods into interface routing
- Maintain backward compatibility with existing vendor system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
luohy15
2025-09-26 22:57:50 +08:00
parent a6734d71bc
commit 0ab323c2c6
14 changed files with 519 additions and 19 deletions
+21 -2
View File
@@ -5,6 +5,16 @@ from .local import get_YFin_data, get_finnhub_news, get_finnhub_company_insider_
from .yahoo_finance import get_YFin_data_online, get_stock_stats_indicators_window
from .google import get_google_news
from .openai import get_stock_news_openai, get_global_news_openai, get_fundamentals_openai
from .alpha_vantage import (
get_stock as get_alpha_vantage_stock,
get_indicator as get_alpha_vantage_indicator,
get_fundamentals as get_alpha_vantage_fundamentals,
get_balance_sheet as get_alpha_vantage_balance_sheet,
get_cashflow as get_alpha_vantage_cashflow,
get_income_statement as get_alpha_vantage_income_statement,
get_insider_transactions as get_alpha_vantage_insider_transactions,
get_news as get_alpha_vantage_news
)
# Configuration and routing logic
from .config import get_config
@@ -54,29 +64,36 @@ VENDOR_LIST = [
VENDOR_METHODS = {
# core_stock_apis
"get_stock_data": {
"alpha_vantage": get_alpha_vantage_stock,
"yahoo_finance": get_YFin_data_online,
"local": get_YFin_data,
},
# technical_indicators
"get_indicators": {
"alpha_vantage": get_alpha_vantage_indicator,
"yahoo_finance": get_stock_stats_indicators_window,
"local": get_stock_stats_indicators_window
},
# fundamental_data
"get_fundamentals": {
"openai": get_fundamentals_openai
"alpha_vantage": get_alpha_vantage_fundamentals,
"openai": get_fundamentals_openai,
},
"get_balance_sheet": {
"alpha_vantage": get_alpha_vantage_balance_sheet,
"local": get_simfin_balance_sheet,
},
"get_cashflow": {
"alpha_vantage": get_alpha_vantage_cashflow,
"local": get_simfin_cashflow,
},
"get_income_statement": {
"alpha_vantage": get_alpha_vantage_income_statement,
"local": get_simfin_income_statements,
},
# news_data
"get_news": {
"alpha_vantage": get_alpha_vantage_news,
"openai": get_stock_news_openai,
"google": get_google_news,
"local": [get_finnhub_news, get_reddit_company_news, get_google_news],
@@ -89,6 +106,7 @@ VENDOR_METHODS = {
"local": get_finnhub_company_insider_sentiment
},
"get_insider_transactions": {
"alpha_vantage": get_alpha_vantage_insider_transactions,
"local": get_finnhub_company_insider_transactions,
},
}
@@ -131,7 +149,8 @@ def route_to_vender(method: str, *args, **kwargs):
for vendor in vendors:
if vendor not in VENDOR_METHODS[method]:
raise ValueError(f"Vendor '{vendor}' not supported for method '{method}'")
print(f"Info: Vendor '{vendor}' not supported for method '{method}', ignoring")
continue
vendor_impl = VENDOR_METHODS[method][vendor]