using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp.Benchmarks
{
/// <summary>
/// Benchmark Algorithm: Pure processing of 1 equity second resolution with the same benchmark.
/// </summary>
/// <remarks>
/// This should eliminate the synchronization part of LEAN and focus on measuring the performance of a single datafeed and event handling system.
/// </remarks>
public class EmptySingleSecuritySecondEquityBenchmark : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2008, 01, 01);
SetEndDate(2009, 01, 01);
SetBenchmark(dt => 1m);
AddEquity("SPY", Resolution.Second);
}
public override void OnData(Slice data)
{
}
}
}
Rahul Chowdhury
Hi Manoj,
public void SetBenchmark(Func<DateTime, decimal> benchmark)
This defines the benchmark for the algorithm with a function which returns a benchmark value given a date. This lets you create a custom benchmark.
SetBenchmark(dt => 1m);
Creates a constant bench mark because the benchmark value is 1 for all dates.
A traditional benchmark like SPY, returns a benchmark value equal to the value of SPY for a given date.
Best
Rahul
Manoj Kandlikar
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!