filter_bad_wicks#

API documentation for tradingstrategy.utils.groupeduniverse.filter_bad_wicks Python function.

filter_bad_wicks(df, threshold=(0.1, 1.9))[source]#

Mark the bad wicks.

On Uniswap v2 and compatibles, Bad wicks are caused by e.g. very large flash loan, oracle price manipulation attacks, and misbheaving bots.

This function removes bad high/low values and sets them to open/close if they seem to be wildly out of sample.

Parameters:
  • threshold

    How many pct % wicks are allowed through as (low, high) tuple.

    This is a tuple (low threshold, high threshold).

    If low < close * threshold[0] ignore the value.

    If high > close * threshold[0] ignore the value.

  • df (DataFrame) –

Return type:

DataFrame