{"record":{"id":"11d997f7c8bbd1fc","repo":"HKUDS/Vibe-Trading","slug":"unsupported-period-period-r","errorCode":null,"errorMessage":"unsupported period {period!r}","messagePattern":"unsupported period (.+?)","errorType":"validation","errorClass":"EtoroAPIError","httpStatus":null,"severity":"warning","filePath":"agent/src/trading/connectors/etoro/sdk.py","lineNumber":315,"sourceCode":") -> dict[str, Any]:\n    return cancel_open_order(config, order_id, symbol=symbol, request_id=request_id)\n\n\ndef _map_interval(period: str) -> str:\n    token = str(period or \"1d\").strip().lower()\n    mapping = {\n        \"1m\": \"OneMinute\",\n        \"5m\": \"FiveMinutes\",\n        \"15m\": \"FifteenMinutes\",\n        \"30m\": \"ThirtyMinutes\",\n        \"1h\": \"OneHour\",\n        \"4h\": \"FourHours\",\n        \"1d\": \"OneDay\",\n        \"1w\": \"OneWeek\",\n    }\n    if token in mapping:\n        return mapping[token]\n    raise EtoroAPIError(f\"unsupported period {period!r}\")\n\n\ndef _extract_positions(payload: Any) -> list[dict[str, Any]]:\n    if isinstance(payload, dict):\n        for key in (\"positions\", \"clientPortfolio\", \"portfolio\", \"data\"):\n            value = payload.get(key)\n            if isinstance(value, list):\n                return [_position_row(item) for item in value if isinstance(item, dict)]\n            if isinstance(value, dict):\n                nested = value.get(\"positions\")\n                if isinstance(nested, list):\n                    return [_position_row(item) for item in nested if isinstance(item, dict)]\n    if isinstance(payload, list):\n        return [_position_row(item) for item in payload if isinstance(item, dict)]\n    return []\n\n\ndef _position_row(item: dict[str, Any]) -> dict[str, Any]:","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/etoro/sdk.py#L297-L333","documentation":"Raised by _map_interval (used by get_historical_bars) when the period string is not in the supported set (1m,5m,15m,1h,4h,1d,1w after normalization).","triggerScenarios":"get_historical_bars('BTC', period='2h') or period='daily' or '1M' (month) — any unsupported granularity.","commonSituations":"Passing exchange-specific intervals from another connector (e.g. Futu/Binance granularity), uppercase or verbose period names, requesting intervals the API doesn't offer.","solutions":["Use one of the supported keys: 1m, 5m, 15m, 1h, 4h, 1d, 1w","Map your internal interval enum to these keys before calling"],"exampleFix":"# before\nget_historical_bars('BTC', period='2h')\n# after\nget_historical_bars('BTC', period='1h')  # or aggregate 1h bars client-side","handlingStrategy":"validation","validationCode":"SUPPORTED = {'1m','5m','15m','1h','4h','1d','1w'}\nif period not in SUPPORTED:\n    raise ValueError(f'period must be one of {sorted(SUPPORTED)}')","typeGuard":"def is_supported_period(p: str) -> bool:\n    return p in {'1m','5m','15m','1h','4h','1d','1w'}","tryCatchPattern":null,"preventionTips":["Map your internal interval vocabulary to the connector's supported set at the adapter layer","Expose only supported intervals in user-facing options"],"tags":["etoro","candles","interval","validation"],"backgroundTag":"unsupported-timeframe","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}