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

Add Margin support #64

Closed
wants to merge 5 commits into from
Closed

Add Margin support #64

wants to merge 5 commits into from

Conversation

scientes
Copy link
Contributor

@scientes scientes commented Aug 16, 2021

This needs to be tested further

closes #52

and i'm not sure if the gain/loss calculation is 100% correct because i'm not sure if we'd need to make seperate balance counters for margin and spot, but seperating those would be a major hassle

@scientes
Copy link
Contributor Author

due it now seperating losses form gains this should be fine because now tist is seperated from spot gains

@scientes scientes marked this pull request as ready for review August 31, 2021 18:25
@provinzio
Copy link
Owner

provinzio commented Aug 31, 2021

I am not that familiar with the taxation of margin trades. But aren't these CFD? And CFD are taxed with "Kapitalertragssteuer" (25%)?

Plead add an description/explanation on margin trade to the readme and cite a trustworthy source.

Beside that. Regarding your implementation. Why shouldn't we combine Operation.Buy with Operation.MarginBuy and Operation.Sell with Operation.MarginSell? It looks unnecessary to me, to keep the if cases separated.
And as far as I know "Sonstige Einkünfte aus Margin Trades" is no tax relevant category.

@scientes
Copy link
Contributor Author

scientes commented Aug 31, 2021

Accointing (a german online service for crypto taxation) lists profits and losses from margin trading in a seperate colummn.
https://accointing.com/de/crypto-tax-guide/de/was-wird-fur-das-finanzamt-benotigt

yes "Kapitalertragssteuer" (25%) apply here but losses from margin trading are complicated, so to help that both wins and losses are displayed seperately:

Verluste aus Kapitalerträgen, wie z.B. durch Margin Trading mit Kryptowährungen auf BitMex, können auch berücksichtigt werden. Allerdings ist hier der Verlustabzug ab dem 01.01.2020 aufgrund der neuen „Derivatesteuer“ nur noch sehr begrenzt möglich. Eine vertikale Verrechnung von Verlusten aus der Anlage KAP und der Anlage SO war auch schon vor der Gesetzesänderung aufgrund der Verlustabzugsbeschränkungen ausgeschlossen.

https://winheller.com/blog/verluste-bitcoin-kryptowaehrungen-steuererklaerung/

now that you say that the duplication does not make sense anymore, because at first i tried to seperate margin and spot but that doesn't work that well, but on the export the MarginBuy and sell does help differntiate a little especially for debugging

@scientes
Copy link
Contributor Author

scientes commented Aug 31, 2021

Should We maybe name it
Margin: Kapitalertragssteuer Gewinn
Margin: Kapitalertragssteuer Verlust ?

@provinzio
Copy link
Owner

Should We maybe name it
Margin: Kapitalertragssteuer Gewinn
Margin: Kapitalertragssteuer Verlust ?

I'd prefer if the taxation type is the same as the name from the tax report. We might additional information behint it to separate them for debugging and visitations purposes.

E.g. just "Sonstige Einkünfte" or "Sonstige Einkünfte: Margin Verlust"

@provinzio
Copy link
Owner

provinzio commented Aug 31, 2021

Accointing (a german online service for crypto taxation) lists profits and losses from margin trading in a seperate colummn.
https://accointing.com/de/crypto-tax-guide/de/was-wird-fur-das-finanzamt-benotigt

yes "Kapitalertragssteuer" (25%) apply here but losses from margin trading are complicated, so to help that both wins and losses are displayed seperately:

Verluste aus Kapitalerträgen, wie z.B. durch Margin Trading mit Kryptowährungen auf BitMex, können auch berücksichtigt werden. Allerdings ist hier der Verlustabzug ab dem 01.01.2020 aufgrund der neuen „Derivatesteuer“ nur noch sehr begrenzt möglich. Eine vertikale Verrechnung von Verlusten aus der Anlage KAP und der Anlage SO war auch schon vor der Gesetzesänderung aufgrund der Verlustabzugsbeschränkungen ausgeschlossen.

https://winheller.com/blog/verluste-bitcoin-kryptowaehrungen-steuererklaerung/

now that you say that the duplication does not make sense anymore, because at first i tried to seperate margin and spot but that doesn't work that well, but on the export the MarginBuy and sell does help differntiate a little especially for debugging

Please check other sources too. Crypto taxation is quite a gray area. Whinheller might be a good start, but they might be too "Crypto friendly".

Summarize your findings in the readme.

@provinzio provinzio marked this pull request as draft September 5, 2021 10:27
@Griffsano
Copy link
Contributor

Griffsano commented Jan 6, 2022

Hey,

Winheller published an article in October that goes more into detail: https://winheller.com/blog/besteuerung-future-margin-trading/

Parallel dazu lassen sich die Überlegungen auf das Margin Trading übertragen, weshalb Gewinne aus Margin Trades immer nur dann unter Kapitaleinkünfte (§ 20 EStG) fallen, wenn keine Lieferung einer Kryptowährung, sondern ein Differenzausgleich durchgeführt wird. Kommt es hingegen zu einer Lieferung einer Kryptowährung, liegt ein privates Veräußerungsgeschäft gemäß § 23 Abs. 1 Satz 1 Nr. 2 EStG vor.

For my understanding that means if a margin position is closed, the gain/loss falls under income from capital (25%), and if a position is settled (you buy/sell the coin at the end with the starting price), you can treat it just as spot trades.

Additionally, according to the article, fees for futures may not be subtracted from the capital income, as they fall under "Werbungskosten" and are already covered by the standard deduction / "Pauschbetrag", and losses may only be considered up to 20k with the new regulation. In my opinion, this applies then to closed positions.

@provinzio
Copy link
Owner

provinzio commented Jan 7, 2022

Additionally, according to the article, fees for futures may not be subtracted from the capital income, as they fall under "Werbungskosten" and are already covered by the standard deduction / "Pauschbetrag", and losses may only be considered up to 20k with the new regulation. In my opinion, this applies then to closed positions.

We should still calculate the "Werbungskosten" in case the user has more expenses than the "Pauschbetrag".

Please update the README file with the Winheller explanation and a small text summarizing the findings.

@Griffsano
Copy link
Contributor

Hey @provinzio @scientes, I did more digging into the margin trading topic and summarized my findings in the readme:
https://github.com/Griffsano/CoinTaxman/blob/margin/README.md#future---margin-trading

It would be great if you could review and let me know if you have the same understanding concerning margin taxation. One point where I'm still unsure is if merely giving the investor the option of closing or settling a position already leads to a "Termingeschäft", or if this is decided when the trade is settled/closed. In the first case, we may need to add this to the summary:

Steht dem Investor offen, eine Margin-Position auszugleichen ("settle") oder zu schließen ("close"), liegt ein Termingeschäft vor

@provinzio
Copy link
Owner

provinzio commented Feb 18, 2022

Definition of a future ("Termingeschäft") from wikipedia.

My understanding of margin trades were that these are always CFDs ("Differentkontakte") and therefore are taxed as "Kapiteleinkünfte". Regardless of whether it is a future ("Termingeschäft").

The differentiation between a future trade and a normal trade irritates me. As far as I thought, regarding the taxation, it doesn't matter when the trade is fullfilled.

Edit: Margin trades are basically trades with borrowed capital. On stock exchanges, i only ever know margin trades in the form of CFDs. I am not aware of any other forms (like "normale trading" where you receive the goods)

Feel free to prove me wrong :)

@Griffsano
Copy link
Contributor

For the exchanges that I've seen, there's always a distinction between futures and margin trading. Compared to futures (with or without leverage), margin trading is spot trading with leverage. This is also what Kraken states:

Margin Trading allows you to make spot purchases and sales of cryptocurrencies, on the Kraken exchange, using funds that may exceed the balance of your account.

I'm pretty certain that (classical) "closed" margin trades (which lead to the payment of the difference in value) are per definition CFDs/"Differenzkontrakte" and therefore "Termingeschäfte" (similar to classical futures). This also agrees with multiple articles / forum threads.

For "settled" margin trades (that lead to the delivery of the asset for the base price, not the difference in value), it could be different (I also found this opinion in a couple of threads).
Argument 1 against "Termingeschäft": Wikipedia states that there needs to be a pre-defined point in the future:

Termingeschäfte (auch Zeitgeschäfte; englisch forward oder englisch future) sind Finanzkontrakte, bei denen sich die Vertragsparteien verpflichten, die gegenseitige Erfüllung (Zahlung und Lieferung) über mehr als zwei Handelstage hinaus auf einen vereinbarten Zeitpunkt zu verschieben.

For the exchanges I know, margin trades can be settled at any non-predefined point in time (for Kraken up to a duration of max. 365 days). This argument would also apply to "closed" margin trades, if they wouldn't already be CFDs.
Argument 2: Winheller differentiates between the delivery of the asset or the payment of the difference in value (they apply the same argumentation to futures btw):

Parallel dazu lassen sich die Überlegungen auf das Margin Trading übertragen, weshalb Gewinne aus Margin Trades immer nur dann unter Kapitaleinkünfte (§ 20 EStG) fallen, wenn keine Lieferung einer Kryptowährung, sondern ein Differenzausgleich durchgeführt wird. Kommt es hingegen zu einer Lieferung einer Kryptowährung, liegt ein privates Veräußerungsgeschäft gemäß § 23 Abs. 1 Satz 1 Nr. 2 EStG vor.

Argument 3: Accointing gives this example scenario:

Person A schließt mit Person B einen Vertrag, der A das Recht einräumt, in Zukunft einen BTC von B zu erhalten, der momentan 35.000 Euro wert ist. Wird der Kontrakt fällig und A erhält von B den BTC, liegt ein Fall von § 23 Abs. 1 Satz 1 Nr. 2 EStG vor. Das heißt für B, dass er die Veräußerung des BTC mit seinem persönlichen Einkommensteuersatz versteuern muss. Für A bedeutet das hingegen, dass eine Anschaffung vorliegt und damit die Jahresfrist gilt.

The example scenario on Accointing continues as follows:

Treffen A und B hingegen im oben geschilderten Fall die Vereinbarung, dass A am Ende des Vertrages die Wahl hat, ob er einen BTC bekommt oder alternativ den Gegenwert der Differenz zum aktuellen Kurs, dann liegt ein Termingeschäft gem. § 20 Abs. 2 Satz 1 Nr. 3 EStG vor.

At least for Kraken, the user has the option of "settling" (delivery of asset) or "closing" (difference in value) a margin trade, the decision is open until the end.

In summary, I arrive at this understanding:

  • If the user has the option of "closing" or "settling", it's a "Termingeschäft" -> Valid for all Kraken margin trades, not sure how it is handled on other exchanges. However, this is only supported by the Accointing example scenario.
  • Else, if the trade is "closed", it's a "Termingeschäft"
  • Otherwise, the trade is "settled" (the asset is delivered in the end), and it's a "privates Veräußerungsgeschäft"

@provinzio
Copy link
Owner

Ah ok. Sounds good. Thanks for the detailed explanation.

@provinzio
Copy link
Owner

Stale. Further worked on in #120

@provinzio provinzio closed this Jun 4, 2022
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

Successfully merging this pull request may close these issues.

[Feature Request] Add margin Trading
3 participants