Overall Statistics
Total Orders
4
Average Win
2.00%
Average Loss
-0.01%
Compounding Annual Return
56.579%
Drawdown
1.700%
Expectancy
122.887
Start Equity
100000
End Equity
103988.07
Net Profit
3.988%
Sharpe Ratio
4.355
Sortino Ratio
6.565
Probabilistic Sharpe Ratio
89.112%
Loss Rate
33%
Win Rate
67%
Profit-Loss Ratio
184.83
Alpha
0.055
Beta
0.554
Annual Standard Deviation
0.086
Annual Variance
0.007
Information Ratio
-2.493
Tracking Error
0.082
Treynor Ratio
0.68
Total Fees
$9.13
Estimated Strategy Capacity
$240000000.00
Lowest Capacity Asset
AAPL R735QTJ8XC9X
Portfolio Turnover
6.31%
from AlgorithmImports import *
from QuantConnect.DataSource import *

class QuiverCNBCsAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2021, 10, 1)   #Set Start Date
        self.set_end_date(2021, 10, 31)    #Set End Date
        self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
        self.dataset_symbol = self.add_data(QuiverCNBCs, self.aapl).symbol

        # history request
        history = self.history(self.dataset_symbol, 10, Resolution.DAILY)
        self.debug(f"We got {len(history)} items from historical data request of {self.dataset_symbol}.")

    def on_data(self, slice: Slice) -> None:
        for cnbcs in slice.Get(QuiverCNBCs).values():
            if np.mean([cnbc.direction for cnbc in cnbcs]) > 0:
                self.set_holdings(self.aapl, 1)
            else:
                self.set_holdings(self.aapl, 0)