Hi Jf,
There is no built-in way to convert dataframes to slice objects. Slice objects are essentially containers for TradeBar, QuoteBar, OptionChain, etc data. So, instead of converting our dataframe into a slice object, we can convert it into the datatype we need.
For example, we can create a TradeBar using data from the history dataframe.
history = algorithm.History(symbol, period, Resolution.Daily)
for bar in history.itertuples():
tradebar = TradeBar(bar.Index[1], symbol, bar.open, bar.high, bar.low, bar.close, bar.volume)
Learn more about the data types in Lean in theĀ documentation.
Best
Rahul