Overall Statistics
Total Orders
2758
Average Win
2.18%
Average Loss
0.00%
Compounding Annual Return
90.807%
Drawdown
18.000%
Expectancy
759.687
Net Profit
11.205%
Sharpe Ratio
1.805
Sortino Ratio
2.045
Probabilistic Sharpe Ratio
58.255%
Loss Rate
20%
Win Rate
80%
Profit-Loss Ratio
949.86
Alpha
0.266
Beta
0.618
Annual Standard Deviation
0.358
Annual Variance
0.128
Information Ratio
0.086
Tracking Error
0.354
Treynor Ratio
1.047
Total Fees
$752.09
Estimated Strategy Capacity
$330000.00
Lowest Capacity Asset
ACOR TG2OFNO1HAHX
Portfolio Turnover
10.23%
#region imports
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Globalization;
    using System.Drawing;
    using QuantConnect;
    using System.Text.RegularExpressions;
    using QuantConnect.Algorithm.Framework;
    using QuantConnect.Algorithm.Framework.Selection;
    using QuantConnect.Algorithm.Framework.Alphas;
    using QuantConnect.Algorithm.Framework.Portfolio;
    using QuantConnect.Algorithm.Framework.Execution;
    using QuantConnect.Algorithm.Framework.Risk;
    using QuantConnect.Algorithm.Selection;
    using QuantConnect.Parameters;
    using QuantConnect.Benchmarks;
    using QuantConnect.Brokerages;
    using QuantConnect.Util;
    using QuantConnect.Interfaces;
    using QuantConnect.Algorithm;
    using QuantConnect.Indicators;
    using QuantConnect.Data;
    using QuantConnect.Data.Consolidators;
    using QuantConnect.Data.Custom;
    using QuantConnect.DataSource;
    using QuantConnect.Data.Fundamental;
    using QuantConnect.Data.Market;
    using QuantConnect.Data.UniverseSelection;
    using QuantConnect.Notifications;
    using QuantConnect.Orders;
    using QuantConnect.Orders.Fees;
    using QuantConnect.Orders.Fills;
    using QuantConnect.Orders.Slippage;
    using QuantConnect.Scheduling;
    using QuantConnect.Securities;
    using QuantConnect.Securities.Equity;
    using QuantConnect.Securities.Future;
    using QuantConnect.Securities.Option;
    using QuantConnect.Securities.Forex;
    using QuantConnect.Securities.Crypto;   
    using QuantConnect.Securities.Interfaces;
    using QuantConnect.Storage;
    using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm;
    using QCAlgorithmFrameworkBridge = QuantConnect.Algorithm.QCAlgorithm;
#endregion

namespace QuantConnect
{
    public class QuiverWikipediaDataAlgorithm : QCAlgorithm
    {
        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2019, 3, 1);
            SetCash(100000);

            UniverseSettings.Resolution = Resolution.Daily;
            
            AddUniverse<QuiverWikipediaUniverse>("QuiverWikipediaUniverse", Resolution.Daily, altCoarse =>
            {
                return from d in altCoarse
                       where d.PageViews > 100m && d.MonthPercentChange!=null && d.MonthPercentChange < 0.2m
                       select d.Symbol;
            });
        }
        
        public override void OnData(Slice slice)
        {
            var points = slice.Get<QuiverWikipedia>();
            foreach (var point in points.Values)
            {
                var symbol = point.Symbol.Underlying;

                // Buy if the company's Wikipedia page views have increased over the last month
                if (point.MonthPercentChange > 0)
                {
                    SetHoldings(symbol, 1);
                } 
                // Sell our holdings if the company's Wikipedia page views have not increased over the last month
                else
                {
                    SetHoldings(symbol, 0);
                }
            }
        }

        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            foreach(var added in changes.AddedSecurities)
            {
                // Requesting data
                var quiverWikiSymbol = AddData<QuiverWikipedia>(added.Symbol).Symbol;

                // Historical data
                var history = History<QuiverWikipedia>(quiverWikiSymbol, 60, Resolution.Daily);
                Debug($"We got {history.Count()} items from our history request for Quiver Wikipedia data");
            }
        }
    }
}