Files
trade-assistant/backend/app/api/v1/exchange.py
T
TradeMate Dev 7b62c2f8b4 feat: 修复 H5 底部导航覆盖 + 更新项目进度文档
## H5 底部导航修复 (Bug #10)
- 精简 App.vue,移除重复 tabbar,仅保留全局样式
- uni-page 设置 height: calc(100% - 50px) + overflow-y: auto
- 内容区域精确停在底部导航上方,独立滚动不再叠加
- 恢复 custom-tab-bar 组件

## 项目进度文档
- PROGRESS.md 更新至 10 个 Bug 修复
- 新增 H5 底部导航修复记录
- 新增历史变更条目
2026-05-12 20:24:42 +08:00

37 lines
974 B
Python

from fastapi import APIRouter
from app.services.exchange import ExchangeRateService
from datetime import datetime
router = APIRouter()
service = ExchangeRateService()
@router.get("/convert")
async def convert_currency(
from_currency: str = "USD",
to_currency: str = "CNY",
amount: float = 1.0,
):
rate = await service.get_rate(from_currency, to_currency)
if rate is None:
return {"error": f"No rate available for {from_currency} -> {to_currency}"}
return {
"from_currency": from_currency.upper(),
"to_currency": to_currency.upper(),
"amount": amount,
"converted": round(amount * rate, 2),
"rate": rate,
"updated_at": datetime.utcnow().isoformat(),
}
@router.get("/rates")
async def get_rates(base: str = "USD"):
rates = await service.get_all_rates(base)
return {
"base": base.upper(),
"rates": rates,
"updated_at": datetime.utcnow().isoformat(),
}