MCPcopy Index your code
hub / github.com/kernc/backtesting.py / try_mean_first

Function try_mean_first

backtesting/_plotting.py:147–153  ·  view source on GitHub ↗
(indicator)

Source from the content-addressed store, hash-verified

145 df = df.resample(freq, label='right').agg(OHLCV_AGG).dropna()
146
147 def try_mean_first(indicator):
148 nonlocal freq
149 resampled = indicator.df.fillna(np.nan).resample(freq, label='right')
150 try:
151 return resampled.mean()
152 except Exception:
153 return resampled.first()
154
155 indicators = [_Indicator(try_mean_first(i).dropna().reindex(df.index).values.T,
156 **dict(i._opts, name=i.name,

Callers 1

_maybe_resample_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected