def _step_setup( self, step: int, org: Optional[population.Organism], ) -> tuple[int, population.Organism]: self._setup() d_min, d_max = population.min_max_date() if org is None: self._tickers = load_tickers() self._end = d_max or listing.all_history_date(self._tickers)[-1] org = self._next_org() dates = listing.all_history_date(self._tickers, start=self._end) if (d_min != self._end) or (len(dates) == 1): return step + 1, org self._scale = 1 self._tickers = load_tickers() self._end = dates[1] return 1, org
def _step_setup( self, step: int, ) -> int: self._setup() d_min, d_max = population.min_max_date() if self._tickers is None: self._tickers = load_tickers() self._end = d_max or listing.all_history_date(self._tickers)[-1] dates = listing.all_history_date(self._tickers, start=self._end) if (d_min != self._end) or (len(dates) == 1): return step + 1 self._end = dates[1] return 1
def test_load_tickers(monkeypatch): monkeypatch.setattr(portfolio.config, "PORT_PATH", Path(__file__).parent) tickers = portfolio.load_tickers() assert isinstance(tickers, tuple) assert tickers == ("AKRN", "GMKN", "VSMO")
ticker).set_index("date").loc["2015-01-01":] new.columns = local.columns except: if local.empty: return print("div", ticker) return try: testing.assert_frame_equal(local, new, check_names=False, check_dtype=False) except: print("div", ticker) if __name__ == "__main__": with warnings.catch_warnings(): warnings.simplefilter("ignore") securities() cpi() usd() indexes() for ticker in portfolio.load_tickers(): quotes(ticker) dividends(ticker)