修复两个问题:
1. 移除 eastmoney K线接口的 parsed.reverse(),统一为升序返回(与其他数据源一致), 修复 K线图时间方向相反、每日行情明细展示远期数据的 bug 2. fetch_fund_flow_daykline 改用 curl_cffi 替代 httpx,匹配东方财富 push2his 的 TLS 指纹检测,修复主力资金流向数据获取不到的 bug Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1035,7 +1035,6 @@ async def fetch_kline_history(code: str, days: int = 90) -> Optional[list[dict]]
|
|||||||
"turnoverRate": _f(10),
|
"turnoverRate": _f(10),
|
||||||
})
|
})
|
||||||
|
|
||||||
parsed.reverse()
|
|
||||||
return parsed
|
return parsed
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if attempt == 0:
|
if attempt == 0:
|
||||||
@@ -1064,10 +1063,12 @@ async def fetch_fund_flow_daykline(code: str, days: int) -> Optional[list[dict]]
|
|||||||
"Referer": "https://quote.eastmoney.com/",
|
"Referer": "https://quote.eastmoney.com/",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from curl_cffi.requests import AsyncSession
|
||||||
|
|
||||||
for attempt in range(2):
|
for attempt in range(2):
|
||||||
async with httpx.AsyncClient() as client:
|
async with AsyncSession(impersonate="chrome120") as session:
|
||||||
try:
|
try:
|
||||||
resp = await client.get(url, headers=headers, timeout=10)
|
resp = await session.get(url, headers=headers, timeout=10)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
if attempt == 0:
|
if attempt == 0:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user