{"id":16024729,"url":"https://github.com/leoncvlt/trading212-pie-sync","last_synced_at":"2025-10-07T14:05:49.834Z","repository":{"id":42484940,"uuid":"334641503","full_name":"leoncvlt/trading212-pie-sync","owner":"leoncvlt","description":"🍰 Python tool to automate Trading212 pies allocations by syncing to another shared pie or external source","archived":false,"fork":false,"pushed_at":"2022-04-03T16:57:40.000Z","size":68,"stargazers_count":9,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T10:07:39.835Z","etag":null,"topics":["scraping","stock-market","trading212"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leoncvlt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-31T11:43:11.000Z","updated_at":"2025-01-27T07:51:46.000Z","dependencies_parsed_at":"2022-09-03T08:24:09.513Z","dependency_job_id":null,"html_url":"https://github.com/leoncvlt/trading212-pie-sync","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leoncvlt/trading212-pie-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoncvlt%2Ftrading212-pie-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoncvlt%2Ftrading212-pie-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoncvlt%2Ftrading212-pie-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoncvlt%2Ftrading212-pie-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leoncvlt","download_url":"https://codeload.github.com/leoncvlt/trading212-pie-sync/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoncvlt%2Ftrading212-pie-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278786685,"owners_count":26045591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["scraping","stock-market","trading212"],"created_at":"2024-10-08T19:23:23.898Z","updated_at":"2025-10-07T14:05:49.813Z","avatar_url":"https://github.com/leoncvlt.png","language":"Python","funding_links":["https://www.buymeacoffee.com/leoncvlt"],"categories":[],"sub_categories":[],"readme":"# trading212-pie-sync\n\nA python tool to automatically create / update Trading212 pies and sync their holdings' allocations to another shared pie or external source\n\n## Installation \u0026 Requirements\n\nMake sure you're in your virtual environment of choice, then run\n- `poetry install --no-dev` if you have [Poetry](https://python-poetry.org/) installed\n- `pip install -r requirements.txt` otherwise\n\n## Usage\n```\ntrading212-pie-sync [-h] [--from-json FROM_JSON] [--from-csv FROM_CSV] [--from-shared-pie FROM_SHARED_PIE] [-c] [-v] username password pie\n\npositional arguments:\n  username              The email to log into your Trading212 account\n  password              The password to log into your Trading212 account\n  pie                   The name of the pie to update (case-sensitive)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --fetch-available-equities FETCH_AVAILABLE_EQUITIES\n                        Fetch the list of available equieties to trade on Trading212 invest and save it to this file. when using this option, there's no need to supply email, password or pie name.\n  --from-json FROM_JSON\n                        Parse the list of holdings to update from this .json file with the format { [ticker]: [percentage], ... }\n  --from-csv FROM_CSV   Parse the list of holdings to update from this .csv file with the format [ticker],[percentage] for each line\n  --from-shared-pie FROM_SHARED_PIE\n                        Parse the list of instruments to update from the URL of a shared pie\n  --substitutions SUBSTITUTIONS\n                        Parse a list of replacement tickers from this .json file, To be used when a ticker is not found. The list format is { [original ticker]: [ticker to use if original not found], ... }\n  -c, --await-confirm   Do not commit changes automatically and wait for user to confirm\n  -v, --verbose         Increase output log verbosity\n```\n\n## Explanation\n[Trading212](trading212.com) pies are great! But editing allocations can be time consuming for pies with a lot of holdings, especially if you prefer a \"set-and-forget\" investement strategy. Moreover, while the social aspect of pie sharing is encouraged, once you copy someone's else pie it won't automatically update when the original changes, making the copy of actively-managed pies a bit pointless.\n\nThis script attempts to solve both problems by automating the process of updating a pie's holdings from another shared pie, or an external file.\n\nSince Trading212 lacks an API (which is apparently in the works), this tool uses an automated Chromedriver window to perform all operations on your pies.\n\nTo start, supply the tool with your Trading212's email, password and the target pie name (case-sensitive, will be created if it doesn't exists):\n`python trading212-pie-sync myname@email.com meg@mypassword \"My Pie\"`\n\nThen, supply a data source to fetch the holdings information from:\n- `--from-shared-pie https://www.trading212.com/pies/thesharedpieurl`: mirrors a shared pie's holdings allocation. Make sure the pie is public and the URL exists.\n- `--from-csv my_csv_file.csv`: reads the holdings allocation from a .csv file. The format is `[ticker],[percentage]` for each line. My other tool [etf4u](https://github.com/leoncvlt/etf4u) scrapes and exports ETF funds allocations data in this format.\n- `--from-json my_json_file.file`: reads the holdings allocation from a .json file. The format is `{ [ticker]: [percentage], ... }` for each line.\n\nFinally, pass the `--c` flag if you don't trust the script and want to review all changes before commiting the pie edits.\n\n## Fetching available assets\nYou can get a list of the tickers of all the equities that are available for trading on the invest platform by passing the `--fetch-available-equities` flag and the path to the text file you wish to save the list to. When using this option, you don't need to pass any of the positional arguments as the program will quit after exporting the list. \n\n### Instruments substitutions\nNot all stocks might be available on Trading212 - if one of the sources you are syncing changes with contains a stock that you is not present on the platform, you can set a up a substitution for it by editing the `substitutions.json` file and adding an entry with the format `[original ticker]: [ticker to use if original not found]`. Alternatively, you can use your own substitutions json file with the flag `--substitutions`.\n\n## Known Issues\n- Keep the automated window on the front / don't minimized it while it's running, or else it might jam the process.\n- Once in a blue moon, you might get a `StaleElementException` - simply restart the script in that case.\n- If the process appears to stop at some point / clicking / opening the wrong things, try deleting the `profile` folder (which contains cookies and settings for the automated browser session)\n\n## Support [![Buy me a coffee](https://img.shields.io/badge/-buy%20me%20a%20coffee-lightgrey?style=flat\u0026logo=buy-me-a-coffee\u0026color=FF813F\u0026logoColor=white \"Buy me a coffee\")](https://www.buymeacoffee.com/leoncvlt)\nIf this tool has proven useful to you, consider [buying me a coffee](https://www.buymeacoffee.com/leoncvlt) to support development of this and [many other projects](https://github.com/leoncvlt?tab=repositories).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoncvlt%2Ftrading212-pie-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoncvlt%2Ftrading212-pie-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoncvlt%2Ftrading212-pie-sync/lists"}