Hi everyone!

Thanks for the great platform to backtest and trade with!

I'm working on a new strategy that uses a different universe of stocks everyday pulled from a dropbox file.

My algo needs to calculate the 90 day rolling moving standard deviation for the close to open returns. Therefore I have to set the start date of the algo earlier than my inended start date because I can't use warm ups with universes. That's fine and working.

However, I can't figure out how to access the close prices from the multi-index dataframe I get back. I'm sure it's something silly but I'm stuck. 

 

Here's a snippet from a function called by the `AfterMarketOpen` time rule:

self.Debug('security.Symbol: {}'.format(security.Symbol))

# Get a multi index dataframe
history_midf = self.History(security.Symbol, 90, Resolution.Daily)
self.Debug('{}'.format(history_midf))

# Select the security close and get a single index dataframe
close_df = history_midf.loc[security.Symbol]['close']
self.Debug('{}'.format(close_df))

I get this error though:

Runtime Error: In Scheduled Event 'SPY: EveryDay: SPY: 1 min after MarketOpen', TypeError : object is not callable TypeError : object is not callable (Open Stacktrace)

Here's the complete log:

1639 | 15:20:53:
Launching analysis for ef718efee8a2329c161567f513e46cfb with LEAN Engine v2.4.0.0.4601
1640 | 15:20:53:
2017-07-07 00:00:00 Universe Changes: SecurityChanges: Added: SPY R735QTJ8XC9X
1641 | 15:20:53:
Backtest deployed in 16.057 seconds
1642 | 15:20:54:
2018-01-04 00:00:00 Universe Changes: SecurityChanges: Added: CMC R735QTJ8XC9X,NEOG R735QTJ8XC9X,UNF R735QTJ8XC9X
1643 | 15:20:55:
Runtime Error: In Scheduled Event 'SPY: EveryDay: SPY: 1 min after MarketOpen', TypeError : object is not callable TypeError : object is not callable (Open Stacktrace)
1644 | 15:21:05:
Algorithm Id:(ef718efee8a2329c161567f513e46cfb) completed in 12.19 seconds at 4k data points per second. Processing total of 48,668 data points.
1645 | 15:21:05:
security.Symbol: CMC R735QTJ8XC9X
1647 | 15:21:05:
open ... volume
symbol time ...
CMC R735QTJ8XC9X 2017-08-26 17.341478 ... 507806.0
...

(The security isn't actually SPY, but I did add SPY via AddEquity in order to get access to the AfterMarketOpen and BeforeMarketClose calls.)

The security I'm looking at in this example is CMC but security.Symbol is this weird thing: 

CMC R735QTJ8XC9X

The error is definitely generated by this line:

close_df = history_midf.loc[security.Symbol]['close']

Any ideas?