Overall Statistics
Total Trades
401
Average Win
0.01%
Average Loss
0.00%
Compounding Annual Return
-2.674%
Drawdown
0.300%
Expectancy
-0.234
Net Profit
-0.243%
Sharpe Ratio
-2.023
Probabilistic Sharpe Ratio
12.883%
Loss Rate
80%
Win Rate
20%
Profit-Loss Ratio
2.88
Alpha
-0.032
Beta
0.016
Annual Standard Deviation
0.009
Annual Variance
0
Information Ratio
-5.98
Tracking Error
0.147
Treynor Ratio
-1.212
Total Fees
$400.00
Estimated Strategy Capacity
$7600000.00
Lowest Capacity Asset
AHPA WG21CRUFJW4L
from AlgorithmImports import *

class QuiverWallStreetBetsDataAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2019, 2, 1)
        self.SetCash(100000)

        self.UniverseSettings.Resolution = Resolution.Daily
        self.AddUniverse(QuiverWallStreetBetsUniverse, "QuiverWallStreetBetsUniverse", Resolution.Daily, self.UniverseSelection)

    def OnData(self, data):
        points = data.Get(QuiverWallStreetBets)
        for point in points.Values:
            symbol = point.Symbol.Underlying
            
            # Buy if the stock was mentioned more than 5 times in the WallStreetBets daily discussion
            if point.Mentions > 5 and not self.Portfolio[symbol].IsLong:
                self.MarketOrder(symbol, 1)
                
            # Otherwise, short sell
            elif point.Mentions <= 5 and not self.Portfolio[symbol].IsShort:
                self.MarketOrder(symbol, -1)

    def OnSecuritiesChanged(self, changes):
        for added in changes.AddedSecurities:
            # Requesting data
            quiverWSBSymbol = self.AddData(QuiverWallStreetBets, added.Symbol).Symbol

            # Historical data
            history = self.History(QuiverWallStreetBets, quiverWSBSymbol, 60, Resolution.Daily)
            self.Debug(f"We got {len(history)} items from our history request")

    def UniverseSelection(self, alt_coarse):
        for datum in alt_coarse:
            self.Log(f"{datum.Symbol},{datum.Mentions},{datum.Rank},{datum.Sentiment}")
        
        # define our selection criteria
        return [d.Symbol for d in alt_coarse \
                    if d.Mentions > 10 \
                    and d.Rank < 100]