Spaces:
Sleeping
Sleeping
import time | |
from api.kucoin import KuCoinClient | |
def get_market_data(symbol: str, timeframe: str, session) -> "MarketData": | |
granularity_map = {"15m": 15, "1h": 60, "4h": 240, "1d": 1440} | |
granularity = granularity_map.get(timeframe, 15) | |
now = int(time.time() * 1000) | |
start = now - (2 * 24 * 60 * 60 * 1000) | |
return KuCoinClient(session).get_kline_data(symbol, granularity, start, now) | |
def get_current_price(symbol: str, session) -> float: | |
return KuCoinClient(session).get_current_price(symbol) | |