Overall Statistics |
Total Trades 83 Average Win 1.63% Average Loss -0.34% Compounding Annual Return 36.525% Drawdown 31.700% Expectancy 1.615 Net Profit 23.028% Sharpe Ratio 0.706 Loss Rate 55% Win Rate 45% Profit-Loss Ratio 4.78 Alpha 0.542 Beta 0.569 Annual Standard Deviation 0.865 Annual Variance 0.748 Information Ratio 0.567 Tracking Error 0.863 Treynor Ratio 1.073 Total Fees $0.00 |
namespace QuantConnect { public class LongShortUniverseAlgorithm : QCAlgorithm { private int _lastMonth = -1; private Symbol _longUniverse = QuantConnect.Symbol.Create("LONG", SecurityType.Equity, Market.USA); private Symbol _shortUniverse = QuantConnect.Symbol.Create("SHORT", SecurityType.Equity, Market.USA); public override void Initialize() { SetStartDate(2016, 1, 1); //Set Start Date SetEndDate(2016, 8, 30); //Set End Date SetCash(100000); //Set Strategy Cash // Find more symbols here: http://quantconnect.com/data AddUniverse(new FuncUniverse(GetConfig(_longUniverse), UniverseSettings, SecurityInitializer, selectionData => ( from c in selectionData.OfType<CoarseFundamental>() where c.Price < 10 orderby c.DollarVolume descending select c.Symbol).Take(3) )); AddUniverse(new FuncUniverse(GetConfig(_shortUniverse), UniverseSettings, SecurityInitializer, selectionData => ( from c in selectionData.OfType<CoarseFundamental>() where c.Price > 10 orderby c.DollarVolume descending select c.Symbol).Take(3) )); } public override void OnData(Slice data) { if(_lastMonth == Time.Month) return; _lastMonth = Time.Month; var universeLongMembers = UniverseManager[_longUniverse].Members; var universeShortMembers = UniverseManager[_shortUniverse].Members; foreach (var longMember in universeLongMembers.Values) { SetHoldings(longMember.Symbol, 0.1m); } foreach (var shortMember in universeShortMembers.Values) { SetHoldings(shortMember.Symbol, -0.1m); } } public override void OnSecuritiesChanged(SecurityChanges changes) { foreach (var added in changes.AddedSecurities) { added.FeeModel = new ConstantFeeModel(0m); } foreach (var removed in changes.RemovedSecurities) { Liquidate(removed.Symbol); } } private SubscriptionDataConfig GetConfig(Symbol symbol) { return new SubscriptionDataConfig(typeof(CoarseFundamental), symbol, Resolution.Daily, TimeZones.NewYork, TimeZones.NewYork, false, false, true); } } }