-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Transaction XTB error #116
Comments
Thanks for reporting this. I will look into it when I have time! |
@rubengr I've just looked at the issue. The I assume this record is not standalone, but rather connected to another BUY/SELL record. Could you maybe send me both lines from your export, so I can use that to create a working solution? |
@rubengr Could you check my latest message? Thanks! |
sorry for late reply. I think is related to taxes of dividends. For example:
|
Sorry for the late reply. I was busy finishing things up last year. Now I have more time for this project and I will look into this issue today! |
@rubengr After looking into it, it seems the XTB converter did not have support for dividends at all. I've added this just now, and used your input as test data. Can you test if this works for you? You can clone this branch and run it yourself, or use this Docker image to verify. Please let me know if all works as expected so I can merge this. |
Get this error:
|
That's a shame. Can you maybe provide me with the input you are trying with? That way I can better reproduce the issue myself. Thanks! |
Thanks! I will look into it and get back to you! |
I just took a look at the file you provided, but are you sure this ia a XTB export? It looks more like a DEGIRO file. The file you provided has a lot more headers then the one in my XTB sample (which is just |
@toffee I saw you were also looking into adding dividends to the XTB converter. Could you maybe try my fix, to verify if it all processes correctly? You can use this Docker image, or clone the branch if you want to run locally. Thanks a lot! |
I prepared a test export. Running the code from the branch on this input file give me an error (on record 9):
Additionally, seems the yahoo finance did not find correctly some stock symbols (for FLOA.UK wrongly find PFLT or for CSPX.UK find CSPX.L or for SPY5.UK find SPY508E-DC179.MX). Probably this should be discussed separately if it's an issue (or is it wrong configuration on my side!?) |
Thanks for the input! The issue seems to be with When I search on Yahoo Finance for |
@toffee I just pushed some changes, I also added some records of your test export. Can you verify if this works for you and all records are processed correctly? |
With the latest changes the generation of json file ends but the content is not ok. See bellow the generated json (3 activities) for these 6 cvs records:
As you can see, for the first two activities the fee is wrong and for the third activity has quantity and unitPrice null. To change the UK to L don't think it's correct - the symbol as it's come from XTB is correct (except the ones with US). I guess the removal of ".country" should be done only for US (in case of yahoo finance). |
I will look into the tax issue. But when I remove the .UK (as previoulsy), then you don't get completely different symbols right? The symbols that XTB uses are not known in Yahoo Finance. So with this replacement of |
Thank you. My previous assumption was wrong. I'm getting the correct security with your change from UK to L. |
@dickwolff you are completely right. Sorry for my mistake.
|
No problem @rubengr. I will investigate further and let you know what i find! |
@rubengr The tool broke on some records (I think related to CFD) that were not supported previously. I added them to the tool and your export is processed successfully! I had some issues with rate limiting, but I have since added some checks to use cache more often and that is now also solved! The following changes have been made:
Please let me know if you agree with these, or if you find they need to change. Also I would appreciate if you can try to run the tool yourself and see if all works as expected! |
Sorry, yesterday I discarded my changes to include yours to test. These are the lines:
|
There was an issue with dividend for it only looking forward, so it took the tax record for the next dividend record. I changed this to look back as well, and also look for the Order ID to match (should be + 1 on the dividend record). This way it got the right tax record. Can you verify for me with this Docker image? |
@toffee Any chance you can test this today? Much appreciated! |
I've checkout the feat/Small-Fixes branch (this is the branch for #167) and there are still issues. The dividend and tax line seems to be ok now but there are other lines in csv that are not exported correctly. I'm testing with the following csv:
and for line 8 and 10 the quantity and unitPrice are null (maybe because the quantity is a fraction: 16/16.7399!?)
|
@toffee It seems that those 2 are partial order fills. When you sum them, the total becomes 16.7399. I updated the code to take the part before the The example above can be processed, seems to be valid and can be uploaded to my Ghostfolio instance. Can you verify as well with this Docker image, or running locally on the branch? |
Yes, now the export it's ok regarding partial order fill. Nice catch regarding free fund interest, but the implementation I'm not sure it's the best one - I think it's better to have the same approach like for dividend and dividend tax: for two csv line to create only one line in export. Instead of
I think it's better to have (include fee, quantity and unitPrice):
|
I would agree, however at first glance it looks a bit more difficult then with dividend as the Order ID does not seem to be ascending; there is quite a gap between them, both on ID and on date time. |
Indeed, no correlation. I've look now into my XTB account and strange is that in some months there are two entries (interest and interest tax) and in other months there is only one entry (interest - probably tax is already deducted). And I saw even correction like:
|
@toffee I made the tax record lookup more dynamic and added a check for the comment to match. Now it combines the interest + interest tax into one, as well as the dividend ones. Edit: should the one above be interpreted as a fee then? |
Updates the code. Let me know if there are more bugs to be fixed. |
I've tested during your edits and initially I got INTEREST record
and afterwards I got FEE record as you mentioned in the second edit
but I'm not sure it's semantically correct - depends how XTB generates the csv export. Correction can be positive or negative (in this case it's positive) and (like for dividend) the XTB exports negative amount when it's tax. So in this case to consider a XTB csv positive value as fee I don't think it's correct. I think if the type of the csv is "Free funds interests" then the json object should have the type "INTEREST" (even if it's negative in case of correction of the interest). |
In principle I agree with above. I also agree that a positive free fund interest needs to be handled as regular interest for Ghostfolio. Then, based on what you said, a negative free fund interest would then mean you "have to pay" (because you got too much interest?). However Ghostfolio ignores the fee part on Interest records. So the only way to get around that, is to have the fee as a separate record. Otherwise you'd lose it. This is the same for the previous one that I added, that fee also gets lost if you don't keep it as 2 activities. See example below. I uploaded this JSON: {
"accountId": "3d287178-44d6-430b-a36b-566dc43fbcfb",
"comment": "Corr Free-funds Interest 2024-09",
"fee": 1.5,
"quantity": 1,
"type": "INTEREST",
"unitPrice": 1.5,
"currency": "EUR",
"dataSource": "MANUAL",
"date": "2024-10-09T19:38:51+02:00",
"symbol": "Corr Free-funds Interest 2024-09"
} Which in Ghostfolio becomes: |
Ok, having this in Ghostfolio make sense to generate two json objects. Thanks for you effort you put into this project. |
Hi @dickwolff > export-to-ghostfolio@0.22.1 start
> tsx ./src/manual.ts xtb
[i] Starting Export to Ghostfolio v0.22.1
[i] Restored 7 ISIN-symbol pairs and 13 symbols from cache..
[i] Processing file using XTB converter
[i] Read CSV file. Start processing..
[i] █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 2% | ETA 309s | Duration: 8s | 17/765file:///C:/Users/Ruben/Downloads/Expo1var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});impor.
TypeError: Cannot read properties of null (reading '1')
at <anonymous> (c:\Users\Ruben\Downloads\Export-To-Ghostfolio\src\converters\xtbConverter.ts:122:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v20.11.0
npm notice
npm notice New major version of npm available! 10.4.0 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice Run npm install -g npm@11.0.0 to update!
npm notice |
yes i'm using xtb-add-dividend branch |
Sorry, that branch has been merged to main. I created a new one: |
|
I will check! |
I see some issues with dividend without tax. That is fixed. @rubengr I also see type Edit: the data scheme looks most similar to a dividend action, so I added it as such. |
No, it's when a new company is created. I think should be a buy with 0.00€ or sell if is a sell action. But in this case i just export the dividends and don't see the spinoff. Which line is this spinoff? Could be dividends related to the spinoff company. |
Your original file (2 back, called xStation5_cashOperations.csv) contained records like these:
I am familiar with spin offs. However there are no buy records associated to this. So in this case I think you got paid in cash instead of stocks? |
Yes it is. I have checked again and you are right. |
Hi, have you fixed spin off? |
Should be in 0.23.1 and forwards. So latest main should have it. |
Hi
I'm testing you code, but get this error:
The text was updated successfully, but these errors were encountered: