Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed T212 parsing #589

Closed
richard-britton opened this issue Feb 4, 2025 · 2 comments
Closed

Failed T212 parsing #589

richard-britton opened this issue Feb 4, 2025 · 2 comments

Comments

@richard-britton
Copy link
Contributor

richard-britton commented Feb 4, 2025

Importing data from Trading 212 fails if you have share lending entries. You can fix by applying the below:

diff --git a/cgt_calc/parsers/trading212.py b/cgt_calc/parsers/trading212.py
index 7d9922f..0f4740c 100644
--- a/cgt_calc/parsers/trading212.py
+++ b/cgt_calc/parsers/trading212.py
@@ -80,7 +80,10 @@ def action_from_str(label: str, filename: str) -> ActionType:
     ]:
         return ActionType.DIVIDEND

-    if label in ["Interest on cash"]:
+    if label in [
+        "Interest on cash",
+        "Lending interest",
+    ]:
         return ActionType.INTEREST

     if label == "Stock Split":

Example data looks like this:

Lending interest,2024-09-30 01:07:05,,,,"Share lending interest",ref,,,,,,,0.01,"GBP",,

Thanks!

@vmartinv
Copy link
Collaborator

vmartinv commented Feb 4, 2025

Makes sense, can you create a pull request for this?

@richard-britton
Copy link
Contributor Author

Sure - #590

Thanks again!

@KapJI KapJI closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants