How to use the catalyst.utils.memoize.lazyval function in catalyst

To help you get started, we’ve selected a few catalyst examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enigmampc / catalyst / catalyst / pipeline / term.py View on Github external
    @lazyval
    def dependencies(self):
        """
        The number of extra rows needed for each of our inputs to compute this
        term.
        """
        extra_input_rows = max(0, self.window_length - 1)
        out = {}
        for term in self.inputs:
            out[term] = extra_input_rows
        out[self.mask] = 0
        return out
github enigmampc / catalyst / catalyst / data / us_equity_pricing.py View on Github external
    @lazyval
    def sessions(self):
        if 'calendar' in self._table.attrs.attrs:
            # backwards compatibility with old formats, will remove
            return DatetimeIndex(self._table.attrs['calendar'], tz='UTC')
        else:
            cal = get_calendar(self._table.attrs['calendar_name'])
            start_session_ns = self._table.attrs['start_session_ns']
            start_session = Timestamp(start_session_ns, tz='UTC')

            end_session_ns = self._table.attrs['end_session_ns']
            end_session = Timestamp(end_session_ns, tz='UTC')

            sessions = cal.sessions_in_range(start_session, end_session)

            return sessions
github enigmampc / catalyst / catalyst / assets / assets.py View on Github external
    @lazyval
    def fuzzy_symbol_ownership_map(self):
        fuzzy_mappings = {}
        for (cs, scs), owners in iteritems(self.symbol_ownership_map):
            fuzzy_owners = fuzzy_mappings.setdefault(
                cs + scs,
                [],
            )
            fuzzy_owners.extend(owners)
            fuzzy_owners.sort()
        return fuzzy_mappings
github enigmampc / catalyst / catalyst / data / bundles / quandl.py View on Github external
    @lazyval
    def tar_url(self):
        return 'https://s3.amazonaws.com/quantopian-public-zipline-data/quandl'
github enigmampc / catalyst / catalyst / data / resample.py View on Github external
    @lazyval
    def last_available_dt(self):
        return self.trading_calendar.minute_to_session_label(
            self._minute_bar_reader.last_available_dt
        )
github enigmampc / catalyst / catalyst / errors.py View on Github external
    @lazyval
    def plural(self):
        return len(self.sids) > 1
github enigmampc / catalyst / catalyst / data / us_equity_pricing.py View on Github external
    @lazyval
    def _calendar_offsets(self):
        return {
            int(id_): offset
            for id_, offset in iteritems(
                self._table.attrs['calendar_offset'],
            )
github enigmampc / catalyst / catalyst / assets / assets.py View on Github external
    @lazyval
    def equity_supplementary_map_by_sid(self):
        return build_ownership_map(
            table=self.equity_supplementary_mappings,
            key_from_row=lambda row: (row.field, row.sid),
            value_from_row=lambda row: row.value,
        )