diff --git a/frontend/components/launch_strategy_v2.py b/frontend/components/launch_strategy_v2.py index 00079a6d..8dababff 100644 --- a/frontend/components/launch_strategy_v2.py +++ b/frontend/components/launch_strategy_v2.py @@ -75,7 +75,7 @@ def launch_new_bot(self): st.warning("You need to select the controllers configs. Please select at least one controller " "config by clicking on the checkbox.") return - start_time_str = time.strftime("%Y.%m.%d_%H.%M") + start_time_str = time.strftime("%Y%m%d-%H%M") bot_name = f"{self._bot_name}-{start_time_str}" script_config = { "name": bot_name, @@ -166,13 +166,18 @@ def __call__(self): all_controllers_config = self._backend_api_client.get_all_controllers_config() data = [] for config in all_controllers_config: + # Handle case where config might be a string instead of dict + if isinstance(config, str): + st.warning(f"Unexpected config format: {config}. Expected a dictionary.") + continue + connector_name = config.get("connector_name", "Unknown") trading_pair = config.get("trading_pair", "Unknown") - total_amount_quote = config.get("total_amount_quote", 0) - stop_loss = config.get("stop_loss", 0) - take_profit = config.get("take_profit", 0) + total_amount_quote = float(config.get("total_amount_quote", 0)) + stop_loss = float(config.get("stop_loss", 0)) + take_profit = float(config.get("take_profit", 0)) trailing_stop = config.get("trailing_stop", {"activation_price": 0, "trailing_delta": 0}) - time_limit = config.get("time_limit", 0) + time_limit = float(config.get("time_limit", 0)) config_version = config["id"].split("_") if len(config_version) > 1: config_base = config_version[0] diff --git a/frontend/pages/orchestration/credentials/app.py b/frontend/pages/orchestration/credentials/app.py index 3e57f884..3f8db03a 100644 --- a/frontend/pages/orchestration/credentials/app.py +++ b/frontend/pages/orchestration/credentials/app.py @@ -98,13 +98,37 @@ def get_all_connectors_config_map(): st.write(f"Configuration Map for {connector_name}:") config_inputs = {} -cols = st.columns(NUM_COLUMNS) -for i, config in enumerate(config_map): - with cols[i % (NUM_COLUMNS - 1)]: - config_inputs[config] = st.text_input(config, type="password", key=f"{connector_name}_{config}") -with cols[-1]: +# Custom logic for XRPL connector +if connector_name == "xrpl": + # Define custom XRPL fields with default values + xrpl_fields = { + "xrpl_secret_key": "", + "wss_node_url": "wss://xrplcluster.com", + "wss_second_node_url": "wss://s1.ripple.com", + "wss_third_node_url": "wss://s2.ripple.com" + } + + # Display XRPL-specific fields + for field, default_value in xrpl_fields.items(): + if field == "xrpl_secret_key": + config_inputs[field] = st.text_input(field, type="password", key=f"{connector_name}_{field}") + else: + config_inputs[field] = st.text_input(field, value=default_value, key=f"{connector_name}_{field}") + if st.button("Submit Credentials"): response = client.add_connector_keys(account_name, connector_name, config_inputs) if response: st.success(response) +else: + # Default behavior for other connectors + cols = st.columns(NUM_COLUMNS) + for i, config in enumerate(config_map): + with cols[i % (NUM_COLUMNS - 1)]: + config_inputs[config] = st.text_input(config, type="password", key=f"{connector_name}_{config}") + + with cols[-1]: + if st.button("Submit Credentials"): + response = client.add_connector_keys(account_name, connector_name, config_inputs) + if response: + st.success(response)