"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(trading): treat zero quantity/notional as unset in trading_place_order
irfan allana9f2be9dc615e
diff --git a/agent/src/tools/trading_connector_tool.py b/agent/src/tools/trading_connector_tool.pyindex 489274b0f..befd42c8a 100644--- a/agent/src/tools/trading_connector_tool.py+++ b/agent/src/tools/trading_connector_tool.py@@ -342,14 +342,19 @@ class TradingPlaceOrderTool(BaseTool):def execute(self, **kwargs: Any) -> str:"""Place an order via the connector profile."""+ # LLMs frequently populate BOTH sizing fields, leaving the unused one at+ # 0; a zero size is never valid, so treat it as absent to preserve the+ # "exactly one of quantity/notional" contract.+ quantity = _num_or_none(kwargs.get("quantity")) or None+ notional = _num_or_none(kwargs.get("notional")) or Nonetry:return _json_result(place_order(str(kwargs["symbol"]),_connection(kwargs.get("connection")),side=str(kwargs.get("side") or ""),- quantity=_num_or_none(kwargs.get("quantity")),- notional=_num_or_none(kwargs.get("notional")),+ quantity=quantity,+ notional=notional,order_type=str(kwargs.get("order_type") or "market"),limit_price=_num_or_none(kwargs.get("limit_price")),time_in_force=str(kwargs.get("time_in_force") or "day"),