Add Trading212 plugin#86
Conversation
Monitors a Trading 212 Invest/Stocks ISA account: cash and account value, open positions, pies, pending orders, and order/dividend/transaction history, via the Trading 212 public API (beta). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a new Trading212 v1 plugin with connection metadata, credential UI and validation, custom types, data streams and scripts, indexing and default content, three dashboards, and setup documentation. ChangesTrading212 Plugin Implementation
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/Trading212/v1/dataStreams/orderHistory.json`:
- Around line 28-32: `orderHistory.json` models `order.id` incorrectly as a
string and does not mark it as the identity field, which can break row handling;
update the `id` column metadata in the `orderHistory` stream to match
`pendingOrders.json` by using the integer schema and setting the proper
identifier role. Keep the fix localized to the `orderHistory` stream definition
so the `order.id` field is treated consistently across both streams.
In `@plugins/Trading212/v1/dataStreams/scripts/orderHistory.js`:
- Around line 24-26: The current `fees` calculation in `orderHistory.js` is
actually aggregating `walletImpact.taxes`, so the metadata label is misleading.
Update the corresponding field metadata in `orderHistory.json` by changing the
`displayName` from “Fees” to a tax-accurate label such as “Taxes” or “Charges”,
and make sure the label matches the `fees` field behavior used by the order
history stream.
In `@plugins/Trading212/v1/metadata.json`:
- Line 2: The metadata name value is not using the required lowercase kebab-case
format that matches the display name. Update the `name` field in `metadata.json`
for the Trading 212 plugin from the current compact form to the kebab-style form
used by the display name, and keep it consistent with the plugin’s
`displayName`/branding conventions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7f03f68b-0a90-4393-a124-cfc9216272b9
⛔ Files ignored due to path filters (1)
plugins/Trading212/v1/icon.svgis excluded by!**/*.svg
📒 Files selected for processing (24)
plugins/Trading212/v1/configValidation.jsonplugins/Trading212/v1/custom_types.jsonplugins/Trading212/v1/dataStreams/accountSummary.jsonplugins/Trading212/v1/dataStreams/dividendHistory.jsonplugins/Trading212/v1/dataStreams/orderHistory.jsonplugins/Trading212/v1/dataStreams/pendingOrders.jsonplugins/Trading212/v1/dataStreams/pieDetail.jsonplugins/Trading212/v1/dataStreams/pies.jsonplugins/Trading212/v1/dataStreams/positions.jsonplugins/Trading212/v1/dataStreams/scripts/dividendHistory.jsplugins/Trading212/v1/dataStreams/scripts/orderHistory.jsplugins/Trading212/v1/dataStreams/scripts/pendingOrders.jsplugins/Trading212/v1/dataStreams/scripts/pieDetail.jsplugins/Trading212/v1/dataStreams/scripts/positions.jsplugins/Trading212/v1/dataStreams/transactionHistory.jsonplugins/Trading212/v1/defaultContent/manifest.jsonplugins/Trading212/v1/defaultContent/overviewDashboard.dash.jsonplugins/Trading212/v1/defaultContent/pieDashboard.dash.jsonplugins/Trading212/v1/defaultContent/positionDashboard.dash.jsonplugins/Trading212/v1/defaultContent/scopes.jsonplugins/Trading212/v1/docs/README.mdplugins/Trading212/v1/indexDefinitions/default.jsonplugins/Trading212/v1/metadata.jsonplugins/Trading212/v1/ui.json
| const fees = taxes.length | ||
| ? -taxes.reduce((sum, t) => sum + (t.quantity || 0), 0) | ||
| : null; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
fees field sums taxes, not fees — displayName is misleading.
The calculation negates the sum of all walletImpact.taxes quantities. These are government taxes (stamp duty, financial transaction tax, etc.), not broker fees — Trading212 is zero-commission. The metadata displayName "Fees" (in orderHistory.json line 131) will mislead dashboard consumers. Consider renaming to "Taxes" or "Charges" in the metadata displayName.
🔧 Proposed fix in orderHistory.json
{
"name": "fees",
- "displayName": "Fees",
+ "displayName": "Taxes",
"shape": ["number", { "decimalPlaces": 2 }],
"visible": false
},🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Trading212/v1/dataStreams/scripts/orderHistory.js` around lines 24 -
26, The current `fees` calculation in `orderHistory.js` is actually aggregating
`walletImpact.taxes`, so the metadata label is misleading. Update the
corresponding field metadata in `orderHistory.json` by changing the
`displayName` from “Fees” to a tax-accurate label such as “Taxes” or “Charges”,
and make sure the label matches the `fees` field behavior used by the order
history stream.
| @@ -0,0 +1,41 @@ | |||
| { | |||
| "name": "trading212", | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
name should be kebab-style matching the display name.
The display name is "Trading 212", so the kebab-style name should be "trading-212", not "trading212". As per coding guidelines, metadata.json must use a lowercase kebab-style name matching the display name.
🔧 Proposed fix
- "name": "trading212",
+ "name": "trading-212",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "name": "trading212", | |
| "name": "trading-212", |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@plugins/Trading212/v1/metadata.json` at line 2, The metadata name value is
not using the required lowercase kebab-case format that matches the display
name. Update the `name` field in `metadata.json` for the Trading 212 plugin from
the current compact form to the kebab-style form used by the display name, and
keep it consistent with the plugin’s `displayName`/branding conventions.
Source: Coding guidelines
The mode aggregator was applied to dividendCashAction (a string column), but SquaredUp's mode aggregator is documented for numeric columns only. Verified against a real pie once one existed in a test account. Group by the column instead, since it's constant per pie. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- orderHistory: order id is an integer per the Trading212 API, not a string; align its shape/role with pendingOrders.json so row identity and type handling work consistently across both order streams. - orderHistory: rename the "fees" column's display label from "Fees" to "Taxes" - it sums walletImpact.taxes (stamp duty, transaction tax, etc), not broker fees, and Trading 212 is commission-free. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🧩 Plugin PR Summary📦 Modified Plugins
📋 Results
🔍 Validation Details✅
|
Monitors a Trading 212 Invest/Stocks ISA account: cash and account value, open positions, pies, pending orders, and order/dividend/transaction history, via the Trading 212 public API (beta).
Switch to the
Previewtab above and select the appropriate PR template to use for this change:Summary by CodeRabbit
New Features
Documentation