HKUDS/Vibe-Trading · error · EtoroAPIError
symbol is required
Error message
symbol is required
What it means
Raised by _order_instrument_ref (used by place_order) when the symbol argument strips to empty. The order body needs either a ticker symbol or an instrumentId.
Source
Thrown at agent/src/trading/connectors/etoro/trading.py:285
body["clearStopLoss"] = True
if clear_take_profit:
body["clearTakeProfit"] = True
req_id = (request_id or str(uuid.uuid4())).strip()
path = f"{positions_root(cfg)}/positions/{pos_id}"
try:
payload = make_client(cfg).request("PATCH", path, json_body=body, request_id=req_id)
except EtoroAPIError as exc:
return _order_error(cfg, str(exc), position_id=pos_id, request_id=req_id)
return {"status": "ok", **_base(cfg), "position_id": pos_id, "request_id": req_id, "raw": payload}
def _order_instrument_ref(symbol: str, cfg: EtoroConfig) -> dict[str, Any]:
"""Build exactly one of ``symbol`` or ``instrumentId`` for open-order bodies."""
token = str(symbol or "").strip()
if not token:
raise EtoroAPIError("symbol is required")
if _looks_like_ticker(token):
return {"symbol": token}
instrument_id = resolve_instrument_id(token, cfg)
return {"instrumentId": instrument_id}
def _extract_order_id(payload: Any) -> str | None:
if not isinstance(payload, dict):
return None
for key in ("orderID", "orderId", "order_id", "id"):
value = payload.get(key)
if value is not None:
return str(value)
data = payload.get("data")
if isinstance(data, dict):
for key in ("orderID", "orderId", "order_id", "id"):
value = data.get(key)
if value is not None:View on GitHub (pinned to 80ffdda44c)
Solutions
- Validate symbol is non-empty before building the order
- Fix upstream data source producing blank symbols
Defensive patterns
Strategy: validation
Validate before calling
if not (symbol or '').strip():
raise ValueError('cannot place order without a symbol') Type guard
def order_has_symbol(sym: str | None) -> bool:
return bool(sym and sym.strip()) Prevention
- Validate order forms server-side before submission
- Never build orders from unvalidated user input
When it happens
Trigger: place_order(symbol='', ...) or symbol=None; order built from a blank form field or missing config.
Common situations: UI allowing empty ticker, position-close loop with a None symbol, template rendering an empty string.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- symbol is required
- search query is required
- mode must be 'auto', 'symbol', 'discover', or 'type'
- unsupported instrument_type_id {type_id}
- invalid instrument id {instrument_id}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/4f73412c8296a7cb.
Report an issue: GitHub.