Repository: quantopian/zipline
File: zipline/data/minute_bars.py (Python)

Code before:

    @abstractmethod
    def get_value(self, sid, dt, field):
        """
        Retrieve the value at the given coordinates.

        Parameters
        ----------
        sid : int
            The asset identifier.
        dt : datetime64-like
            The minute label for the desired data point.
        field : string
            The OHLVC name for the desired data point.

        Returns
        -------
        value : float|int
            The value at the given coordinates, `float` for OHLC, `int` for
            'volume'.
        """

    @abstractmethod
    def get_last_traded_dt(self, asset, dt):
        """
        Retrieve the most recently traded minute for the given asset,
        when viewing the data from the input minute. The last traded minute is
        the provided minute if a trade occured on that minute.

        Parameters
        ----------
        asset : zipline.asset.Asset
            The asset for which to get the last traded minute.
        dt : datetime64-like
            The minute at which to start searching for the last traded minute.

        Returns
        -------
        last_traded : pd.Timestamp
            The minute of the last trade for the given asset, using the input
            dt as a vantage point.
        """

    @abstractmethod
    def load_raw_arrays(self, fields, start_dt, end_dt, sids):
        """
        Retrieve the arrays of pricing data for the given coordinates of
        `fields` (OHLCV), minute range (`start_dt` -> `end_dt`) and sids.

        Parameters
        ----------

Review comment (refactor):
I believe the original distinction was that `get_value` was returning the pricing values, i.e. the trade bar floats/ints, and this function was a helper to find the right dt to seek into when doing forward filling; with the distinction that this returns the location of data as opposed to the value.

I am not opposed to merging `last_traded` into `get_value`, but there is a slight semantic difference. Also, some care may need to be taken when changing the code since this method is used internally by the data portal when returning values for `price`.


Code after:
        pass

    @abstractmethod
    def get_value(self, sid, dt, field):
        """
        Retrieve the value at the given coordinates.

        Parameters
        ----------
        sid : int
            The asset identifier.
        dt : pd.Timestamp
            The minute label for the desired data point.
        field : string
            The OHLVC name for the desired data point.

        Returns
        -------
        value : float|int
            The value at the given coordinates, ``float`` for OHLC, ``int``
            for 'volume'.
        """
        pass

    @abstractmethod
    def get_last_traded_dt(self, asset, dt):
        """
        Get the latest minute on or before ``dt`` in which ``asset`` traded.

        If there are no trades on or before ``dt`` returns ``pd.NaT``

        Parameters
        ----------
        asset : zipline.asset.Asset
            The asset for which to get the last traded minute.
        dt : pd.Timestamp
            The minute at which to start searching for the last traded minute.

        Returns
        -------
        last_traded : pd.Timestamp
            The minute of the last trade for the given asset, using the input
            dt as a vantage point.
        """
        pass

    @abstractmethod
    def load_raw_arrays(self, fields, start_dt, end_dt, sids):
        """
        Retrieve the arrays of pricing data for the given coordinates of
        ``fields`` (OHLCV), minute range [``start_dt``, ``end_dt``] and sids.