예제 #1
0
    def run_backtest(self):
        strategy_name = self.strategy_name
        data = self.data

        capital_data = dataCapital(data)
        notional_trading_capital = capital_data.get_capital_for_strategy(strategy_name)
        if notional_trading_capital is missing_data:
            # critical log will send email
            error_msg = (
                "Capital data is missing for %s: can't run backtest" %
                strategy_name)
            data.log.critical(error_msg)
            raise Exception(error_msg)

        currency_data = dataCurrency(data)
        base_currency = currency_data.get_base_currency()

        system = self.system_method(
            notional_trading_capital=notional_trading_capital, base_currency=base_currency
        )

        updated_buffered_positions(data, strategy_name, system)

        store_backtest_state(data, system, strategy_name=strategy_name)

        return success
예제 #2
0
    def run_backtest(self):
        strategy_name = self.strategy_name
        data = self.data

        base_currency, notional_trading_capital = self._get_currency_and_capital(
        )

        system = self.system_method(
            notional_trading_capital=notional_trading_capital,
            base_currency=base_currency)

        updated_buffered_positions(data, strategy_name, system)

        store_backtest_state(data, system, strategy_name=strategy_name)