HKUDS/Vibe-Trading · warning · EtoroAPIError

symbol is required

Error message

symbol is required

What it means

Raised by resolve_instrument_id when the symbol argument strips to an empty string. Symbol resolution requires a ticker or numeric instrument id.

Source

Thrown at agent/src/trading/connectors/etoro/instruments.py:299

    instruments = normalized[:clean_limit]
    if include_rates:
        _attach_rates(cfg, instruments)

    return {
        "status": "ok",
        **_base_payload(cfg),
        "instrument_type_id": type_id,
        "instrument_type": id_to_label[type_id],
        "mode": "type",
        "instruments": instruments,
    }


def resolve_instrument_id(symbol: str, cfg: EtoroConfig) -> int:
    """Resolve a user symbol to an eToro ``instrumentId`` for trading APIs."""
    token = str(symbol or "").strip()
    if not token:
        raise EtoroAPIError("symbol is required")
    if token.isdigit():
        instrument_id = int(token)
        if instrument_id in _INVALID_INSTRUMENT_IDS or instrument_id < 0:
            raise EtoroAPIError(f"invalid instrument id {instrument_id}")
        return instrument_id

    canonical = _canonical_ticker(token)
    candidates: list[tuple[int, int]] = []  # (priority, instrument_id)

    for lookup in _lookup_variants(token, canonical):
        for item in _search_by_symbol(cfg, lookup, limit=25):
            instrument_id = _instrument_id(item)
            if instrument_id is None:
                continue
            priority = _match_priority(item, lookup, canonical, token)
            if priority > 0:
                candidates.append((priority, instrument_id))

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Check symbol is non-empty before calling
  2. Fix the upstream data producing empty symbols
Defensive patterns

Strategy: validation

Validate before calling

if not (symbol or '').strip():
    raise ValueError('symbol required')

Type guard

def has_symbol(sym: str | None) -> bool:
    return bool(sym and sym.strip())

Prevention

When it happens

Trigger: resolve_instrument_id('') or resolve_instrument_id(None); downstream via get_quote('') or get_historical_bars('') or place_order with empty symbol.

Common situations: Empty form field, missing config value, or a loop iterating over a list containing ''.

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


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/c87e9332858599c3. Report an issue: GitHub.