Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate part of a Frame #529

Open
Hulkstance opened this issue Mar 9, 2021 · 1 comment
Open

Truncate part of a Frame #529

Hulkstance opened this issue Mar 9, 2021 · 1 comment

Comments

@Hulkstance
Copy link

Hulkstance commented Mar 9, 2021

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;
	}
}
@nhirschey
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants