Back

What is the use of SetBenchMark(dt => 1m); in this example ?

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)
        {
        }
    }
}

Update Backtest







0

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.


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

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed