Skip to content

Add Trading212 plugin - #86

Merged
clarkd merged 3 commits into
mainfrom
work/rw/trading212-plugin
Jul 28, 2026
Merged

Add Trading212 plugin#86
clarkd merged 3 commits into
mainfrom
work/rw/trading212-plugin

Conversation

@ryanwelan

@ryanwelan ryanwelan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

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 Preview tab above and select the appropriate PR template to use for this change:

Summary by CodeRabbit

  • New Features

    • Added Trading 212 integration with views for account summary, positions, pies, pending orders, order history, dividend history, and transactions.
    • Introduced built-in Overview, Position, and Pie dashboards with charts and sortable tables.
    • Added configuration inputs for API key/secret and Live/Demo environment selection, including clearer authentication feedback.
  • Documentation

    • Updated the Trading 212 setup guide with connection steps and current limitations (including truncated order/transaction history and read-only order handling).

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>
@ryanwelan
ryanwelan requested a review from a team July 8, 2026 11:00
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ryanwelan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 64c7fb68-48c5-4afd-a203-933e849818b7

📥 Commits

Reviewing files that changed from the base of the PR and between 9d9ed3a and fe5911c.

📒 Files selected for processing (2)
  • plugins/Trading212/v1/dataStreams/orderHistory.json
  • plugins/Trading212/v1/metadata.json
📝 Walkthrough

Walkthrough

This 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.

Changes

Trading212 Plugin Implementation

Layer / File(s) Summary
Plugin metadata, UI, auth validation, custom types
plugins/Trading212/v1/metadata.json, plugins/Trading212/v1/ui.json, plugins/Trading212/v1/configValidation.json, plugins/Trading212/v1/custom_types.json
Defines plugin metadata and base API config, credential/environment inputs, authentication validation, and Trading212 account/position/pie custom types.
Account and transaction history streams
plugins/Trading212/v1/dataStreams/accountSummary.json, plugins/Trading212/v1/dataStreams/transactionHistory.json, plugins/Trading212/v1/dataStreams/dividendHistory.json, plugins/Trading212/v1/dataStreams/scripts/dividendHistory.js
Adds account summary, transaction history, and dividend history streams plus dividend row mapping and optional position filtering.
Positions and order streams
plugins/Trading212/v1/dataStreams/positions.json, plugins/Trading212/v1/dataStreams/orderHistory.json, plugins/Trading212/v1/dataStreams/pendingOrders.json, plugins/Trading212/v1/dataStreams/scripts/positions.js, plugins/Trading212/v1/dataStreams/scripts/orderHistory.js, plugins/Trading212/v1/dataStreams/scripts/pendingOrders.js
Adds positions, order history, and pending orders streams and scripts that normalize rows, derive order fields, and filter by selected positions.
Pie streams and detail processing
plugins/Trading212/v1/dataStreams/pies.json, plugins/Trading212/v1/dataStreams/pieDetail.json, plugins/Trading212/v1/dataStreams/scripts/pieDetail.js
Adds pie summary/detail streams and the pie detail script that combines pie settings with instrument-level metrics.
Index definitions, scopes, and manifest
plugins/Trading212/v1/indexDefinitions/default.json, plugins/Trading212/v1/defaultContent/scopes.json, plugins/Trading212/v1/defaultContent/manifest.json
Maps the main streams into indexed objects, defines account/position/pie scopes, and lists the default dashboard content items.
Default dashboards
plugins/Trading212/v1/defaultContent/overviewDashboard.dash.json, plugins/Trading212/v1/defaultContent/positionDashboard.dash.json, plugins/Trading212/v1/defaultContent/pieDashboard.dash.json
Adds overview, position, and pie dashboards with tiles bound to the Trading212 streams and scopes.
Documentation
plugins/Trading212/v1/docs/README.md
Documents API credential setup, plugin configuration, indexed data, and known limitations.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only a brief summary and does not complete the required PR template or specify the selected template type. Use the correct new-plugin PR template and fill in all required sections, including setup, changes, testing, and any requested details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding a Trading212 plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 18219a1 and bcc16fe.

⛔ Files ignored due to path filters (1)
  • plugins/Trading212/v1/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (24)
  • plugins/Trading212/v1/configValidation.json
  • plugins/Trading212/v1/custom_types.json
  • plugins/Trading212/v1/dataStreams/accountSummary.json
  • plugins/Trading212/v1/dataStreams/dividendHistory.json
  • plugins/Trading212/v1/dataStreams/orderHistory.json
  • plugins/Trading212/v1/dataStreams/pendingOrders.json
  • plugins/Trading212/v1/dataStreams/pieDetail.json
  • plugins/Trading212/v1/dataStreams/pies.json
  • plugins/Trading212/v1/dataStreams/positions.json
  • plugins/Trading212/v1/dataStreams/scripts/dividendHistory.js
  • plugins/Trading212/v1/dataStreams/scripts/orderHistory.js
  • plugins/Trading212/v1/dataStreams/scripts/pendingOrders.js
  • plugins/Trading212/v1/dataStreams/scripts/pieDetail.js
  • plugins/Trading212/v1/dataStreams/scripts/positions.js
  • plugins/Trading212/v1/dataStreams/transactionHistory.json
  • plugins/Trading212/v1/defaultContent/manifest.json
  • plugins/Trading212/v1/defaultContent/overviewDashboard.dash.json
  • plugins/Trading212/v1/defaultContent/pieDashboard.dash.json
  • plugins/Trading212/v1/defaultContent/positionDashboard.dash.json
  • plugins/Trading212/v1/defaultContent/scopes.json
  • plugins/Trading212/v1/docs/README.md
  • plugins/Trading212/v1/indexDefinitions/default.json
  • plugins/Trading212/v1/metadata.json
  • plugins/Trading212/v1/ui.json

Comment thread plugins/Trading212/v1/dataStreams/orderHistory.json
Comment thread plugins/Trading212/v1/dataStreams/scripts/orderHistory.js
Comment thread plugins/Trading212/v1/metadata.json
ryanwelan and others added 2 commits July 8, 2026 13:09
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>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/Trading212/v1

📋 Results

Step Status
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

trading212
{
  "valid": true,
  "pluginName": "trading212",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 8,
    "Import Definitions": 1,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": true
  }
}

@clarkd
clarkd merged commit 95b4d6c into main Jul 28, 2026
1 check passed
@clarkd
clarkd deleted the work/rw/trading212-plugin branch July 28, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants