增加k线图
This commit is contained in:
@@ -212,5 +212,24 @@ class BinanceFuturesClient:
|
||||
sym_set = set(symbols)
|
||||
return {t["symbol"]: float(t["price"]) for t in tickers if t["symbol"] in sym_set}
|
||||
|
||||
async def get_daily_klines(self, symbol: str, limit: int = 300) -> list[dict]:
|
||||
raw = await self._get(
|
||||
"/fapi/v1/klines",
|
||||
{"symbol": symbol.upper(), "interval": "1d", "limit": min(limit, 1500)},
|
||||
)
|
||||
candles = []
|
||||
for k in raw or []:
|
||||
candles.append(
|
||||
{
|
||||
"time": int(k[0]),
|
||||
"open": float(k[1]),
|
||||
"high": float(k[2]),
|
||||
"low": float(k[3]),
|
||||
"close": float(k[4]),
|
||||
"volume": float(k[5]),
|
||||
}
|
||||
)
|
||||
return candles
|
||||
|
||||
|
||||
binance_client = BinanceFuturesClient()
|
||||
|
||||
Reference in New Issue
Block a user