Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
-89.043%
Drawdown
9.600%
Expectancy
0
Net Profit
-2.394%
Sharpe Ratio
-1.059
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-11.27
Beta
147.26
Annual Standard Deviation
0.889
Annual Variance
0.791
Information Ratio
-1.146
Tracking Error
0.883
Treynor Ratio
-0.006
Total Fees
$8.31
Estimated Strategy Capacity
$57000000.00
Lowest Capacity Asset
AMC VMGNNM1SRKH1
class EMAMomentumUniverse(QCAlgorithm):
    
    def Initialize(self):
        self.SetBrokerageModel(BrokerageName.AlphaStreams)
        self.positionSize = 0.9
        self.SetStartDate(2021, 6, 28)
        self.SetCash(100000)
        self.UniverseSettings.Resolution = Resolution.Daily
        self.bull = self.AddEquity("QQQ", Resolution.Second)
        self.amc = self.AddEquity("AMC", Resolution.Second)
        self.amc.SetDataNormalizationMode(DataNormalizationMode.Raw)
        self.isAlreadyExecute = False
        self.SetWarmup(100)
        # quantity = self.CalculateOrderQuantity(self.amc.Symbol, -self.positionSize)
        # self.MarketOrder(self.amc.Symbol, quantity, False, "New pos size {}".format(-self.positionSize))
        
        self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.Every(timedelta(minutes=1)),
            self.CheckForEntries)
            
    def CheckForEntries(self):
        if not self.isAlreadyExecute:
            quantity = self.CalculateOrderQuantity(self.amc.Symbol, -self.positionSize)
            self.MarketOrder(self.amc.Symbol, quantity, False, "New pos size {}".format(-self.positionSize))
            self.isAlreadyExecute = True
    
class LiquidUniverseSelection(QCAlgorithm):
    
    symbol = "AAME"
    isLast = False
    x = 2
    lastPredictClose = 0
    lastClose = 0
    
    stopMarketTicket = None
    highestPrice = -1
    
    def Initialize(self):
        self.SetStartDate(2021, 2, 5)
        self.SetEndDate(2021, 2, 5)
        # self.SetEndDate(2021, 3, 5)
        self.SetCash(1600)  
        
        aame = self.AddEquity(self.symbol, Resolution.Second)
        aame.SetDataNormalizationMode(DataNormalizationMode.Raw)
        
    def OnData(self, slice):
        
        if self.Time.hour > 11:
            return
          
        close = slice.Bars[self.symbol].Close
        
        quoteBar = slice.QuoteBars[self.symbol]
        avgBid =  quoteBar.Bid.Low + (quoteBar.Bid.High - quoteBar.Bid.Low) / 2
        avgAsk =  quoteBar.Ask.Low + (quoteBar.Ask.High - quoteBar.Ask.Low) / 2
        bidAskQuoteSkewClose = (avgBid * quoteBar.LastBidSize + avgAsk * quoteBar.LastAskSize)/(quoteBar.LastBidSize + quoteBar.LastAskSize) 
       
        # Buy if predictedPrice > close
        difference = ((bidAskQuoteSkewClose - close)/close) * 100
        
        
        if not self.Portfolio[self.symbol].Invested:
            if difference > self.x:
                self.SetHoldings(self.symbol, 1)
            
        elif self.Portfolio[self.symbol].Invested:
            if self.Portfolio[self.symbol].Price > self.highestPrice:
                self.highestPrice = self.Portfolio[self.symbol].Price
                
                if self.stopMarketTicket is None:
                    self.stopMarketTicket = self.StopMarketOrder(self.symbol, -self.Portfolio[self.symbol].Quantity, 0.9 * self.Portfolio[self.symbol].Price)
                else:
                    # self.Log(self.stopMarketTicket.Get(OrderField.StopPrice))
                    self.Log(self.highestPrice)
                    updateFields = UpdateOrderFields()
                    updateFields.StopPrice = 0.9 * self.Portfolio[self.symbol].Price
                    self.stopMarketTicket.Update(updateFields)