feat: add real-time price fetching and fix data delays

- Add get_ticker() method for real-time quotes across all markets

- Add get_realtime_price() service with ticker/kline fallback chain

- Fix yfinance end date issue for US stocks and futures

- Fix forex timezone parsing for Tiingo UTC timestamps

- Add retry mechanism with exponential backoff for Tiingo API

- Add API rate limiting for portfolio (3 concurrent, 0.3s interval)

- Add force refresh option to bypass price cache on manual refresh
This commit is contained in:
TIANHE
2026-01-13 00:21:33 +08:00
parent ac932aebf0
commit 714dd47c86
10 changed files with 643 additions and 78 deletions
@@ -156,11 +156,14 @@ class FuturesDataSource(BaseDataSource):
tf_seconds = self._get_timeframe_seconds(timeframe)
start_time = end_time - timedelta(seconds=tf_seconds * limit * 1.5)
# yfinance 的 end 参数是不包含的(exclusive),需要加一天
end_time_inclusive = end_time + timedelta(days=1)
# 获取数据
ticker = yf.Ticker(yf_symbol)
df = ticker.history(
start=start_time,
end=end_time,
end=end_time_inclusive,
interval=yf_interval
)