Overall Statistics
Total Trades
6
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$6.00
Estimated Strategy Capacity
$1300000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# region imports
from AlgorithmImports import *
import pickle
# endregion

class QuantumVerticalProcessor(QCAlgorithm):

    chart = None
    series = None
    

    def Initialize(self):
        self.SetStartDate(2019, 11, 8) # Set Start Date
        self.SetEndDate(2019, 11, 8)
        self.SetCash(100000) # Set Strategy Cash
        self.symbol = self.AddEquity("SPY", Resolution.Second).Symbol

        self.dict = {}
        self.buy_orders = []
        
        self.Schedule.On(self.DateRules.EveryDay(self.symbol), 
		self.TimeRules.Every(timedelta(hours=1)),
		self.buy)
        
        self.Consolidate(self.symbol, timedelta(seconds=45), self.Sec_BarHandler)


    def buy(self):
        if self.Securities["SPY"].Exchange.ExchangeOpen:
            self.MarketOrder("SPY", 1)
            self.buy_orders.append(self.Time)

          
    def Sec_BarHandler(self, consolidated):
        self.dict.setdefault(consolidated.EndTime, []).append(consolidated.Open)
        self.dict.setdefault(consolidated.EndTime, []).append(consolidated.High)
        self.dict.setdefault(consolidated.EndTime, []).append(consolidated.Low)
        self.dict.setdefault(consolidated.EndTime, []).append(consolidated.Close) 
        
    def OnEndOfAlgorithm(self):
        self.ObjectStore.SaveBytes('12845898/buy_o', pickle.dumps(self.buy_orders))
        self.ObjectStore.SaveBytes('12845898/ohlc', pickle.dumps(self.dict))