def get_history_spec(self, bar_count, frequency, field, ffill): spec_key = HistorySpec.spec_key(bar_count, frequency, field, ffill) if spec_key not in self.history_specs: data_freq = self.sim_params.data_frequency spec = HistorySpec( bar_count, frequency, field, ffill, data_frequency=data_freq, ) self.history_specs[spec_key] = spec if not self.history_container: self.history_container = self.history_container_class( self.history_specs, self.current_universe(), self.datetime, self.sim_params.data_frequency, bar_data=self._most_recent_data, ) self.history_container.ensure_spec( spec, self.datetime, self._most_recent_data, ) return self.history_specs[spec_key]
def get_history_spec(self, bar_count, frequency, field, ffill): spec_key = HistorySpec.spec_key(bar_count, frequency, field, ffill) if spec_key not in self.history_specs: data_freq = self.sim_params.data_frequency spec = HistorySpec( bar_count, frequency, field, ffill, data_frequency=data_freq, env=self.trading_environment, ) self.history_specs[spec_key] = spec if not self.history_container: self.history_container = self.history_container_class( self.history_specs, self.current_universe(), self.datetime, self.sim_params.data_frequency, bar_data=self._most_recent_data, env=self.trading_environment, ) self.history_container.ensure_spec( spec, self.datetime, self._most_recent_data, ) return self.history_specs[spec_key]
def history(self, bar_count, frequency, field, ffill=True): spec_key_str = HistorySpec.spec_key( bar_count, frequency, field, ffill) history_spec = self.history_specs[spec_key_str] return self.history_container.get_history(history_spec, self.datetime)