| 123456789101112131415161718192021 |
- """Provider aggregation."""
- from .binance import fetch_ohlcv as binance_fetch_ohlcv, fetch_price as binance_fetch_price
- from .coingecko import fetch_ohlcv as cg_fetch_ohlcv, fetch_price as cg_fetch_price, fetch_top_movers
- async def fetch_price(symbol: str) -> dict:
- try:
- return await binance_fetch_price(symbol)
- except Exception:
- return await cg_fetch_price(symbol)
- async def fetch_ohlcv(symbol: str, timeframe: str, limit: int = 100) -> dict:
- try:
- return await binance_fetch_ohlcv(symbol, timeframe, limit)
- except Exception:
- return await cg_fetch_ohlcv(symbol, timeframe, limit)
- __all__ = ["fetch_price", "fetch_ohlcv", "fetch_top_movers"]
|