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
$0
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.AddEquity("SPY", Resolution.Tick)

        self.dict = {}
        self.buy_orders = []
        
        self.Schedule.On(self.DateRules.EveryDay(), 
		self.TimeRules.Every(timedelta(hours=1)),
		self.buying)
        
       
        sec_Consolidator = TickConsolidator(timedelta(seconds=45))
        sec_Consolidator.DataConsolidated += self.Sec_BarHandler
        self.SubscriptionManager.AddConsolidator("SPY", sec_Consolidator)

    def OnData(self, data):
        if not data.ContainsKey("SPY"): return
        pass
        
            

        

    def buying(self):
        if self.Securities["SPY"].Exchange.ExchangeOpen:
            self.MarketOrder("SPY", 1)
            self.buy_orders.append(self.Time)
            serialized_buy_order = pickle.dumps(self.buy_orders)
            self.ObjectStore.SaveBytes('12833385/buy_o', serialized_buy_order)
            self.Debug(self.buy_orders[:-1])

          
    def Sec_BarHandler(self, sender, consolidated):
        time = self.UtcTime
        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) 
        serialized_ohlc = pickle.dumps(self.dict)
        self.ObjectStore.SaveBytes('12833385/ohlc', serialized_ohlc)