Overall Statistics |
Total Trades 2 Average Win 0% Average Loss -0.14% Compounding Annual Return -0.069% Drawdown 0.500% Expectancy -1 Net Profit -0.142% Sharpe Ratio -0.163 Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.001 Beta 0.028 Annual Standard Deviation 0.004 Annual Variance 0 Information Ratio -4.906 Tracking Error 0.004 Treynor Ratio -0.024 Total Fees $19.46 |
using System.Collections.Concurrent; namespace QuantConnect.Algorithm.CSharp { public class Demo : QCAlgorithm { private DateTime _startDate = new DateTime(2014, 02, 04); private DateTime _endDate = new DateTime(2016, 03, 02); public override void Initialize() { UniverseSettings.Leverage = 1.0m; UniverseSettings.Resolution = Resolution.Daily; SetStartDate(_startDate); SetEndDate(_endDate); SetCash(100*1000); AddUniverse( coarse => { if (Time == _startDate) { return new List<Symbol> { QuantConnect.Symbol.Create("T", SecurityType.Equity, Market.USA), QuantConnect.Symbol.Create("VZ", SecurityType.Equity, Market.USA) }; } return new List<Symbol>(); }, fine => { return fine.Select(f => f.Symbol); } ); } public override void OnSecuritiesChanged(SecurityChanges changes) { foreach (var security in changes.RemovedSecurities) { Debug("Liquidating " + security.Symbol); Liquidate(security.Symbol); } foreach (var security in changes.AddedSecurities) { Debug("Buying " + security.Symbol); SetHoldings(security.Symbol, 0.5); } } } }