Overall Statistics
Total Orders
3
Average Win
2.00%
Average Loss
0%
Compounding Annual Return
56.766%
Drawdown
3.600%
Expectancy
0
Net Profit
3.999%
Sharpe Ratio
4.374
Sortino Ratio
6.631
Probabilistic Sharpe Ratio
89.297%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.057
Beta
0.554
Annual Standard Deviation
0.086
Annual Variance
0.007
Information Ratio
-2.48
Tracking Error
0.081
Treynor Ratio
0.682
Total Fees
$8.11
Estimated Strategy Capacity
$47000000.00
Lowest Capacity Asset
AAPL R735QTJ8XC9X
Portfolio Turnover
6.27%
#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 QuiverCNBCsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2021, 10, 1);  //Set Start Date
            SetEndDate(2021, 10, 31);    //Set End Date
            _symbol = AddEquity("AAPL").Symbol;
            _datasetSymbol = AddData<QuiverCNBCs>(_symbol).Symbol;

            // history request
            var history = History<QuiverCNBCs>(new[] {_datasetSymbol}, 10, Resolution.Daily);
            Debug($"We got {history.Count()} items from historical data request of {_datasetSymbol}.");
        }

        public override void OnData(Slice slice)
        {
            foreach (var kvp in slice.Get<QuiverCNBCs>())
            {
                if (kvp.Value.Average(x => (int) (x as QuiverCNBC).Direction) > 0)
                {
                    SetHoldings(_symbol, 1);
                }
                else
                {
                    SetHoldings(_symbol, 0);
                }
            }
        }
    }
}