示例#1
0
    def returns_pre_processor(self) -> returnsPreProcessor:

        instrument_list = self.get_instrument_list(for_instrument_weights=True)
        pandl_across_subsystems_raw = self.pandl_across_subsystems(
            instrument_list=instrument_list
        )
        pandl_across_subsystems_as_returns_object = returnsForOptimisationWithCosts(
            pandl_across_subsystems_raw
        )
        pandl_across_subsystems = dictOfReturnsForOptimisationWithCosts(
            pandl_across_subsystems_as_returns_object
        )

        turnovers = self.turnover_across_subsystems()
        config = self.config

        weighting_params = copy(config.instrument_weight_estimate)

        returns_pre_processor = returnsPreProcessor(
            pandl_across_subsystems,
            turnovers=turnovers,
            log=self.log,
            **weighting_params
        )

        return returns_pre_processor
示例#2
0
    def returns_pre_processing(self, codes_to_use: list, trading_rule_list: list) -> returnsPreProcessor:
        pandl_forecasts = self.get_pandl_forecasts(codes_to_use)
        turnovers = self.get_turnover_for_list_of_rules(codes_to_use, trading_rule_list)
        config = self.config

        weighting_params = copy(config.forecast_weight_estimate)
        cost_params = copy(config.forecast_cost_estimates)
        weighting_params = {**weighting_params, **cost_params}

        returns_pre_processor = returnsPreProcessor(pandl_forecasts,
                                                    turnovers = turnovers,
                                                    log=self.log,
                                                    **weighting_params)

        return returns_pre_processor