forward_fill#

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

Module description#

OHLCV data forward fill.

Forward fill missing OHLCV candles in market data feeds.

  • Trading Strategy market data feeds are sparse by default, to save bandwidth

  • DEXes small cap pairs see fewtrades and if there are no trades in a time frame, no candle is generated

  • Forward-filled data is used on the client side

  • We need to forward fill to make price look up, especially for stop losses faster, as forward-filled data can do a simple index look up to get a price, instead of backwinding to the last available price

Functions#

fill_future_gap(df, timestamp, columns[, ...])

Add a virtual OHLCV value at the end of the pair OHLCV data series if there is no real value.

fill_future_gap_multi_pair(grouped_df, ...)

forward_fill(single_or_multipair_data, freq)

Forward-fill OHLCV data for multiple trading pairs.

generate_future_filler_data(last_valid_row, ...)

Create a new placeholder OHLCV entry based on the last valid entry.