How to use the prophet.utils.trading_days function in prophet

To help you get started, we’ve selected a few prophet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Emsu / prophet / prophet / app.py View on Github external
cash (int): Amount of starting cash
            portfolio (prophet.portfolio.Portfolio): Starting portfolio

        Return:
            prophet.backtest.BackTest
        """
        # Setup
        if not end:
            today = dt.date.today()
            end = dt.datetime.combine(today, dt.time())

        if not self._order_generator:
            raise ProphetException("Must set an order generator by calling"
                                   "set_order_generator.")

        timestamps = trading_days[(trading_days >= start) &
                                  (trading_days <= end)]
        effective_start = timestamps[0]

        data = self._generate_data(start=effective_start,
                                   end=end,
                                   lookback=lookback)

        # Run backtest
        return backtest(cash=cash,
                        data=data,
                        start=effective_start,
                        end=end,
                        slippage=slippage,
                        commission=commission,
                        portfolio=initial_portfolio,
                        order_generator=self._order_generator,
github Emsu / prophet / prophet / data.py View on Github external
def get_data_start(self, start, lookback):
        start_index = trading_days.get_loc(start)
        return trading_days[start_index - lookback]