wrangle#
API documentation for tradingstrategy.utils.wrangle Python module in Trading Strategy.
Module description#
Wrangle DEX market data to be better suitable for algorithmic trading.
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#
  | 
Check the price dataframe for data issues.  | 
  | 
Find bad open/close prices where the open price is very different from the value of previous and next day.  | 
  | 
Mark the bad wicks.  | 
  | 
Correct out bad high/low values in OHLC data.  | 
  | 
Wrangle DEX price data for all known issues.  | 
  | 
Fix MEV bots breaking open/price.  | 
  | 
Fix bad open/close/high/low prices where the open price is very different from the value of previous and next day.  | 
  | 
Clean volume data columns.  | 
  | 
Remove candles where open value is outside the floating point range detector.  | 
Remove any candle that has a zero value for OHLC  |