feat: rate kline unit x10000 (bps), default interval 1h

This commit is contained in:
root 2026-02-27 07:56:07 +00:00
parent 8961fbb16f
commit 32e9dd3531
2 changed files with 5 additions and 5 deletions

View File

@ -203,10 +203,10 @@ async def get_kline(symbol: str = "BTC", interval: str = "5m", limit: int = 500)
b["price_close"] = price
data = sorted(bars.values(), key=lambda x: x["time"])[-limit:]
# 转换为百分比(费率
# 转换为万分之(费率 × 10000
for b in data:
for k in ("open", "high", "low", "close"):
b[k] = round(b[k] * 100, 6)
b[k] = round(b[k] * 10000, 4)
return {"symbol": symbol, "interval": interval, "count": len(data), "data": data}

View File

@ -70,7 +70,7 @@ export default function KlinePage() {
const rateRef = useRef<HTMLDivElement>(null);
const priceRef = useRef<HTMLDivElement>(null);
const [symbol, setSymbol] = useState<"BTC" | "ETH">("BTC");
const [interval, setInterval] = useState("5m");
const [interval, setInterval] = useState("1h");
const [count, setCount] = useState(0);
const [loading, setLoading] = useState(true);
const rateChartRef = useRef<ReturnType<typeof createChart> | null>(null);
@ -187,8 +187,8 @@ export default function KlinePage() {
{/* 费率K线 */}
<div className="rounded-xl border border-slate-200 bg-white shadow-sm p-4">
<div className="flex items-center justify-between mb-2">
<h2 className="text-slate-700 font-semibold text-sm">{symbol} K 线%</h2>
<span className="text-xs text-slate-400">绿 · </span>
<h2 className="text-slate-700 font-semibold text-sm">{symbol} K 线</h2>
<span className="text-xs text-slate-400">×10000 · 绿 · </span>
</div>
<div ref={rateRef} className="w-full" style={{ height: 260 }} />
</div>