Better coin velocity logic

This commit is contained in:
2026-05-16 00:08:45 -04:00
parent fe5fb5f3f1
commit 3394392e49
4 changed files with 114 additions and 33 deletions

View File

@@ -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")