wrangle#

API documentation for tradingstrategy.utils.wrangle Python module in Trading Strategy.

Module description#

Wrangle incoming data.

  • Wrangle is a process where we massage incoming price/liquidity data for the isseus we may have encountered during the data collection

  • Common DEX data issues are absurd price high/low spikes due to MEV trades

  • We also have some open/close values that are “broken” in a sense that they do not reflect the market price you would be able to trade, again likely due to MEV

  • See fix_dex_price_data() for fixing

Functions#

filter_bad_wicks(df[, threshold])

Mark the bad wicks.

fix_bad_wicks(df[, threshold, ...])

Correct out bad high/low values in OHLC data.

fix_dex_price_data(df[, freq, forward_fill, ...])

Wrangle DEX price data for all known issues.

remove_zero_candles(df)

Remove any candle that has a zero value for OHLC