Hello all,

I am trying to compare volume at one point in the day to volume over the last few days.  I am having trouble calculating volume at a single point in time (in my case, 17 minutes from the close).

I can see the data, but I don't know how to access it and work with it.  The code below:

from clr import AddReference AddReference("System") AddReference("QuantConnect.Common") AddReference("QuantConnect.Algorithm") from System import * from QuantConnect import * from QuantConnect.Algorithm import * class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2018,5,25) #Set Start Date self.SetEndDate(2018,5,29) #Set End Date self.SetCash(20000) #Set Strategy Cash self.AddEquity("SPY", Resolution.Second) # schedule an event to fire every trading day, 17 minutes before market close # Use SPY to represent the active market here in the US self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", 17), self.TradeBeforeMarketClose) def TradeBeforeMarketClose(self): minHistory = self.History(["SPY"], 400, Resolution.Minute).sort_index(level='time', ascending=True) for k,v in minHistory.items(): self.Debug(k) self.Debug(v)

results in the following output:

Launching analysis for 45e868156b94757135cc0d4c81e4b26b with LEAN Engine v2.4.0.0.3824 27 | 12:50:53: close 28 | 12:50:53: symbol time SPY 2018-05-24 15:34:00 272.970 2018-05-24 15:35:00 273.010 2018-05-24 15:36:00 272.930 2018-05-24 15:37:00 272.880 2018-05... 29 | 12:50:53: high 30 | 12:50:53: symbol time SPY 2018-05-24 15:34:00 273.085 2018-05-24 15:35:00 273.020 2018-05-24 15:36:00 273.060 2018-05-24 15:37:00 272.970 2018-05... 31 | 12:50:53: low 32 | 12:50:53: symbol time SPY 2018-05-24 15:34:00 272.940 2018-05-24 15:35:00 272.970 2018-05-24 15:36:00 272.920 2018-05-24 15:37:00 272.870 2018-05... 33 | 12:50:53: open 34 | 12:50:53: symbol time SPY 2018-05-24 15:34:00 273.050 2018-05-24 15:35:00 272.970 2018-05-24 15:36:00 273.005 2018-05-24 15:37:00 272.940 2018-05... 35 | 12:50:53: volume 36 | 12:50:53: symbol time SPY 2018-05-24 15:34:00 93906.0 2018-05-24 15:35:00 56311.0 2018-05-24 15:36:00 77790.0 2018-05-24 15:37:00 120558.0 ... 37 | 12:50:53: close 38 | 12:50:53: symbol time SPY 2018-05-25 15:34:00 272.150 2018-05-25 15:35:00 272.210 2018-05-25 15:36:00 272.180 2018-05-25 15:37:00 272.220 2018-05... 39 | 12:50:53: high 40 | 12:50:53: symbol time SPY 2018-05-25 15:34:00 272.240 2018-05-25 15:35:00 272.210 2018-05-25 15:36:00 272.200 2018-05-25 15:37:00 272.250 2018-05... 41 | 12:50:53: low 42 | 12:50:53: symbol time SPY 2018-05-25 15:34:00 272.130 2018-05-25 15:35:00 272.130 2018-05-25 15:36:00 272.130 2018-05-25 15:37:00 272.150 2018-05... 43 | 12:50:53: open 44 | 12:50:53: symbol time SPY 2018-05-25 15:34:00 272.220 2018-05-25 15:35:00 272.150 2018-05-25 15:36:00 272.200 2018-05-25 15:37:00 272.180 2018-05... 45 | 12:50:53: volume 46 | 12:50:53: symbol time SPY 2018-05-25 15:34:00 104094.0 2018-05-25 15:35:00 44736.0 2018-05-25 15:36:00 47857.0 2018-05-25 15:37:00 58802.0 ... 47 | 12:50:54: Algorithm Id:(45e868156b94757135cc0d4c81e4b26b) completed in 1.05 seconds at 45k data points per second. Processing total of 47,601 data points. 48 | 12:50:54: Backtest deployed in 15.716 seconds 49 | 12:50:55: Your log was successfully created and can be retrieved from: https://www.quantconnect.com/backtest/54505/1435476/45e868156b94757135cc0d4c81e4b26b-log.txt

How do I add up all of the volume so far today?  Thanks!