feat: Add is_tsl_enabled to create_order MCP tool

Enable trailing stop loss via native eToro feature when creating orders.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-15 14:05:15 +02:00
parent c749c42bc4
commit 8faf5ecca6

View File

@@ -266,6 +266,7 @@ async def list_tools() -> list[Tool]:
"take_profit_pct": {"type": "number", "description": "Take profit percentage (e.g., 10 for 10%)"}, "take_profit_pct": {"type": "number", "description": "Take profit percentage (e.g., 10 for 10%)"},
"stop_loss_pct": {"type": "number", "description": "Stop loss percentage (e.g., 5 for 5%)"}, "stop_loss_pct": {"type": "number", "description": "Stop loss percentage (e.g., 5 for 5%)"},
"dry_run": {"type": "boolean", "default": False, "description": "Validate only, do not execute"}, "dry_run": {"type": "boolean", "default": False, "description": "Validate only, do not execute"},
"is_tsl_enabled": {"type": "boolean", "default": False, "description": "Enable trailing stop loss (eToro native feature)"},
}, },
"required": ["symbol", "action", "amount"], "required": ["symbol", "action", "amount"],
}, },
@@ -507,6 +508,7 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]:
"take_profit_pct": arguments.get("take_profit_pct", 10), "take_profit_pct": arguments.get("take_profit_pct", 10),
"stop_loss_pct": arguments.get("stop_loss_pct", 5), "stop_loss_pct": arguments.get("stop_loss_pct", 5),
"dry_run": arguments.get("dry_run", False), "dry_run": arguments.get("dry_run", False),
"is_tsl_enabled": arguments.get("is_tsl_enabled", False),
} }
if arguments.get("limit_price"): if arguments.get("limit_price"):
payload["limit_price"] = arguments["limit_price"] payload["limit_price"] = arguments["limit_price"]