Deedle
Deedle copied to clipboard
Truncate part of a Frame
Since I'm doing calculations based on indicators, the first, let's say 50 records are not so accurate due to the fact that there wasn't enough data. I want to truncate those 50 records/results. How can I do that? The truncate should be executed in the beginning of the Frame
.
public class RsiStrategy : StrategyBase
{
public override Frame<int, string> PopulateIndicators(Frame<int, string> dataFrame)
{
var candles = dataFrame.Rows.Select(kvp => new Candle
{
Timestamp = kvp.Value.GetAs<DateTime>("Timestamp"),
Open = kvp.Value.GetAs<decimal>("Open"),
High = kvp.Value.GetAs<decimal>("High"),
Low = kvp.Value.GetAs<decimal>("Low"),
Close = kvp.Value.GetAs<decimal>("Close"),
Volume = kvp.Value.GetAs<decimal>("Volume")
}).Observations.Select(e => e.Value).ToList<IOhlcv>();
// TODO: Truncate the first 50 elements of the Frame
dataFrame.AddColumn("Rsi", candles.Rsi(2));
return dataFrame;
}
}
See Frame.skip
https://fslab.org/Deedle/reference/deedle-framemodule.html