from abc import ABC, abstractmethod

from roboquant.account import Account
from roboquant.event import Event
from roboquant.order import Order
from roboquant.signal import Signal


class Journal(ABC):
    """
    A journal enables the tracking and/or logging of the progress during a run.

    A journal can hold detailed records of all your trading activities during a run.
    It serves as a tool to track the performance, decisions, and outcomes over the timeline
    of a run.
    """

    @abstractmethod
    def track(self, event: Event, account: Account, signals: list[Signal], orders: list[Order]):
        """This method is invoked at each step of a run and provides the journal with the opportunity to
        track and log various metrics.

        Args:
            event : The current market event containing price and other relevant data for all assets.
                This provides the journal with the latest market information at the current step.

            account : The trading account as it was at the beginning of this step, which contains information
                about the current state of the portfolio, including cash balance and positions. This allows the journal
                to track changes in the account over time.

            signals : A list of trading signals generated by the strategy at the current step. These signals
                represent the strategy's decisions, such as buy or sell recommendations for specific assets.
                The journal can use this information to log or analyze the strategy's decision-making process.

            orders : A list of orders that were placed by the strategy at the current step. These orders represent
                the actual trading actions taken, such as executing a buy or sell. The journal can track these
                orders to monitor the execution and impact of the strategy's decisions.
        """
        ...
