Esempio n. 1
0
    def get_list_of_instrument_strategies(self) -> listOfInstrumentStrategies:
        all_positions_dict = self._get_list_of_args_dict()
        list_of_instrument_strategies = []
        for dict_entry in all_positions_dict:
            instrument_strategy = instrumentStrategy.from_dict(dict_entry)
            list_of_instrument_strategies.append(instrument_strategy)

        list_of_instrument_strategies = listOfInstrumentStrategies(
            list_of_instrument_strategies)

        return list_of_instrument_strategies
    def get_list_of_instrument_strategies_with_optimal_position(
        self, ) -> listOfInstrumentStrategies:

        list_of_args_dict = self._get_list_of_args_dict()
        list_of_instrument_strategies = []
        for arg_entry in list_of_args_dict:
            list_of_instrument_strategies.append(
                instrumentStrategy.from_dict(arg_entry))
        list_of_instrument_strategies = listOfInstrumentStrategies(
            list_of_instrument_strategies)

        return list_of_instrument_strategies
    def get_all_instrument_strategies_with_limits(
            self) -> listOfInstrumentStrategies:

        dict_of_keys = {MARKER_KEY: MARKER_STRATEGY_INSTRUMENT}
        list_of_dicts = self.mongo_data.get_list_of_result_dicts_for_dict_keys(
            dict_of_keys)

        list_of_instrument_strategies = [
            instrumentStrategy(strategy_name=db_entry[STRATEGY_KEY],
                               instrument_code=db_entry[INSTRUMENT_KEY])
            for db_entry in list_of_dicts
        ]

        list_of_instrument_strategies = listOfInstrumentStrategies(
            list_of_instrument_strategies)

        return list_of_instrument_strategies
Esempio n. 4
0
    def get_list_of_strategies_and_instruments_with_positions(
            self,
            ignore_zero_positions: bool = True) -> listOfInstrumentStrategies:

        list_of_instrument_strategies = self.get_list_of_instrument_strategies(
        )

        if ignore_zero_positions:
            list_of_instrument_strategies = [
                instrument_strategy
                for instrument_strategy in list_of_instrument_strategies
                if self.get_current_position_for_instrument_strategy_object(
                    instrument_strategy) != 0
            ]

            list_of_instrument_strategies = listOfInstrumentStrategies(
                list_of_instrument_strategies)

        return list_of_instrument_strategies