-
Notifications
You must be signed in to change notification settings - Fork 32
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
Detailed export #98
Detailed export #98
Conversation
also idea: save additional price calculation information to the db (price source, which other prices were used to calculate this pricepoint etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, to export all data into a file. Herer are my 2 cents. :)
You differentiate your taxation types with "außerhalb des Steuerjahres" and "steuerfrei". Shouldn't this be obvious from the class variables (op.utc_time
and is_taxable
).
We could therefore use the "base"-taxation type and add a transaction.TaxEvent-method, which combines the base taxation type with the timestamp and whether it is taxable.
# Conflicts: # src/config.py
Hey @provinzio, before we tackle deposits and withdrawals (#4), I'd like to finish this PR as merging will get a mess otherwise. |
Hey @Griffsano, I fixed two things (see fix commits) and removed the casefold comparison of the FIAT string as this isn't done anywhere else. I believe, that the casefold comparison might be better, but we should do this at all times and not only at the end in the evaluation phase. :) Feel free, to update all FIAT comparisons, maybe with a neat comparison function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Griffsano,
me again. I tested the code further and realized that we should tackle some more critical things before we can merge this.
- The variable
TaxEvent.taxed_gain
is currently used in multiple ways and because of that the printed evaluation at the end (print_evaluation
) is wrong.
I intended to use TaxEvent.taxed_gain
as the gain which is tax relevant in a specific config.TAX_YEAR
(see evaluate_sell
).
We can use TaxEvent.real_gain
to track real gains, besides tax relevant gains (e.g. a sell of multiple coins is only partial tax relevant)
In hindsight, this makes TaxEvent.is_taxable
kind of unrelevant. Do we need this at all, when we can use taxed_gain
and real_gain
?
I think that we should drop TaxEvent.is_taxable
and stick to the two decimals taxed_gain
and real_gain
.
If we want to stick with TaxEvent.is_taxable
we should make this a property self.taxed_gain != 0
.
- I do not see the point in distinguishing between e.g. "Einkünfte" and "Einkünftige außerhalb des Steuerjahres". Why do we need that? All of them are (in this case) "Einkünfte", some have
taxed_gains
and some don't.
If we want to analysize our tax events and split them by arbitrary factors (like is in tax year
) we should do this in my opinion afterwards.
Could you please explain this once more?
op, | ||
is_taxable, | ||
sell_value, | ||
real_gain, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taxed_gain
and real_gain
are summed up in the loop. The variables do not represent the taxed_gain
oder real_gain
of a single transaction.
taxation_type = "Verkauf (außerhalb des Steuerjahres)" | ||
tx = transaction.TaxEvent( | ||
taxation_type, decimal.Decimal(), op, False | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evaluate_sell
shouldn't return None if we want to export all events. evaluate_sell
should calculate the real_gain
, which currently missing.
I'm not certain how the best way would be to implement this. To try it out, I made a new
Similarly, if I overload
Sure, we could create a custom class and overload all operators until everything is working again, but my worry is 1) this is a lot of work and 2) we can still miss something that leads to unintended behavior. Or did I do something wrong when overloading the operator? What do you think? |
Regarding Regarding "außerhalb des Steuerjahres":
But yes, we could also do this afterwards, would probably be cleaner. I'll think of something. Another thing: We discussed the separation of balancing and tax evaluation (#4), do you also want to do this within this PR or a new one? |
price = self.price_data.get_price(op.platform, op.coin, op.utc_time) | ||
remark = ( | ||
f"Kosten {cost} {config.FIAT}, " | ||
f"Preis {price} {op.coin}/{config.FIAT}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing it this way still confuses me^^
I know it's how the charts are named, but mathematically it should be the other way around :D
Can we write it f"Preis {price} {op.coin}-{config.FIAT}"
or f"Preis ({op.coin}/{config.FIAT}) {price}"
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mathematically... well, depending what you see.
If it is a division BTC/EUR, its 1 BTC per 1 EUR. So 2 BTC/EUR would mean, that I can buy 2 BTC for 1 EUR.
If it is "a unit mark" (dunno how this is named, often used as graph notation) BTC/EUR or writing like I painted in the picture below or I would write it as "BTC [EUR]" means, BTC in the unit of EUR. So 2 BTC/EUR means 1 BTC is the same as 2 EUR
Writing this "Money in EUR" with a forwardslash like Money/€ does confuse me too, but this is the way 🤷 Especially when both symbols a units by itself like km/m (which would always be 1000) or BTC/EUR. I'd perfer BTC [EUR] but no one does that, so I'd suggest we stay with the most common notation.
I did just a quick test and saw, that my |
regarding #98 (comment) you are correct, I thought we'd already use a fiat class, but we actually only use the fiat class for selection and convert the fiat variable to string. In that case, I'd think about extending the class |
think of it like this
We can indeed drop the boolean
I am actually not sure, if we want to do that. This report is meant for tax authorities regarding your tax declaration in a speicifc year. Why would you want to add things to the declaration, which didn't happen in that year. If you need this analysis for something else, we should add a config variable or write this to a separated csv file. Not the main report file. If you want to show all transactions (for different years), run multiple tax evaluations for specific years.
I think that tax evaluation without building up a balancing queue is difficult or that otherwhise evaluating the balancing queue is the tax evaluation. If you would want to separated the queue generation you would have to save the whole process (what is when added/removed...) so that you can calculate the taxes. What I meant in #4 is, that we need to balance to determine which coins gets withdrawn exactly. It would be possible otherwhise. As we need balancing for tax evaluation, too, ... I'd rather keep it together. Doing everything twice (balancing everything twice) seems unnecessary. |
I do also require a more detailed export for my tax declaration, which will look somewhat different from what we export right now. We might collide a lot, working on this at the same time. I am sorry for that :x As a heads up, I though of something like this. You might be more interest in this kind of export, too. I'll try to refactor your ideas in my approach. Have a look at the branches |
Thanks for your detailed comments. I like the examples for the detailed report. |
I'll close this for now. Feel free to reopen at any time. #4 might be a good next issue, even though the detailed export is still in progress. Matching deposit/withdrawals before the fee matching looks neccessary to me, to accomplish a complete and correct tax report (see |
This is a draft for the detailed CSV export that contains all events (not only taxable ones).
@provinzio Thanks for your tips on how to approach this, they helped a lot.
As suggested, I added a boolean
is_taxable
toTaxEvent
. Based on the new config settingEXPORT_ALL_EVENTS
, either all or only taxable events are exported.Additionally, with the new setting
EXPORT_VIRTUAL_SELL
, the virtual sells can also be exported to the CSV.I also renamed some variables to avoid confusion between price and value, and added the platform to the export.
@scientes Tagging you since you were also interested in this feature.
Let me know what you think of it. Thanks! :)
Closes #94, closes #95