load_candle_universe_from_dataframe#
API documentation for tradeexecutor.strategy.pandas_trader.alternative_market_data.load_candle_universe_from_dataframe Python function.
- load_candle_universe_from_dataframe(df, column_map={'close': 'close', 'high': 'high', 'low': 'low', 'open': 'open', 'volume': 'volume'}, resample=None, include_as_trigger_signal=True, identifier_column='pair_id')[source]#
Load a single pair price feed from a DataFrame.
Same as
load_candle_universe_from_parquet()
but from a DataFrame.Overrides the current price candle feed with an alternative version, usually from a centralised exchange. This allows strategy testing to see there is no price feed data issues or specificity with it.
- Parameters:
pair –
The trading pair data this Parquet file contains.
E.g. ticker symbols and trading fee are read from this argument.
df (DataFrame) – DataFrame to load from
resample (tradingstrategy.timebucket.TimeBucket | None) – Resample OHLCV data to a higher timeframe
include_as_trigger_signal –
Create take profit/stop loss signal from the data.
For this, any upsampling is not used.
identifier_column (str) –
- Raises:
NoMatchingBucket – Could not match candle time frame to any of our timeframes.
- Returns:
(Price feed universe, stop loss trigger candls universe) tuple.
Stop loss data is only generated if include_as_trigger_signal is True. Stop loss data is never resampled and is in the most accurate available resolution.
- Return type:
Tuple[GroupedCandleUniverse, tradingstrategy.candle.GroupedCandleUniverse | None]