Use HL tracer by default, seems to be faster?

big_data_lines
Tyler Goodlet 2022-04-05 11:04:45 -04:00
parent 4bc2bbda69
commit b20e9e58ee
1 changed files with 5 additions and 1 deletions

View File

@ -155,7 +155,7 @@ def downsample(
def ohlc_flatten( def ohlc_flatten(
ohlc: np.ndarray, ohlc: np.ndarray,
use_mxmn: bool = False, use_mxmn: bool = True,
) -> tuple[np.ndarray, np.ndarray]: ) -> tuple[np.ndarray, np.ndarray]:
''' '''
@ -167,7 +167,11 @@ def ohlc_flatten(
index = ohlc['index'] index = ohlc['index']
if use_mxmn: if use_mxmn:
# traces a line optimally over highs to lows
# using numba. NOTE: pretty sure this is faster
# and looks about the same as the below output.
flat, x = hl2mxmn(ohlc) flat, x = hl2mxmn(ohlc)
else: else:
flat = rfn.structured_to_unstructured( flat = rfn.structured_to_unstructured(
ohlc[['open', 'high', 'low', 'close']] ohlc[['open', 'high', 'low', 'close']]