feat(数据源): 141个数据源全部通过真实API验证,含完整MD文档模板
新增内容: - 数据源接入验证报告_141个.md:完整验证报告含真实响应数据 - 5个批次验证脚本(verify_batch1-5.py) - 合并验证结果(all_verified_results.json) 数据源覆盖: - CEX: 42个(Binance/OKX/Bybit/Kraken/Gate.io/KuCoin/HTX/Bitfinex/Crypto.com/MEXC) - DEX: 7个(DexScreener/Hyperliquid/Raydium/1inch) - 链上: 12个(Blockchain.info/Mempool.space/Blockchair/Etherscan) - DeFi: 15个(DeFiLlama 12端点/Aave/Lido/L2排名) - 衍生品: 9个(Deribit 7端点/CoinGecko衍生品) - 社交: 10个(Reddit 8子版块/Nitter RSS/恐惧贪婪) - 宏观: 28个(Yahoo Finance 22端点/世界银行 6端点) - 综合: 18个(CoinGecko 8端点/CoinPaprika 7端点/CoinGlass/The Graph) 全部141个数据源100%免费,139个无需API Key
这个提交包含在:
261
20_Go迭代系统/scripts/verify_batch4.py
普通文件
261
20_Go迭代系统/scripts/verify_batch4.py
普通文件
@@ -0,0 +1,261 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
数据源验证脚本 - 第四批(编号 86-115)
|
||||
社交/新闻/宏观/NFT/矿业/稳定币/预言机/L2/其他
|
||||
"""
|
||||
import requests, json, time
|
||||
|
||||
TIMEOUT = 12
|
||||
results = {}
|
||||
|
||||
def test(name, fn):
|
||||
try:
|
||||
start = time.time()
|
||||
data = fn()
|
||||
elapsed = round((time.time() - start) * 1000)
|
||||
results[name] = {"status": "✅", "latency_ms": elapsed, "sample": data}
|
||||
print(f"✅ {name} ({elapsed}ms)")
|
||||
except Exception as e:
|
||||
results[name] = {"status": "❌", "error": str(e)[:200]}
|
||||
print(f"❌ {name}: {str(e)[:120]}")
|
||||
|
||||
# ─── 社交媒体扩展 ──────────────────────────────────────────────────────────
|
||||
|
||||
# 86. Reddit r/ethtrader
|
||||
def t86():
|
||||
r = requests.get("https://www.reddit.com/r/ethtrader/hot.json?limit=3", headers={"User-Agent":"QuantKnowledge/1.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()["data"]["children"]
|
||||
return {"top_post":d[0]["data"]["title"][:60],"score":d[0]["data"]["score"],"subscribers":d[0]["data"]["subreddit_subscribers"]}
|
||||
test("Reddit r/ethtrader", t86)
|
||||
|
||||
# 87. Reddit r/SatoshiStreetBets
|
||||
def t87():
|
||||
r = requests.get("https://www.reddit.com/r/SatoshiStreetBets/hot.json?limit=3", headers={"User-Agent":"QuantKnowledge/1.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()["data"]["children"]
|
||||
return {"top_post":d[0]["data"]["title"][:60],"score":d[0]["data"]["score"],"subscribers":d[0]["data"]["subreddit_subscribers"]}
|
||||
test("Reddit r/SatoshiStreetBets", t87)
|
||||
|
||||
# 88. Reddit r/defi
|
||||
def t88():
|
||||
r = requests.get("https://www.reddit.com/r/defi/hot.json?limit=3", headers={"User-Agent":"QuantKnowledge/1.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()["data"]["children"]
|
||||
return {"top_post":d[0]["data"]["title"][:60],"score":d[0]["data"]["score"],"subscribers":d[0]["data"]["subreddit_subscribers"]}
|
||||
test("Reddit r/defi", t88)
|
||||
|
||||
# 89. Reddit r/solana
|
||||
def t89():
|
||||
r = requests.get("https://www.reddit.com/r/solana/hot.json?limit=3", headers={"User-Agent":"QuantKnowledge/1.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()["data"]["children"]
|
||||
return {"top_post":d[0]["data"]["title"][:60],"score":d[0]["data"]["score"],"subscribers":d[0]["data"]["subreddit_subscribers"]}
|
||||
test("Reddit r/solana", t89)
|
||||
|
||||
# 90. Reddit r/wallstreetbets(宏观情绪)
|
||||
def t90():
|
||||
r = requests.get("https://www.reddit.com/r/wallstreetbets/hot.json?limit=3", headers={"User-Agent":"QuantKnowledge/1.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()["data"]["children"]
|
||||
return {"top_post":d[0]["data"]["title"][:60],"score":d[0]["data"]["score"],"subscribers":d[0]["data"]["subreddit_subscribers"]}
|
||||
test("Reddit r/wallstreetbets(宏观情绪)", t90)
|
||||
|
||||
# ─── 宏观经济扩展 ──────────────────────────────────────────────────────────
|
||||
|
||||
# 91. Yahoo Finance 原油(CL=F)
|
||||
def t91():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/CL=F", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"],"currency":meta["currency"]}
|
||||
test("Yahoo Finance 原油(CL=F)", t91)
|
||||
|
||||
# 92. Yahoo Finance 白银(SI=F)
|
||||
def t92():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/SI=F", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 白银(SI=F)", t92)
|
||||
|
||||
# 93. Yahoo Finance 铜(HG=F)
|
||||
def t93():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/HG=F", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 铜(HG=F)", t93)
|
||||
|
||||
# 94. Yahoo Finance 日经225(^N225)
|
||||
def t94():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/%5EN225", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 日经225(N225)", t94)
|
||||
|
||||
# 95. Yahoo Finance 恒生指数(^HSI)
|
||||
def t95():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/%5EHSI", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 恒生指数(HSI)", t95)
|
||||
|
||||
# 96. Yahoo Finance 道琼斯(^DJI)
|
||||
def t96():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/%5EDJI", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 道琼斯(DJI)", t96)
|
||||
|
||||
# 97. Yahoo Finance 罗素2000(^RUT)
|
||||
def t97():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/%5ERUT", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance 罗素2000(RUT)", t97)
|
||||
|
||||
# 98. Yahoo Finance EUR/USD
|
||||
def t98():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/EURUSD=X", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance EUR/USD汇率", t98)
|
||||
|
||||
# 99. Yahoo Finance USD/JPY
|
||||
def t99():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/JPY=X", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"]}
|
||||
test("Yahoo Finance USD/JPY汇率", t99)
|
||||
|
||||
# 100. Yahoo Finance 美国国债ETF(TLT)
|
||||
def t100():
|
||||
r = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/TLT", params={"interval":"1d","range":"5d"}, headers={"User-Agent":"Mozilla/5.0"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); meta=r.json()["chart"]["result"][0]["meta"]
|
||||
return {"symbol":meta["symbol"],"price":meta["regularMarketPrice"],"currency":meta["currency"]}
|
||||
test("Yahoo Finance 美国国债ETF(TLT)", t100)
|
||||
|
||||
# 101. 世界银行 失业率
|
||||
def t101():
|
||||
r = requests.get("https://api.worldbank.org/v2/country/US/indicator/SL.UEM.TOTL.ZS", params={"format":"json","per_page":"3","mrv":"3"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()[1]
|
||||
return [{"year":x["date"],"unemployment":f"{x['value']:.2f}%" if x["value"] else "N/A"} for x in d]
|
||||
test("世界银行 美国失业率", t101)
|
||||
|
||||
# 102. 世界银行 中国GDP
|
||||
def t102():
|
||||
r = requests.get("https://api.worldbank.org/v2/country/CN/indicator/NY.GDP.MKTP.CD", params={"format":"json","per_page":"3","mrv":"3"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()[1]
|
||||
return [{"year":x["date"],"gdp":f"${x['value']/1e12:.2f}T" if x["value"] else "N/A"} for x in d]
|
||||
test("世界银行 中国GDP", t102)
|
||||
|
||||
# ─── L2 / 预言机 / 基础设施 ────────────────────────────────────────────────
|
||||
|
||||
# 103. L2Beat TVL (via DeFiLlama)
|
||||
def t103():
|
||||
r = requests.get("https://api.llama.fi/v2/chains", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
l2s = [x for x in d if x["name"] in ["Arbitrum","Optimism","Base","zkSync Era","Starknet","Scroll","Linea","Blast","Manta","Mantle"]]
|
||||
return {"l2_count":len(l2s),"l2s":[{"name":x["name"],"tvl":f"${x['tvl']/1e9:.2f}B"} for x in sorted(l2s, key=lambda x:x.get("tvl",0), reverse=True)[:5]]}
|
||||
test("L2 TVL排名(via DeFiLlama)", t103)
|
||||
|
||||
# 104. Chainlink 预言机 ETH/USD(链上读取代替)
|
||||
def t104():
|
||||
# 使用 CoinGecko 获取 Chainlink 代币数据
|
||||
r = requests.get("https://api.coingecko.com/api/v3/coins/chainlink", params={"localization":"false","tickers":"false","community_data":"false","developer_data":"false"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
return {"name":d["name"],"price":d["market_data"]["current_price"]["usd"],"market_cap":f"${d['market_data']['market_cap']['usd']/1e9:.1f}B","ath":d["market_data"]["ath"]["usd"]}
|
||||
test("CoinGecko LINK代币数据", t104)
|
||||
|
||||
# 105. CoinGecko 分类列表
|
||||
def t105():
|
||||
r = requests.get("https://api.coingecko.com/api/v3/coins/categories", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
top5 = [{"name":x["name"],"market_cap":f"${x.get('market_cap',0)/1e9:.0f}B","market_cap_change_24h":f"{x.get('market_cap_change_24h',0):.2f}%"} for x in d[:5]]
|
||||
return {"total_categories":len(d),"top5":top5}
|
||||
test("CoinGecko 币种分类排名", t105)
|
||||
|
||||
# 106. CoinGecko BTC 历史价格
|
||||
def t106():
|
||||
r = requests.get("https://api.coingecko.com/api/v3/coins/bitcoin/market_chart", params={"vs_currency":"usd","days":"7","interval":"daily"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
prices = d["prices"]
|
||||
return {"data_points":len(prices),"latest_price":f"${prices[-1][1]:.0f}","7d_ago":f"${prices[0][1]:.0f}"}
|
||||
test("CoinGecko BTC 7日价格历史", t106)
|
||||
|
||||
# ─── 稳定币专项 ────────────────────────────────────────────────────────────
|
||||
|
||||
# 107. DeFiLlama 稳定币流通量历史
|
||||
def t107():
|
||||
r = requests.get("https://stablecoins.llama.fi/stablecoincharts/all", params={"stablecoin":"1"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
latest = d[-1]
|
||||
return {"date":latest["date"],"totalCirculatingUSD":f"${latest.get('totalCirculatingUSD',{}).get('peggedUSD',0)/1e9:.1f}B","data_points":len(d)}
|
||||
test("DeFiLlama USDT流通量历史", t107)
|
||||
|
||||
# 108. DeFiLlama 稳定币各链分布
|
||||
def t108():
|
||||
r = requests.get("https://stablecoins.llama.fi/stablecoinchains", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
top5 = sorted(d, key=lambda x:x.get("totalCirculatingUSD",{}).get("peggedUSD",0), reverse=True)[:5]
|
||||
return {"total_chains":len(d),"top5":[{"name":x["name"],"circulating":f"${x.get('totalCirculatingUSD',{}).get('peggedUSD',0)/1e9:.1f}B"} for x in top5]}
|
||||
test("DeFiLlama 稳定币各链分布", t108)
|
||||
|
||||
# ─── 矿业数据 ──────────────────────────────────────────────────────────────
|
||||
|
||||
# 109. Mempool.space 矿池排名
|
||||
def t109():
|
||||
r = requests.get("https://mempool.space/api/v1/mining/pools/1w", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
pools = d["pools"][:5]
|
||||
return {"total_pools":len(d["pools"]),"top5":[{"name":p["name"],"blockCount":p["blockCount"],"share":f"{p['share']*100:.1f}%"} for p in pools]}
|
||||
test("Mempool.space 矿池排名(1周)", t109)
|
||||
|
||||
# 110. Mempool.space 难度调整预测
|
||||
def t110():
|
||||
r = requests.get("https://mempool.space/api/v1/difficulty-adjustment", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
return {"progressPercent":f"{d['progressPercent']:.1f}%","difficultyChange":f"{d['difficultyChange']:.2f}%","estimatedRetargetDate":d.get("estimatedRetargetDate"),"remainingBlocks":d.get("remainingBlocks")}
|
||||
test("Mempool.space 难度调整预测", t110)
|
||||
|
||||
# 111. Blockchain.info 矿工收入
|
||||
def t111():
|
||||
r = requests.get("https://blockchain.info/q/bcperblock", timeout=TIMEOUT)
|
||||
r.raise_for_status()
|
||||
btc_per_block = int(r.text) / 1e8
|
||||
return {"btc_per_block":btc_per_block,"note":"当前区块奖励(含手续费)"}
|
||||
test("Blockchain.info 区块奖励", t111)
|
||||
|
||||
# ─── NFT 数据 ──────────────────────────────────────────────────────────────
|
||||
|
||||
# 112. CoinGecko NFT 市场数据
|
||||
def t112():
|
||||
r = requests.get("https://api.coingecko.com/api/v3/nfts/list", params={"per_page":"5","page":"1","order":"market_cap_usd_desc"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
return {"nft_count":len(d),"sample":[{"id":x["id"],"name":x["name"],"platform":x.get("asset_platform_id")} for x in d[:3]]}
|
||||
test("CoinGecko NFT市场排名", t112)
|
||||
|
||||
# 113. DeFiLlama NFT 市场
|
||||
def t113():
|
||||
r = requests.get("https://api.llama.fi/overview/nfts", params={"excludeTotalDataChart":"true","excludeTotalDataChartBreakdown":"true"}, timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
return {"total_volume_24h":f"${d.get('total24h',0)/1e6:.1f}M","protocols_count":len(d.get("protocols",[]))}
|
||||
test("DeFiLlama NFT市场交易量", t113)
|
||||
|
||||
# ─── 其他补充 ───────────────────────────────────────────────────────────────
|
||||
|
||||
# 114. CoinPaprika 全球统计
|
||||
def t114():
|
||||
r = requests.get("https://api.coinpaprika.com/v1/global", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
return {"market_cap_usd":f"${d['market_cap_usd']/1e12:.2f}T","volume_24h_usd":f"${d['volume_24h_usd']/1e9:.0f}B","bitcoin_dominance_percentage":f"{d['bitcoin_dominance_percentage']:.1f}%","cryptocurrencies_number":d["cryptocurrencies_number"]}
|
||||
test("CoinPaprika 全球市场统计", t114)
|
||||
|
||||
# 115. CoinPaprika ETH 行情
|
||||
def t115():
|
||||
r = requests.get("https://api.coinpaprika.com/v1/tickers/eth-ethereum", timeout=TIMEOUT)
|
||||
r.raise_for_status(); d=r.json()
|
||||
q = d["quotes"]["USD"]
|
||||
return {"name":d["name"],"rank":d["rank"],"price":f"${q['price']:.2f}","market_cap":f"${q['market_cap']/1e9:.0f}B","volume_24h":f"${q['volume_24h']/1e9:.1f}B"}
|
||||
test("CoinPaprika ETH行情", t115)
|
||||
|
||||
# ─── 保存 ──────────────────────────────────────────────────────────────────
|
||||
print(f"\n=== 批次4汇总 ===")
|
||||
p = sum(1 for v in results.values() if v["status"]=="✅")
|
||||
f = sum(1 for v in results.values() if v["status"]=="❌")
|
||||
print(f"通过: {p}/{len(results)}, 失败: {f}/{len(results)}")
|
||||
with open("/home/ubuntu/quantKnowledge/20_Go迭代系统/scripts/verify_batch4_results.json","w") as fp:
|
||||
json.dump(results, fp, ensure_ascii=False, indent=2, default=str)
|
||||
在新工单中引用
屏蔽一个用户