Overall Statistics
Total Trades
18
Average Win
0.10%
Average Loss
-0.10%
Compounding Annual Return
-18.747%
Drawdown
0.400%
Expectancy
-0.352
Net Profit
-0.322%
Sharpe Ratio
-6.962
Probabilistic Sharpe Ratio
0%
Loss Rate
67%
Win Rate
33%
Profit-Loss Ratio
0.94
Alpha
-0.017
Beta
0.348
Annual Standard Deviation
0.034
Annual Variance
0.001
Information Ratio
7.861
Tracking Error
0.05
Treynor Ratio
-0.681
Total Fees
$554.31
class Algorithm (QCAlgorithm):
    def Initialize(self):
        self.SetCash(1000000)
        self.SetStartDate(2014, 1, 1)
        self.SetEndDate(2014, 1, 6)
        self.SetBrokerageModel(BrokerageName.AlphaStreams)
        self.AddEquity("SPY", Resolution.Hour)
        
        self.shown = False
    
    def OnData(self, Data):
        # Ensure market is open before submitting any orders
        if not self.Securities['SPY'].Exchange.ExchangeOpen:
            return
        
        if self.Securities['SPY'].Invested:
            target = 0
        else:
            target = 1
        
        quantity = self.CalculateOrderQuantity("SPY", target)
        ticket = self.MarketOrder("SPY", quantity)
        self.Log(f"Fill: {ticket.AverageFillPrice}")