feat: rate kline unit x10000 (bps), default interval 1h
This commit is contained in:
parent
8961fbb16f
commit
32e9dd3531
@ -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}
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user