Overall Statistics |
Total Trades 4 Average Win 0.68% Average Loss -0.13% Compounding Annual Return 0.266% Drawdown 0% Expectancy 2.138 Net Profit 0.552% Sharpe Ratio 0.694 Loss Rate 50% Win Rate 50% Profit-Loss Ratio 5.28 Alpha 0.005 Beta -0.11 Annual Standard Deviation 0.004 Annual Variance 0 Information Ratio -4.416 Tracking Error 0.004 Treynor Ratio -0.024 Total Fees $20.59 |
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("AAPL", 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); } } } }