resample_candles_multiple_pairs#

API documentation for tradingstrategy.utils.forward_fill.resample_candles_multiple_pairs Python function.

resample_candles_multiple_pairs(df, frequency, pair_id_column='pair_id', copy_columns=['pair_id'], forward_fill_columns=('open', 'high', 'low', 'close', 'volume'), fix_and_sort_index=True, forward_fill_until=None, multipair=True)[source]#

Upsample a OHLCV trading pair data to a lower time bucket.

  • First group the DataFrame by pair

  • Transform

  • Resample in OHLCV manner

  • Forward fill any gaps in data

  • Set forward_fill_until attribute on DataFrame to refect how much forward fill was done

Parameters:
  • pair_id_column – DataFrame column to group the data by pair

  • copy_columns

    Columns we simply copy over.

    We assume every pair has the same value for these columns.

  • df (DataFrame) –

  • frequency (str) –

  • forward_fill_columns (Collection[str]) –

  • forward_fill_until (datetime.datetime | None) –

  • multipair (bool) –

Parma fix_and_sort_index:

Make sure we have a good timestamp index before proceeding.

Returns:

Concatenated DataFrame of individually resampled pair data

Return type:

DataFrame