Ejemplo n.º 1
0
    def load_slots(self):
        """
        Loads all configuration interface slots.
        :return: None
        """
        self.simulationCopySettingsButton.clicked.connect(
            lambda: copy_settings_to_simulation(self))
        self.simulationSaveConfigurationButton.clicked.connect(
            lambda: save_simulation_settings(self))
        self.simulationLoadConfigurationButton.clicked.connect(
            lambda: load_simulation_settings(self))

        self.backtestCopySettingsButton.clicked.connect(
            lambda: copy_settings_to_backtest(self))
        self.backtestSaveConfigurationButton.clicked.connect(
            lambda: save_backtest_settings(self))
        self.backtestLoadConfigurationButton.clicked.connect(
            lambda: load_backtest_settings(self))
        self.backtestImportDataButton.clicked.connect(
            lambda: import_data(self, BACKTEST))
        self.backtestDownloadDataButton.clicked.connect(
            lambda: download_data(self, BACKTEST))
        self.backtestStopDownloadButton.clicked.connect(
            lambda: stop_download(self, BACKTEST))

        self.optimizerImportDataButton.clicked.connect(
            lambda: import_data(self, OPTIMIZER))
        self.optimizerDownloadDataButton.clicked.connect(
            lambda: download_data(self, OPTIMIZER))
        self.optimizerStopDownloadButton.clicked.connect(
            lambda: stop_download(self, OPTIMIZER))

        self.testCredentialsButton.clicked.connect(
            lambda: test_binance_credentials(self))
        self.saveCredentialsButton.clicked.connect(
            lambda: save_credentials(self))
        self.loadCredentialsButton.clicked.connect(
            lambda: load_credentials(config_obj=self, auto=False))

        self.testTelegramButton.clicked.connect(lambda: test_telegram(self))
        self.telegramApiKey.textChanged.connect(
            lambda: reset_telegram_state(self))
        self.telegramChatID.textChanged.connect(
            lambda: reset_telegram_state(self))

        self.saveConfigurationButton.clicked.connect(
            lambda: save_live_settings(self))
        self.loadConfigurationButton.clicked.connect(
            lambda: load_live_settings(self))
        self.graphPlotSpeedSpinBox.valueChanged.connect(
            self.update_graph_speed)
        self.enableHoverLine.stateChanged.connect(
            self.enable_disable_hover_line)

        self.load_loss_slots()  # These slots are based on the ordering.
        self.load_take_profit_slots()
        self.load_strategy_slots()
Ejemplo n.º 2
0
def load_slots(config_obj):
    """
    Loads all configuration interface slots.
    :param config_obj: Configuration QDialog object (from configuration.py)
    :return: None
    """
    c = config_obj

    c.saveConfigurationButton.clicked.connect(lambda: save_config_helper(
        config_obj=c, caller=LIVE, result_label=c.configurationResult, func=save_live_settings))
    c.loadConfigurationButton.clicked.connect(lambda: load_config_helper(
        config_obj=c, caller=LIVE, result_label=c.configurationResult, func=load_live_settings))

    c.simulationCopySettingsButton.clicked.connect(lambda: copy_config_helper(
        config_obj=c, caller=SIMULATION, result_label=c.simulationCopyLabel, func=copy_settings_to_simulation))
    c.simulationSaveConfigurationButton.clicked.connect(lambda: save_config_helper(
        config_obj=c, caller=SIMULATION, result_label=c.simulationConfigurationResult, func=save_simulation_settings))
    c.simulationLoadConfigurationButton.clicked.connect(lambda: load_config_helper(
        config_obj=c, caller=SIMULATION, result_label=c.simulationConfigurationResult, func=load_simulation_settings))

    c.backtestImportDataButton.clicked.connect(lambda: import_data(c, BACKTEST))
    c.backtestDownloadDataButton.clicked.connect(lambda: download_data(c, BACKTEST))
    c.backtestStopDownloadButton.clicked.connect(lambda: stop_download(c, BACKTEST))
    c.backtestCopySettingsButton.clicked.connect(lambda: copy_config_helper(
        config_obj=c, caller=BACKTEST, result_label=c.backtestCopyLabel, func=copy_settings_to_backtest))
    c.backtestSaveConfigurationButton.clicked.connect(lambda: save_config_helper(
        config_obj=c, caller=BACKTEST, result_label=c.backtestConfigurationResult, func=save_backtest_settings))
    c.backtestLoadConfigurationButton.clicked.connect(lambda: load_config_helper(
        config_obj=c, caller=BACKTEST, result_label=c.backtestConfigurationResult, func=load_backtest_settings))

    c.optimizerImportDataButton.clicked.connect(lambda: import_data(c, OPTIMIZER))
    c.optimizerDownloadDataButton.clicked.connect(lambda: download_data(c, OPTIMIZER))
    c.optimizerStopDownloadButton.clicked.connect(lambda: stop_download(c, OPTIMIZER))
    c.optimizerSaveConfigurationButton.clicked.connect(lambda: save_config_helper(
        config_obj=c, caller=OPTIMIZER, result_label=c.optimizerConfigurationResult, func=save_optimizer_settings))
    c.optimizerLoadConfigurationButton.clicked.connect(lambda: load_config_helper(
        config_obj=c, caller=OPTIMIZER, result_label=c.optimizerConfigurationResult, func=load_optimizer_settings))

    c.setBalanceColorButton.clicked.connect(lambda: get_and_set_line_color(c, c.balanceColor))
    c.setHoverLineColorButton.clicked.connect(lambda: get_and_set_line_color(c, c.hoverLineColor))

    c.testCredentialsButton.clicked.connect(lambda: test_binance_credentials(c))
    c.saveCredentialsButton.clicked.connect(lambda: save_credentials(c))
    c.loadCredentialsButton.clicked.connect(lambda: load_credentials(config_obj=c, auto=False))

    c.testTelegramButton.clicked.connect(lambda: test_telegram(c))
    c.telegramApiKey.textChanged.connect(lambda: reset_telegram_state(c))
    c.telegramChatID.textChanged.connect(lambda: reset_telegram_state(c))
    c.graphPlotSpeedSpinBox.valueChanged.connect(c.update_graph_speed)
    c.enableHoverLine.stateChanged.connect(c.enable_disable_hover_line)

    load_precision_combo_boxes(c)
    load_interval_combo_boxes(c)  # Primarily used for backtester/optimizer interval changer logic.
    load_loss_slots(c)  # These slots are based on the ordering.
    load_take_profit_slots(c)
    load_strategy_slots(c)
Ejemplo n.º 3
0
    def __init__(self, parent: QMainWindow, logger: Logger = None):
        super(Configuration, self).__init__(parent)  # Initializing object
        uic.loadUi(configurationUi, self)  # Loading the main UI
        self.parent = parent
        self.threadPool = QThreadPool()
        self.logger = logger

        self.optimizer_backtest_dict = {
            BACKTEST: {
                'startDate': self.backtestStartDate,
                'endDate': self.backtestEndDate,
                'tickers': self.backtestTickerLineEdit,
                'intervals': self.backtestIntervalComboBox,
                'data': None,
                'dataIntervalComboBox': self.backtestIntervalComboBox,
                'dataInterval': None,
                'dataType': None,
                'infoLabel': self.backtestInfoLabel,
                'dataLabel': self.backtestDataLabel,
                'downloadThread': None,
                'downloadLabel': self.backtestDownloadLabel,
                'downloadButton': self.backtestDownloadDataButton,
                'stopDownloadButton': self.backtestStopDownloadButton,
                'importButton': self.backtestImportDataButton,
                'downloadProgress': self.backtestDownloadProgressBar
            },
            OPTIMIZER: {
                'startDate': self.optimizerStartDate,
                'endDate': self.optimizerEndDate,
                'tickers': self.optimizerTickerLineEdit,
                'intervals': self.optimizerIntervalComboBox,
                'data': None,
                'dataIntervalComboBox': self.optimizerIntervalComboBox,
                'dataInterval': None,
                'dataType': None,
                'infoLabel': self.optimizerInfoLabel,
                'dataLabel': self.optimizerDataLabel,
                'downloadThread': None,
                'downloadLabel': self.optimizerDownloadLabel,
                'downloadButton': self.optimizerDownloadDataButton,
                'stopDownloadButton': self.optimizerStopDownloadButton,
                'importButton': self.optimizerImportDataButton,
                'downloadProgress': self.optimizerDownloadProgressBar
            }
        }

        self.lossTypes = ("Trailing", "Stop")
        self.takeProfitTypes = ('Stop',)
        self.lossOptimizerTypes = ('lossPercentage', 'stopLossCounter')
        self.takeProfitOptimizerTypes = ('takeProfitPercentage',)

        # Telegram
        self.tokenPass = False
        self.chatPass = False

        # Folders and files
        self.credentialsFolder = "Credentials"
        self.configFolder = 'Configuration'
        self.stateFilePath = os.path.join(helpers.ROOT_DIR, 'state.json')

        self.categoryTabs = [
            self.mainConfigurationTabWidget,
            self.simulationConfigurationTabWidget,
            self.backtestConfigurationTabWidget,
            self.optimizerConfigurationTabWidget
        ]

        self.strategies = get_strategies_dictionary(Strategy.__subclasses__())
        self.strategyDict = {}  # We will store all the strategy slot information in this dictionary.
        self.lossDict = {}  # We will store stop loss settings here.
        self.takeProfitDict = {}  # We will store take profit settings here.

        load_slots(self)  # Loads stop loss, take profit, and strategies slots.
        load_credentials(self)  # Load credentials if they exist.
Ejemplo n.º 4
0
def load_slots(config_obj):
    """
    Loads all configuration interface slots.
    :param config_obj: Configuration QDialog object (from configuration.py)
    :return: None
    """
    config_obj.simulationCopySettingsButton.clicked.connect(
        lambda: copy_settings_to_simulation(config_obj))
    config_obj.simulationSaveConfigurationButton.clicked.connect(
        lambda: save_simulation_settings(config_obj))
    config_obj.simulationLoadConfigurationButton.clicked.connect(
        lambda: load_simulation_settings(config_obj))

    config_obj.backtestCopySettingsButton.clicked.connect(
        lambda: copy_settings_to_backtest(config_obj))
    config_obj.backtestSaveConfigurationButton.clicked.connect(
        lambda: save_backtest_settings(config_obj))
    config_obj.backtestLoadConfigurationButton.clicked.connect(
        lambda: load_backtest_settings(config_obj))
    config_obj.backtestImportDataButton.clicked.connect(
        lambda: import_data(config_obj, BACKTEST))
    config_obj.backtestDownloadDataButton.clicked.connect(
        lambda: download_data(config_obj, BACKTEST))
    config_obj.backtestStopDownloadButton.clicked.connect(
        lambda: stop_download(config_obj, BACKTEST))

    config_obj.optimizerImportDataButton.clicked.connect(
        lambda: import_data(config_obj, OPTIMIZER))
    config_obj.optimizerDownloadDataButton.clicked.connect(
        lambda: download_data(config_obj, OPTIMIZER))
    config_obj.optimizerStopDownloadButton.clicked.connect(
        lambda: stop_download(config_obj, OPTIMIZER))

    config_obj.testCredentialsButton.clicked.connect(
        lambda: test_binance_credentials(config_obj))
    config_obj.saveCredentialsButton.clicked.connect(
        lambda: save_credentials(config_obj))
    config_obj.loadCredentialsButton.clicked.connect(
        lambda: load_credentials(config_obj=config_obj, auto=False))

    config_obj.testTelegramButton.clicked.connect(
        lambda: test_telegram(config_obj))
    config_obj.telegramApiKey.textChanged.connect(
        lambda: reset_telegram_state(config_obj))
    config_obj.telegramChatID.textChanged.connect(
        lambda: reset_telegram_state(config_obj))

    config_obj.saveConfigurationButton.clicked.connect(
        lambda: save_live_settings(config_obj))
    config_obj.loadConfigurationButton.clicked.connect(
        lambda: load_live_settings(config_obj))
    config_obj.graphPlotSpeedSpinBox.valueChanged.connect(
        config_obj.update_graph_speed)
    config_obj.enableHoverLine.stateChanged.connect(
        config_obj.enable_disable_hover_line)

    load_interval_combo_boxes(
        config_obj
    )  # Primarily used for backtester/optimizer interval changer logic.
    load_loss_slots(config_obj)  # These slots are based on the ordering.
    load_take_profit_slots(config_obj)
    load_strategy_slots(config_obj)