-
Notifications
You must be signed in to change notification settings - Fork 36
Kraken Margin Trading #120
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
6371b45
4df06c6
c587456
4146d77
1c1622e
82dc726
c8eec27
f68171c
24d5b76
5f3f3b1
2ce428a
d5c2f5b
a3d980b
8434f60
c8f023a
013f7b2
f0345c2
6b6c5b4
ee16bd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,26 @@ class Sell(Transaction): | |
| selling_value: Optional[decimal.Decimal] = None | ||
|
|
||
|
|
||
| class MarginFee(Transaction): | ||
| """Fees for margin trading""" | ||
|
|
||
| pass | ||
|
|
||
|
|
||
| class MarginGain(Transaction): | ||
| """Gains from margin trading. | ||
| This is already a taxable value, no buy/sell calculation required.""" | ||
|
|
||
| pass | ||
|
|
||
|
|
||
| class MarginLoss(Transaction): | ||
| """Losses from margin trading. | ||
| This is already a taxable value, no buy/sell calculation required.""" | ||
|
|
||
| pass | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When possible, it might be nicer to have classes
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is that Kraken logs do not provide starts and closes of margins. Instead, the already computed gains or losses are logged. Therefore, we don't have to / can't compute the gains/losses ourselves. |
||
|
|
||
|
|
||
| class CoinLendInterest(Transaction): | ||
| pass | ||
|
|
||
|
|
@@ -682,6 +702,60 @@ def _labels(cls) -> list[str]: | |
| ] | ||
|
|
||
|
|
||
| class MarginReportEntry(TaxReportEntry): | ||
| event_type = "Margin-Trading" | ||
|
|
||
| def __init__( | ||
| self, | ||
| platform: str, | ||
| amount: decimal.Decimal, | ||
| utc_time: datetime.datetime, | ||
| coin: str, | ||
| interest_in_fiat: decimal.Decimal, | ||
| taxation_type: str, | ||
| remark: str, | ||
| ) -> None: | ||
| super().__init__( | ||
| first_platform=platform, | ||
| amount=amount, | ||
| first_utc_time=utc_time, | ||
| coin=coin, | ||
| first_value_in_fiat=interest_in_fiat, | ||
| is_taxable=True, | ||
| taxation_type=taxation_type, | ||
| remark=remark, | ||
| ) | ||
|
|
||
| @classmethod | ||
| def _labels(cls) -> list[str]: | ||
| return [ | ||
| "Börse", | ||
| "-", | ||
| # | ||
| "Anzahl", | ||
| "Währung", | ||
| # | ||
| "Erhalten oder ausgegeben am", | ||
| "-", | ||
| # | ||
| "-", | ||
| "-", | ||
| "-", | ||
| "-", | ||
| "-", | ||
| "-", | ||
| # | ||
| "-", | ||
| "-", | ||
| "-", | ||
| # | ||
| "Gewinn/Verlust in EUR", | ||
| "davon steuerbar in EUR", | ||
| "Einkunftsart", | ||
| "Bemerkung", | ||
| ] | ||
|
|
||
|
|
||
| class InterestReportEntry(TaxReportEntry): | ||
| event_type = "Zinsen" | ||
|
|
||
|
|
@@ -938,6 +1012,7 @@ def __init__( | |
| tax_report_entry_order = [ | ||
| BuyReportEntry, | ||
| SellReportEntry, | ||
| MarginReportEntry, | ||
| LendingInterestReportEntry, | ||
| StakingInterestReportEntry, | ||
| InterestReportEntry, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.