Overall Statistics
Total Trades
570450
Average Win
0.02%
Average Loss
-0.01%
Compounding Annual Return
-87.105%
Drawdown
46.700%
Expectancy
-0.013
Net Profit
-36.297%
Sharpe Ratio
1.954
Loss Rate
82%
Win Rate
18%
Profit-Loss Ratio
4.39
Alpha
0.018
Beta
0.001
Annual Standard Deviation
0.009
Annual Variance
0
Information Ratio
-0.47
Tracking Error
0.173
Treynor Ratio
16.402
Total Fees
$0.00
namespace QuantConnect 
{   
    public class LongShortUniverseAlgorithm : QCAlgorithm
    {
        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)
        {
            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 universeLongMembers.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);
        }
    }
}