46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import sys; sys.path.insert(0, 'C:/Users/lookt/a_stock_timeline')
|
|
from src.fetcher import lhb_fetcher
|
|
import requests
|
|
|
|
# Test LHB for last Friday
|
|
for date in ['2026-09-12', '2026-09-11']:
|
|
print(f"\n=== LHB {date} ===")
|
|
df = lhb_fetcher.fetch_lhb_date(date)
|
|
print(f" rows: {len(df)}")
|
|
if not df.empty:
|
|
print(df[['trade_date','ts_code','name','reason']].head(3).to_string(index=False))
|
|
|
|
# If empty, check raw API response
|
|
print("\n=== Raw API check ===")
|
|
url = 'https://datacenter-web.eastmoney.com/api/data/v1/get'
|
|
params = {
|
|
'reportName': 'RPT_LHB_ALL_STOCKS',
|
|
'columns': 'ALL',
|
|
'filter': "(TRADE_DATE='2026-09-12')",
|
|
'pageNumber': 1,
|
|
'pageSize': 3,
|
|
'sortTypes': '-1',
|
|
'sortColumns': 'SINGLE_NET_AMT',
|
|
'source': 'WEB',
|
|
'client': 'WEB',
|
|
}
|
|
headers = {
|
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
'Referer': 'https://data.eastmoney.com/',
|
|
'Accept': 'application/json',
|
|
}
|
|
r = requests.get(url, params=params, headers=headers, timeout=15)
|
|
print('status:', r.status_code)
|
|
resp = r.json()
|
|
print('success:', resp.get('success'))
|
|
print('message:', resp.get('message'))
|
|
result = resp.get('result')
|
|
if result:
|
|
print('pages:', result.get('pages'))
|
|
data = result.get('data') or []
|
|
print('data count:', len(data))
|
|
if data:
|
|
print('first row keys:', list(data[0].keys())[:8])
|
|
else:
|
|
print('result is None or empty')
|