Better coin velocity logic
This commit is contained in:
@@ -66,6 +66,19 @@ class KrakenClient:
|
||||
|
||||
# ── Public market data ────────────────────────────────────────────────────
|
||||
|
||||
def get_ohlc(self, pair: str, interval: int = 60, lookback_hours: int = 50) -> list:
|
||||
"""
|
||||
Fetch OHLC candles for a single pair.
|
||||
interval is in minutes (60 = hourly).
|
||||
Each candle: [time, open, high, low, close, vwap, volume, count]
|
||||
"""
|
||||
since = int(time.time()) - lookback_hours * 3600
|
||||
data = self._public("OHLC", params={"pair": pair, "interval": interval, "since": since})
|
||||
for key, val in data.items():
|
||||
if key != "last" and isinstance(val, list):
|
||||
return val
|
||||
return []
|
||||
|
||||
def get_asset_pairs(self) -> dict[str, dict]:
|
||||
"""Return all asset pair metadata keyed by Kraken's internal pair name."""
|
||||
return self._public("AssetPairs")
|
||||
|
||||
Reference in New Issue
Block a user