feat: read-only Trading 212 broker connector#321
Merged
warren618 merged 1 commit intoJun 29, 2026
Conversation
1 task
warren618
force-pushed
the
fix/309-trading212-readonly-connector
branch
from
June 29, 2026 08:48
2fcb744 to
a83815d
Compare
Collaborator
|
Thanks @mvanhorn, merged in f6bd350. I rebased the branch onto current main, resolved the additive registry conflicts, and kept the connector scoped to read-only / fail-closed behavior. I also aligned the Trading 212 host/auth handling with the current API docs while preserving your commit authorship on a83815d. CI is green: https://github.com/HKUDS/Vibe-Trading/actions/runs/28359930953. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new connector package
agent/src/trading/connectors/trading212/mirroring the structure of existing read-only/paper connectors such asdhanandshoonya:__init__.py(package docstring),sdk.py(read-only operations against Trading 212's REST API: account, positions, open orders, history, instrument metadata),profiles.py(TRADING212_PROFILES, capped at read-only since the public API has no runtime paper/live discriminator, following the same hard-refuse rule Dhan/Shoonya use forplace_order/cancel_order), andclassification.py(TRADING212_TOOL_CLASSmapping each operation to read/writeToolClass). Wire it into the three registries that every connector touches: add the SDK module to_SDK_CONNECTOR_MODULESinagent/src/trading/service.py, import and spliceTRADING212_PROFILESintoBUILTIN_PROFILESinagent/src/trading/profiles.py, and import and registerTRADING212_TOOL_CLASSin the classification map inagent/src/live/registry.py. Addagent/tests/test_trading212_connector.pycovering profile registration, read/write classification, and the paper/live hard-refuse on order placement.Why
The reporter requested a broker connector for Trading 212 (UK/EU retail broker). The maintainer (warren618, COLLABORATOR) responded on 2026-06-27 that Trading 212 is a reasonable candidate and a focused community PR is welcome, with the explicit scoping that the first step stay read-only and avoid live order placement until the broker exposes a clear paper/demo or structural safety boundary. The cleanest first PR is read-only account/positions/orders/history/instrument-metadata support plus connector classification, mirroring the existing connector pattern.
Closes #309
Changes
agent/src/trading/connectors/trading212/mirroring the structure of existing read-only/paper connectors such asdhanandshoonya:__init__.py(package docstring),sdk.py(read-only operations against Trading 212's REST API: account, positions, open orders, history, instrument metadata),profiles.py(TRADING212_PROFILES, capped at read-only since the public API has no runtime paper/live discriminator, following the same hard-refuse rule Dhan/Shoonya use forplace_order/cancel_order), andclassification.py(TRADING212_TOOL_CLASSmapping each operation to read/writeToolClass). Wire it into the three registries that every connector touches: add the SDK module to_SDK_CONNECTOR_MODULESinagent/src/trading/service.py, import and spliceTRADING212_PROFILESintoBUILTIN_PROFILESinagent/src/trading/profiles.py, and import and registerTRADING212_TOOL_CLASSin the classification map inagent/src/live/registry.py. Addagent/tests/test_trading212_connector.pycovering profile registration, read/write classification, and the paper/live hard-refuse on order placement.Test Plan
pytest --ignore=agent/tests/e2e_backtest --tb=short -q)BUILTIN_PROFILESand read-only operations classify as read in the live registry. - Edge case: anyplace_order/cancel_orderattempt with a non-paper config is hard-refused at the first line (no structural paper/live guard available), matching the Dhan/Shoonya rule. - Error path: a missing or invalid Trading 212 API key surfaces a clear connector error rather than an unhandled exception; classification falls back to deny for unknown operations.Checklist
src/agent/,src/session/,src/providers/) without prior discussionAI was used for assistance.