Esempio n. 1
0
 def __init__(self,
              wrapper: ArrayWrapper,
              records_arr: tp.RecordArray,
              ts: tp.Optional[tp.ArrayLike] = None,
              **kwargs) -> None:
     Records.__init__(self, wrapper, records_arr, ts=ts, **kwargs)
     self._ts = ts
Esempio n. 2
0
 def __init__(self,
              wrapper: ArrayWrapper,
              records_arr: tp.RecordArray,
              close: tp.Optional[tp.ArrayLike] = None,
              **kwargs) -> None:
     Records.__init__(self, wrapper, records_arr, close=close, **kwargs)
     self._close = close
Esempio n. 3
0
    def __init__(self,
                 wrapper,
                 records_arr,
                 close,
                 idx_field='exit_idx',
                 trade_type=TradeType.Trade,
                 **kwargs):
        Records.__init__(self,
                         wrapper,
                         records_arr,
                         idx_field=idx_field,
                         close=close,
                         trade_type=trade_type,
                         **kwargs)
        self._close = broadcast_to(close, wrapper.dummy(group_by=False))
        self._trade_type = trade_type

        if trade_type == TradeType.Trade:
            if not all(field in records_arr.dtype.names
                       for field in trade_dt.names):
                raise TypeError("Records array must match trade_dt")
        else:
            if not all(field in records_arr.dtype.names
                       for field in position_dt.names):
                raise TypeError("Records array must match position_dt")
Esempio n. 4
0
    def __init__(self, wrapper, records_arr, idx_field='idx', **kwargs):
        Records.__init__(self,
                         wrapper,
                         records_arr,
                         idx_field=idx_field,
                         **kwargs)

        if not all(field in records_arr.dtype.names for field in log_dt.names):
            raise TypeError("Records array must match debug_info_dt")
Esempio n. 5
0
    def __init__(self, wrapper, records_arr, close, idx_field='idx', **kwargs):
        Records.__init__(self,
                         wrapper,
                         records_arr,
                         idx_field=idx_field,
                         close=close,
                         **kwargs)
        self._close = broadcast_to(close, wrapper.dummy(group_by=False))

        if not all(field in records_arr.dtype.names
                   for field in order_dt.names):
            raise TypeError("Records array must match order_dt")
Esempio n. 6
0
    def __init__(self, records_arr, ts, freq=None, idx_field='end_idx'):
        Records.__init__(self,
                         records_arr,
                         ArrayWrapper.from_obj(ts, freq=freq),
                         idx_field=idx_field)
        PandasIndexer.__init__(self, _indexing_func)

        if not all(field in records_arr.dtype.names
                   for field in drawdown_dt.names):
            raise ValueError(
                "Records array must have all fields defined in drawdown_dt")

        self.ts = ts
Esempio n. 7
0
    def __init__(self, wrapper, records_arr, ts, idx_field='end_idx', **kwargs):
        Records.__init__(
            self,
            wrapper,
            records_arr,
            idx_field=idx_field,
            ts=ts,
            **kwargs
        )
        self._ts = ts

        if not all(field in records_arr.dtype.names for field in drawdown_dt.names):
            raise TypeError("Records array must match drawdown_dt")
Esempio n. 8
0
    def __init__(self, records_arr, main_price, freq=None, idx_field='idx'):
        Records.__init__(self,
                         records_arr,
                         ArrayWrapper.from_obj(main_price, freq=freq),
                         idx_field=idx_field)
        PandasIndexer.__init__(self, _indexing_func)

        if not all(field in records_arr.dtype.names
                   for field in order_dt.names):
            raise ValueError(
                "Records array must have all fields defined in order_dt")

        self.main_price = main_price
Esempio n. 9
0
    def __init__(self, wrapper, records_arr, ts, idx_field='end_idx'):
        Records.__init__(self, wrapper, records_arr, idx_field=idx_field)
        Configured.__init__(self,
                            wrapper=wrapper,
                            records_arr=records_arr,
                            ts=ts,
                            idx_field=idx_field)
        self._ts = ts

        if not all(field in records_arr.dtype.names
                   for field in drawdown_dt.names):
            raise ValueError(
                "Records array must have all fields defined in drawdown_dt")

        PandasIndexer.__init__(self, _indexing_func)
Esempio n. 10
0
    def __init__(self, wrapper, records_arr, close, idx_field='exit_idx'):
        Records.__init__(self, wrapper, records_arr, idx_field=idx_field)
        Configured.__init__(self,
                            wrapper=wrapper,
                            records_arr=records_arr,
                            close=close,
                            idx_field=idx_field)
        self.close = close

        if not all(field in records_arr.dtype.names
                   for field in event_dt.names):
            raise ValueError(
                "Records array must have all fields defined in event_dt")

        PandasIndexer.__init__(self, _indexing_func)
Esempio n. 11
0
    def __init__(self,
                 wrapper: ArrayWrapper,
                 records_arr: tp.RecordArray,
                 ts: tp.ArrayLike,
                 idx_field: str = 'end_idx',
                 **kwargs) -> None:
        Records.__init__(self,
                         wrapper,
                         records_arr,
                         idx_field=idx_field,
                         ts=ts,
                         **kwargs)
        self._ts = broadcast_to(ts, wrapper.dummy(group_by=False))

        if not all(field in records_arr.dtype.names
                   for field in drawdown_dt.names):
            raise TypeError("Records array must match drawdown_dt")