OpenClaw Agent
|
34f06ce941
|
perf: 优化历史价格获取,优先从缓存表查询
1. 先从 market_kline_cache 缓存表查特定日期价格
2. 缓存命中直接返回,减少 API 调用
3. 缓存未命中才调用 GetHistoricalDataAsync
4. 获取历史数据从 365 天减少到 30 天
5. 大幅减少 Tiingo API 消耗
|
2026-03-15 10:12:20 +00:00 |
|
OpenClaw Agent
|
da86aa43e6
|
fix: 行情获取失败时不写入错误数据,添加 429 限流重试机制
1. GetHistoricalPriceAsync 返回 decimal? 而非 decimal
- 价格获取失败时返回 null 而非 0
2. BackfillNavHistoryInternalAsync 检查价格有效性
- 任何持仓价格获取失败时跳过该日期
- 不写入 totalValue=0 的错误数据
3. MarketDataService 添加 GetWithRetryAsync 方法
- 处理 429 Too Many Requests 限流
- 最多重试 3 次,指数退避
|
2026-03-15 10:02:52 +00:00 |
|
OpenClaw Agent
|
1977dd609d
|
fix: 请求收益曲线时自动回填历史数据
- GetNavHistoryAsync现在会自动检查是否有历史数据
- 无历史数据时自动调用BackfillNavHistoryInternalAsync
- 拆分内部回填方法,避免重复验证权限
|
2026-03-13 16:21:31 +00:00 |
|
OpenClaw Agent
|
05ca501f40
|
feat: 新增组合净值历史功能
后端实现:
- 新增PortfolioNavHistory实体,记录每日净值、成本、收益率
- 实现IPortfolioNavService接口,支持净值计算和历史回填
- 支持基于交易记录完整计算历史净值(买入卖出都会更新)
- 计算统计指标:最大回撤、夏普比率、波动率
新增API:
- GET /api/v1/portfolio/{id}/nav-history - 获取净值曲线
- POST /api/v1/portfolio/{id}/nav-history/backfill - 回填历史净值
- POST /api/v1/portfolio/{id}/nav-history/calculate - 计算当日净值
数据库:
- 新增portfolio_nav_history表迁移脚本
- 支持组合级别的净值历史记录
|
2026-03-13 16:08:59 +00:00 |
|