全面速覽:Yahu Financials API 各模組實用指南

要在競爭激烈的金融市場中快速開展數據驅動的投研工作,就需要一套功能全面、易於整合的接口服務。LuckdataYahu Financials API 正是為此而生,它涵蓋了行情、基本面、新聞、選股、輿情、組合等全場景數據,無論你是做量化回測、風控預警,還是搭建投研 Web 平臺,都能找到對應的能力模組。

一、模組一覽與核心能力

模組

核心用途

典型接口示例(GET / POST)

Market(行情)

即時/歷史行情、漲跌榜、K 線小圖

quotes: /api/yahu-financials/0h6ilfhtvlta?region=US&symbols=AAPL,TSLA

movers: /api/yahu-financials/b2tkd65h755m?lang=en-US&count=6&region=US

spark: /api/yahu-financials/gw5ycny2aaae?range=1d&symbols=AMZN&interval=1m

Stock(個股)

基本面數據、分析師評級、機構持倉、事件日曆

get-fundamentals: /api/yahu-financials/g6qnrm4550pq?symbol=AMRN&modules=assetProfile,summaryProfile

get-recommendations: /api/yahu-financials/6nwd8jn6id18?symbol=INTC

get-statistics: /api/yahu-financials/nu0a98y0vcj3?symbol=AMRN

News(新聞)

財經新聞聚合、按 UUID 獲取文章詳情

news/v2/get-details: /api/yahu-financials/4t4jbotgu79n?uuid=<UUID>&region=US

Screener(選股)

按財務指標或預置條件篩選標的

/screener/overview(字段列表)

/screener: POST,傳入多維 filterssortslimit

Conversations(評論)

投資社群討論抓取(輿情)

list: /api/yahu-financials/wjbchky2ls76?messageBoardId=finmb_24937&count=16&sort_by=newest

count: /api/yahu-financials/l2mlcgr2myz0?messageBoardId=finmb_24937

Watchlists(自選組合)

建立/查詢/管理自選組合,查看組合表現

watchlists: /api/yahu-financials/olza8ffcp4mf

watchlist-performance: /api/yahu-financials/j93gsfo4ho89?pfId=...&symbols=^GSPC

Portfolio(投資組合)

同步券商持倉、回測組合

watchlist-detail: /api/yahu-financials/1w4fvjj0dvnr?pfId=...

Tip:上表僅列出核心接口,完整參數詳情可於 Luckdata 文件中心查閱。

二、典型調用示例:Python 並發請求

在實際項目中,經常需要同時從多個模組獲取資料並行處理。以下提供一個簡單的 Python 示例,使用 requests 搭配 concurrent.futures 並發請求行情、選股與新聞模組,並將結果寫入本地 JSON 檔案。

import requests

import json

from concurrent.futures import ThreadPoolExecutor

API_KEY = "your-luckdata-key"

BASE_URL = "https://luckdata.io/api/yahu-financials"

HEADERS = {

"X-Luckdata-Api-Key": API_KEY,

"Content-Type": "application/json"

}

def fetch_market_quotes():

url = f"{BASE_URL}/0h6ilfhtvlta?region=US&symbols=AAPL,TSLA,GOOG"

res = requests.get(url, headers=HEADERS)

with open("market_quotes.json", "w") as f:

json.dump(res.json(), f)

def fetch_screener():

url = f"{BASE_URL}/0h6ilfhtvlta/screener"

payload = {

"region": "US",

"filters": [{"field": "trailingPE", "operator": "<", "value": 25}],

"limit": 10

}

res = requests.post(url, headers=HEADERS, json=payload)

with open("screener_results.json", "w") as f:

json.dump(res.json(), f)

def fetch_news_detail():

uuid = "9803606d-a324-3864-83a8-2bd621e6ccbd"

url = f"{BASE_URL}/4t4jbotgu79n?uuid={uuid}&region=US"

res = requests.get(url, headers=HEADERS)

with open("news_detail.json", "w") as f:

json.dump(res.json(), f)

with ThreadPoolExecutor() as executor:

executor.submit(fetch_market_quotes)

executor.submit(fetch_screener)

executor.submit(fetch_news_detail)

print("資料已全部拉取:")

print(" - 行情:market_quotes.json")

print(" - 選股:screener_results.json")

print(" - 新聞:news_detail.json")

這樣,你只需一鍵執行,即可並行拉取三類核心數據,後續可在腳本中加入資料清洗、入庫、觸發告警等更進階邏輯。

三、按需選擇模組與進階指南

  1. 只需行情監控 → 集中使用 Market 模組的 quotesmoversspark

  2. 深度標的研究 → 從 Stock 模組入手,全面組合 fundamentalsstatisticsholdersrecommendations

  3. 自動化選股 → 優先使用 Screener 模組,快速篩出高息股、低估值股等;可搭配 predefined 預置條件

  4. 輿情與新聞 → News + Conversations 兩模組聯動,既看媒體報導,也聽用戶討論

  5. 組合管理 → Watchlists + Watchlist-performance,實時監控淨值曲線與基準對比

未來的深入文章中,我們將逐一拆解:

  • 標的研究實戰(Stock 模組)

  • 組合儀表板搭建(Watchlists 模組)

  • 進階選股技巧(Screener 模組)

  • 輿情與對話式投研(News + Conversations)

四、總結與行動指南

Luckdata Yahu Financials API 為開發者提供了一個「一站式」的金融資料服務平臺。透過本文的全景梳理,你已掌握各大模組的核心能力與典型接口調用方式。

接下來,你可以:

  • 快速註冊並獲取 API Key

  • 按照 Python 示例腳本,動手並發請求核心數據

  • 根據自身需求,挑選一個模組深入研究並在專案中整合

五、補充章節:開發與部署建議

在實戰部署中,建議:

  • 將 API 調用模組化封裝,便於在各業務模組重複使用

  • 使用日誌與異常處理機制,提升系統穩定性

  • 結合定時任務(如 cronAirflow)進行定期抓取

  • 為大量請求考慮設置併發數限制與重試機制,避免超過 API 配額或觸發封鎖

透過這些開發建議,可更穩健地將 Yahu Financials API 整合入企業級數據架構中,支撐實時、準確的決策支持系統。

Articles related to APIs :