"""
Main Dexorder API - provides access to market data and charting.
"""

import logging

from .charting_api import ChartingAPI
from .data_api import DataAPI

log = logging.getLogger(__name__)


class API:
    """
    Main API for accessing market data and creating charts.

    This is the primary interface for research scripts and trading strategies.
    Access this via get_api() in research scripts.

    Attributes:
        data: DataAPI for fetching historical and current market data
        charting: ChartingAPI for creating candlestick charts and visualizations

    Example:
        from dexorder.api import get_api
        import asyncio

        api = get_api()

        # Fetch data
        df = asyncio.run(api.data.historical_ohlc(
            ticker="BTC/USDT.BINANCE",
            period_seconds=3600,
            start_time="2021-12-20",
            end_time="2021-12-21"
        ))

        # Create chart
        fig, ax = api.charting.plot_ohlc(df, title="BTC/USDT 1H")
    """

    def __init__(self, charting: ChartingAPI, data: DataAPI):
        self.charting: ChartingAPI = charting
        self.data: DataAPI = data
