|
@@ -350,15 +350,67 @@ This will:
|
|
|
await self.copy_status_command(update, context)
|
|
|
|
|
|
elif callback_data == "copy_start_prompt":
|
|
|
- await query.edit_message_text(
|
|
|
- text=(
|
|
|
- "🚀 <b>Start Copy Trading</b>\n\n"
|
|
|
- "Please provide the target trader's address:\n\n"
|
|
|
- "Usage: /copy start [target_address]\n"
|
|
|
- "Example: /copy start 0x1234567890abcdef1234567890abcdef12345678"
|
|
|
- ),
|
|
|
- parse_mode='HTML'
|
|
|
- )
|
|
|
+ # Check if we have a config address to use automatically
|
|
|
+ config_address = Config.COPY_TRADING_TARGET_ADDRESS
|
|
|
+
|
|
|
+ if config_address and config_address.strip():
|
|
|
+ # Auto-start with config address - show confirmation directly
|
|
|
+ await query.edit_message_text("🔍 Using target address from config...")
|
|
|
+
|
|
|
+ # Validate the config address format
|
|
|
+ if not config_address.startswith('0x') or len(config_address) != 42:
|
|
|
+ await query.edit_message_text(
|
|
|
+ text="❌ Invalid address in config file. Address must start with '0x' and be 42 characters long.",
|
|
|
+ parse_mode='HTML'
|
|
|
+ )
|
|
|
+ return
|
|
|
+
|
|
|
+ # Show confirmation directly
|
|
|
+ message = f"""
|
|
|
+🚀 <b>Start Copy Trading Confirmation</b>
|
|
|
+
|
|
|
+🎯 <b>Target Trader:</b> <code>{config_address}</code>
|
|
|
+📍 <b>Address Source:</b> config file
|
|
|
+💰 <b>Portfolio Allocation:</b> {copy_monitor.portfolio_percentage:.1%}
|
|
|
+📊 <b>Copy Mode:</b> {copy_monitor.copy_mode}
|
|
|
+⚡ <b>Max Leverage:</b> {copy_monitor.max_leverage}x
|
|
|
+💵 <b>Min Position Size:</b> ${copy_monitor.min_position_size}
|
|
|
+⏱️ <b>Execution Delay:</b> {copy_monitor.execution_delay}s
|
|
|
+
|
|
|
+⚠️ <b>Are you sure you want to start copy trading?</b>
|
|
|
+
|
|
|
+This will:
|
|
|
+• Monitor the target trader's positions
|
|
|
+• Automatically copy NEW trades (existing positions ignored)
|
|
|
+• Allocate {copy_monitor.portfolio_percentage:.1%} of your portfolio per trade
|
|
|
+• Send notifications for each copied trade
|
|
|
+ """
|
|
|
+
|
|
|
+ keyboard = [
|
|
|
+ [
|
|
|
+ InlineKeyboardButton("✅ Start Copy Trading", callback_data=f"copy_start_confirm_{config_address}"),
|
|
|
+ InlineKeyboardButton("❌ Cancel", callback_data="copy_cancel")
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ reply_markup = InlineKeyboardMarkup(keyboard)
|
|
|
+
|
|
|
+ await query.edit_message_text(
|
|
|
+ text=message,
|
|
|
+ parse_mode='HTML',
|
|
|
+ reply_markup=reply_markup
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ # No config address, ask for one
|
|
|
+ await query.edit_message_text(
|
|
|
+ text=(
|
|
|
+ "🚀 <b>Start Copy Trading</b>\n\n"
|
|
|
+ "Please provide the target trader's address:\n\n"
|
|
|
+ "Usage: /copy start [target_address]\n"
|
|
|
+ "Example: /copy start 0x1234567890abcdef1234567890abcdef12345678\n\n"
|
|
|
+ "💡 <b>Tip:</b> Set COPY_TRADING_TARGET_ADDRESS in your .env file for one-click start."
|
|
|
+ ),
|
|
|
+ parse_mode='HTML'
|
|
|
+ )
|
|
|
|
|
|
elif callback_data.startswith("copy_start_confirm_"):
|
|
|
target_address = callback_data.replace("copy_start_confirm_", "")
|