Calculate your taxes from cryptocurrency gains

Overview

PULL REQUESTS are appreciated.

English

CoinTaxman helps you to bring your income from crypto trading, lending, ... into your tax declaration. At the moment CoinTaxman only covers my area of ​​application. Pull requests and requests via issues are welcome (see Key notes for users for more information).

German - Deutsch

CoinTaxman hilft dir dabei deine Einkünfte aus dem Krypto-Handel/-Verleih/... in die Steuererklärung zu bringen. Momentan deckt der CoinTaxman nur meinen Anwendungsbereich ab. Pull Requests und Anfragen über Issues sind gerne gesehen (siehe Key notes for users für weitere Informationen).

Disclaimer: use at your own risk

Currently supported countries

  • Germany

Currently supported exchanges

  • Binance
  • coinbase

Requirements

  • Python 3.9
  • See requirements.txt for the required modules. Quick and easy installation can be done with pip.

pip install -r requirements.txt

Usage

  1. Adjust src/config.py to your liking
  2. Add account statements from supported exchanges in account_statements/
  3. Run python "src/main.py"

Have a look at our Wiki for more information on how to obtain the account statement for your exchange.

Supporting the development

Please consider supporting the development of this tool by either using my Binance referral link if you want to create an account there or by donating to one of the adresses below.

BTC: 1AZMdztmZ8yZFDb5sdbWNp1wPT8gvvigwp

ETH: 0x4868d10b8bc347b374300a7b924e3ffdf937ea0f

Key notes for users

Requesting a new country

I would like to extend my tool for international usage. However, the chances are high that I am unfamiliar with the local conditions neither able to speak the language. I would not want to program the logic for something I can not look up properly. Because in general and especially when it comes to state affairs, I prefer to look at the primary source.

I am happy to implement your input or support you with the implementation. You can help by specifying detailed information about the taxation of crypto currency in the requested country. Information I require are for example

  • Country fiat (well that is easy... I might be able to figure it out by myself)
  • Taxation of crypto sells
  • Taxation from crypto lending
  • Taxation of airdrops
  • Are there special periods after which the sell is tax free?
  • ...

Not every aspect has to be implemented directly. We are free to start by implementing the stuff you need for your tax declaration.

I am looking forward to your issue. Your country was already requested? Hit the thumbs up button of that issue or participate in the process.

Requesting a new exchange

The crypto world is huge and so is the amount of available exchanges out there. I would love to make this tool as useful as possible for as many of you.

I am happy to implement your input or support you with the implementation. Please provide an example account statement for the requested exchange or some other kind of documentation.

Are you already familiar with the API of that exchange or know some other way to request historical prices for that exchange? Share your knowledge.

I am looking forward to your issue. Your exchange was already requested? Hit the thumbs up button of that issue or participate in the process.

Key notes for developers

Adding a new country

  • Add your country to the Country enum in src/core.py
  • Extend src/config.py to fit your tax regulation
  • Add a country specific tax evaluation function in src/taxman.py like Taxman._evaluate_taxation_GERMANY
  • Depending on your specific tax regulation, you might need to add additional functionality and might want to add or edit the enums in src/core.py

Adding a new exchange

  • Add a read-in function like Book._read_binance in src/book.py
  • Add a way to retrieve price data from this exchange in src/price_data.py like PriceData._get_price_binance

Ideas on crypto-taxation

The taxation of cryptocurrency is probably not yet regulated down to the smallest detail in every country. Often there still seem to be ambiguities or gray areas. This section should help you to dig deeper into the subject. Feel free to commit details about the taxation in your country.

Taxation in Germany

Meine Interpretation rund um die Besteuerung von Kryptowährung in Deutschland wird durch die Texte von den Rechtsanwälten und Steuerberatern WINHELLER sehr gut artikuliert. Meine kurzen Zusammenfassungen am Ende von jedem Abschnitt werden durch einen ausführlicheren Text von WINHELLER ergänzt.

An dieser Stelle sei explizit erwähnt, dass dies meine Interpretation ist. Es ist weder sichergestellt, dass ich aktuell noch nach diesen praktiziere (falls ich das Repo in Zukunft nicht mehr aktiv pflege), noch ob diese Art der Versteuerung gesetzlich zulässig ist. Meine Interpretation steht gerne zur Debatte.

Allgemein

Kryptowährungen sind kein gesetzliches Zahlungsmittel. Vielmehr werden sie – zumindest im Ertragsteuerrecht – als immaterielle Wirtschaftsgüter betrachtet.

Wird der An- und Verkauf von Kryptowährungen als Privatperson unternommen, sind § 22 Nr. 2, § 23 Abs. 1 Nr. 2 EStG einschlägig. Es handelt sich hierbei um ein privates Veräußerungsgeschäft von „anderen Wirtschaftsgütern“. Gemäß § 23 Abs. 3 Satz 1 EStG ist der Gewinn oder Verlust der Unterschied zwischen Veräußerungspreis einerseits und den Anschaffungs- und Werbungskosten andererseits. Es muss also nur der Anschaffungspreis vom Veräußerungspreis abgezogen werden. Die Gebühren beim Handel auf den Börsen sind Werbungskosten und damit abzugsfähig.

In § 23 Abs. 3 Satz 5 EStG ist zudem eine Freigrenze von 600 € vorgesehen, bis zu deren Erreichen alle privaten Veräußerungsgeschäfte des Veranlagungszeitraums steuerfrei bleiben. Wird die Grenze überschritten, muss allerdings der gesamte Betrag ab dem ersten Euro versteuert werden. Die Einkommensteuer fällt dabei nicht erst beim Umtausch von Kryptowährungen in Euro oder eine andere Fremdwährung an, sondern bereits bei einem Tausch in eine beliebige andere Kryptowährung oder auch beim Kauf von Waren oder Dienstleistungen mit einer solchen. Vergeht aber zwischen Anschaffung und Veräußerung mehr als ein Jahr (ggf. zehn Jahre nach § 23 Abs. 1 Nr. 2 Satz 4 EStG), greift die Haltefrist des § 23 Abs. 1 Nr. 2 Satz 1 EStG. In diesen Fällen ist der gesamte Veräußerungsgewinn nicht steuerbar.

Zur Bestimmung der Anschaffungskosten und des Veräußerungsgewinns sowie zur Bestimmung der Einhaltung der Haltefrist wird in der Regel die sogenannte FIFO-Methode aus § 23 Abs. 1 Nr. 2 Satz 3 EStG herangezogen. Zwar schreibt das Gesetz diese First-In-First-Out-Methode nicht für Kryptowährungen vor, in der Praxis wird sie aber weitgehend angewendet. Es werden allerdings auch andere Meinungen vertreten und eine Berechnung nach der LIFO-Methode oder – zur Bestimmung der Anschaffungskosten – nach Durchschnittswerten vorgeschlagen.

Quelle [Wörtlich zitiert vom 14.02.2021]

Zusammenfassung in meinen Worten:

  • Kryptowährung sind immaterielle Wirtschaftsgüter.
  • Der Verkauf innerhalb eines Jahres gilt als privates Veräußerungsgeschäft und ist als Sonstiges Einkommen zu versteuern (Freigrenze 600 €).
  • Der Tausch von Kryptowährung wird ebenfalls versteuert.
  • Gebühren zum Handel sind steuerlich abzugsfähig.
  • Es kann einmalig entschieden werden, ob nach FIFO oder LIFO versteuert werden soll.

Airdrops

Im Rahmen eines Airdrops erhält der Nutzer Kryptowährungen, ohne diese angeschafft oder eine sonstige Leistung hierfür erbracht zu haben. Die Kryptowährungen werden nicht aus dem Rechtskreis eines Dritten auf den Nutzer übertragen. Vielmehr beginnen sie ihre „Existenz“ überhaupt erst in dessen Vermögen. Die Kryptowährung entsteht direkt in den Wallets der Nutzer, wobei die Wallets bestimmte Kriterien erfüllen müssen. Airdrops ähneln insofern einem Lottogewinn oder einem Zufallsfund (sog. Windfall Profits).

Mangels Anschaffungsvorgangs kommt bei einer anschließenden Veräußerung eine Besteuerung nach § 23 Abs. 1 Nr. 2 Einkommensteuergesetz (EStG) nicht in Betracht. Mangels Leistungserbringung seitens des Nutzers liegen auch keine sonstigen Einkünfte i.S.d. § 22 Nr. 3 EStG vor. Damit ist der Verkauf von Airdrops steuerfrei.

Quelle [Wörtlich zitiert vom 14.02.2021]

Zusammenfassung in meinen Worten:

  • Erhalt und Verkauf von Airdrops ist steuerfrei.

Coin Lending

Handelt es sich bei den durch Krypto-Lending erhaltenen Zinserträgen um Einkünfte aus sonstigen Leistungen gem. § 22 Nr. 3 EStG, so gilt eine Freigrenze von 256 Euro. Beträge darüber werden mit dem perönlichen Einkommensteuersatz von 18 bis 45 % versteuert. Außerdem wäre die spätere Veräußerung gem. § 23 Abs. 1 Nr. 2 EStG der durch das Lending erlangten Kryptowährung mangels Anschaffungsvorgangs nicht steuerbar.

In Deutschland ist die Besteuerung der durch das Krypto-Lending erhaltenen Zinsen jedoch nicht abschließend geklärt. Zum einem wird diskutiert, ob es sich dabei um Kapitaleinkünfte gem. § 20 Abs. 1 Nr. 7 EStG handelt, da es sich bei der Hingabe der Kryptowährung um ein klassisches, verzinsliches Darlehen handelt. Anderseits wird von Finanzämtern immer wieder angenommen, dass es sich bei den erzielten Zinserträgen durch Lending um Einkünfte aus sonstigen Leistungen gem. § 22 Nr. 3 EStG handelt.

Die erhaltene Kryptowährung in Form von Zinsen ist im Zeitpunkt des Zuflusses zu bewerten. Es handele sich deshalb nicht um Kapitaleinkünfte, da die Hingabe der Kryptowährung gerade keine Hingabe von Kapital, sondern vielmehr eine Sachleistung darstelle. Begründet wird dies damit, dass sich eine Kapitalforderung auf eine Geldleistung beziehen muss, nicht aber auf eine Sachleistung, wie es bei Kryptowährungen der Fall ist.

Kontrovers diskutiert wird auch, ob der Verleih einer Kryptowährung zu einer Verlängerung der Haltefrist nach § 23 Abs. 1 Nr. 2 Satz 4 EStG führt. Eine Verlängerung der Haltefrist tritt danach nur dann ein, wenn ein Wirtschaftsgut

  • nach dem 31.12.08 angeschafft wurde,
  • als Einkunftsquelle genutzt wird und
  • damit Einkünfte erzielt werden. Unter Nutzung als Einkunftsquelle ist zu verstehen, dass die betroffenen Wirtschaftsgüter eine eigenständige Erwerbsgrundlage bilden. Maßgeblich ist also die Frage, ob mit der Kryptowährung Einkünften erzielt werden.

Beim Lending werden jedoch in der Regel keine Einkünfte aus dem Wirtschaftsgut (der Kryptowährung), sondern aus dem Verleihgeschäft erzielt (als Ertrag aus der Forderung). Weil in diesen Fällen kein Missbrauch vorliegt, kann es bei der Haltefrist von einem Jahr bleiben. Auch das Bayrische Landesamt für Steuern hat bestätigt, dass die erhaltenen Zinsen nicht Ausfluss des „anderen Wirtschaftsgutes Fremdwährungsguthaben“, sondern vielmehr Ausfluss der eigentlichen Kapitalforderungen sind.

Quelle [Wörtlich zitiert vom 14.02.2021]

Zusammenfassung in meinen Worten:

  • Erhaltene Kryptowährung durch Coin Lending wird im Zeitpunkt des Zuflusses als Einkunft aus sonstigen Leistungen versteuert (Freigrenze 256 €).
  • Der Verkauf ist nicht steuerbar.
  • Coin Lending beeinflusst nicht die Haltefrist der verliehenen Coins.

Staking

Ebenso [wie beim Coin Lending] verhält es sich bei Kryptowährungen, die für Staking oder Masternodes genutzt werden. Nutzer müssen bei proof-of-stake-basierten Kryptowährungen oder beim Betreiben von Masternodes einen bestimmten Teil ihrer Kryptowährung der Verfügungsmacht entziehen und dem Netzwerk als Sicherheit bereitstellen. Die Sicherheit des Netzwerkes wird dadurch gewährleistet, dass regelwidriges Verhalten den dem Verlust der Sicherheitsleistung (Kryptowährung) zur Folge hat. Auch in diesen Fällen werden keine Einkünfte aus dem Wirtschaftsgut selbst, sondern für das Blockieren der Verfügungsmacht, also als Ertrag aus der Forderung, erzielt. Auch hier bleibt es bei der Haltefrist von einem Jahr.

Quelle [Wörtlich zitiert vom 19.02.2021]

Zusammenfassung:

  • siehe Coin Lending

Kommission (Referral System)

Wenn man denkt, dass man den Steuerdschungel endlich durchquert hat, kommt Binance mit seinem Referral System daher. Über das Werbungs-System erhält man einen prozentualen Anteil an den Trading-Gebühren der Geworbenen auf sein Konto gutgeschrieben. (lebenslang, logischerweise in BTC.) Es ist also keine typische Kunden-werben-Kunden-Prämie sondern eher eine Kommission und damit bin ich mir unsicher, wie das einzuordnen ist.

Für das Erste handhabe ich es wie eine Kunden-werben-Kunden-Prämie in Form eines Sachwerts. Sprich, die BTC werden zum Zeitpunkt des Erhalts in ihren EUR-Gegenwert umgerechnet und den Einkünften aus sonstigen Leistungen hinzugefügt. Aufgrund eines fehlenden steuerlichen Anschaffungsvorgangs ist eine Veräußerung steuerfrei.

Comments
  • [bug] Not enough BNB in queue to sell

    [bug] Not enough BNB in queue to sell

    2021-08-15 12:06:36,024 book INFO Reading file from exchange binance at X:\CoinTaxman-main\account_statements\part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv 2021-08-15 12:06:36,180 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv:2584: Withdraw fee is included. 2021-08-15 12:06:37,588 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv:26726: Withdraw fee is included. 2021-08-15 12:06:37,588 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv:26754: Withdraw fee is included. 2021-08-15 12:06:37,728 book INFO Reading file from exchange binance at X:\CoinTaxman-main\account_statements\part-00000-21a78b20-5388-477e-be15-b0617f4cb439-c000.csv 2021-08-15 12:06:38,102 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-21a78b20-5388-477e-be15-b0617f4cb439-c000.csv:6259: Withdraw fee is included. 2021-08-15 12:06:38,102 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-21a78b20-5388-477e-be15-b0617f4cb439-c000.csv:6260: Withdraw fee is included. 2021-08-15 12:06:38,102 book WARNING I may have missed a remark in X:\CoinTaxman-main\account_statements\part-00000-21a78b20-5388-477e-be15-b0617f4cb439-c000.csv:6261: Withdraw fee is included. 2021-08-15 12:06:38,682 book INFO Reading file from exchange binance at X:\CoinTaxman-main\account_statements\part-00000-fc60df31-720b-487d-8fe5-e37f5b43deeb-c000.csv 2021-08-15 12:06:38,682 taxman DEBUG Starting evaluation... 2021-08-15 12:06:38,870 taxman ERROR part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv: Line 545: Not enough BNB in queue to sell (transaction from 2021-03-19 08:44:39+00:00 on binance) This error occurs if your account statements have unmatched buy/sell positions. Have you added all your account statements of the last years? This error may also occur after deposits from unknown sources.

    Traceback (most recent call last): File "X:\CoinTaxman-main\src\main.py", line 44, in main() File "X:\CoinTaxman-main\src\main.py", line 38, in main taxman.evaluate_taxation() File "X:\CoinTaxman-main\src\taxman.py", line 194, in evaluate_taxation self.__evaluate_taxation(coin, operations) File "X:\CoinTaxman-main\src\taxman.py", line 109, in _evaluate_taxation_GERMANY raise RuntimeError RuntimeError

    2021-03-19 08:12:34,Spot,Transaction Related,BNBUP,-0.14000000,"" 2021-03-19 08:12:34,Spot,Fee,BNB,-0.00022759,"" 2021-03-19 08:12:34,Spot,Buy,USDT,79.92600000,"" 2021-03-19 08:44:39,Spot,Buy,BTC,0.00208771,"" 2021-03-19 08:44:39,Spot,Fee,BNB,-0.00034544,"" 2021-03-19 08:44:39,Spot,Transaction Related,BNB,-0.46000000,"" 2021-03-19 09:04:33,Spot,Transaction Related,BTCUP,-0.01000000,"" 2021-03-19 09:04:33,Spot,Transaction Related,BTCUP,-3.28000000,"" 2021-03-19 09:04:33,Spot,Fee,BNB,-0.00175041,"" 2021-03-19 09:04:33,Spot,Buy,USDT,620.02496000,"" 2021-03-19 09:04:33,Spot,Buy,USDT,1.89032000,"" 2021-03-19 09:04:33,Spot,Fee,BNB,-0.00000533,""

    I tried manually to fake a BNB deposit in this history to try to fix this error:

    UTC_Time,Account,Operation,Coin,Change,Remark 2021-02-11 08:57:34,Spot,Deposit,BNB,1.10664599,"" 2021-02-11 13:20:51,Spot,Commission History,BNB,0.00002547,"" 2021-02-11 18:32:00,Spot,Commission History,BNB,0.00003643,"" 2021-02-12 13:01:54,Spot,Commission History,BNB,0.00001155,""

    however this was unsuccesful:

    2021-08-15 12:16:03,675 taxman ERROR part-00000-154c5b63-ff2c-4615-9ed2-4d89319596e4-c000.csv: Line 546: Not enough BNB in queue to sell (transaction from 2021-03-19 08:44:39+00:00 on binance)

    Is there a fix for this bug or do you have some suggestions, what i can try?

    opened by igi01 35
  • Resolve Withdrawals/Deposits

    Resolve Withdrawals/Deposits

    Closes https://github.com/provinzio/CoinTaxman/issues/4

    Dependencies that should be finished first

    • [ ] Close PR https://github.com/provinzio/CoinTaxman/pull/98: This PR contains many changes in the balancing/taxation loop. Merging would be easier if this is done first. Once we separate balancing and taxation in two loops, we might get many merge conflicts and have to resolve them manually . However, not strictly required.

    To-do list

    • [ ] Split up balancing and taxation in two different loops
    • [ ] Add additional variable acquire_platform or similar to operations
    • [ ] Change price fetching logic accordingly (use the correct acquire_platform or platform)
    • [ ] Implement read-in of config files to match withdrawals and deposits (similar to https://github.com/provinzio/CoinTaxman/pull/115)
    • [ ] Resolve deposits and withdrawals based on matching file
    • [ ] Move coins between platforms, balancing for each platform (happens before taxation)
    opened by Griffsano 25
  • New exchange: Bitpanda Pro

    New exchange: Bitpanda Pro

    I was in the process of writing a Python script for myself when I was pointed here.

    I'd like to import data from the "Bitpanda Pro" exchange. I'd be willing to submit a PR, once I get familiar with the codebase.

    The API documentation is provided here: https://developers.bitpanda.com/exchange/. The API endpoint for trades is https://developers.bitpanda.com/exchange/#all-trades

    The returned data contains the fee separately, that is, the trade is given without the fee. The API uses pagination. If the 'cursor' entry is in the JSON data, there's more data.

    Sample data for trades:

    {'cursor': 'base64data',
     'max_page_size': 5,
     'trade_history': [{'fee': {'collection_type': 'BEST',
                                'fee_amount': 'XXX',
                                'fee_currency': 'BEST',
                                'fee_group_id': 'default',
                                'fee_percentage': '0.08',
                                'fee_type': 'MAKER',
                                'running_trading_volume': 'XXX'},
                        'trade': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'amount': 'XXX',
                                  'instrument_code': 'PAN_EUR',
                                  'order_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'price': 'XXX',
                                  'price_tick_sequence': 0,
                                  'sequence': 1663784546,
                                  'side': 'SELL',
                                  'time': '2021-04-22T00:00:00.000000Z',
                                  'trade_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}},
                       {'fee': {'collection_type': 'BEST',
                                'fee_amount': 'XXX',
                                'fee_currency': 'BEST',
                                'fee_group_id': 'default',
                                'fee_percentage': '0.08',
                                'fee_type': 'MAKER',
                                'running_trading_volume': 'XXX'},
                        'trade': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'amount': 'XXX',
                                  'instrument_code': 'PAN_EUR',
                                  'order_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'price': 'XXX',
                                  'price_tick_sequence': 0,
                                  'sequence': 1663783772,
                                  'side': 'SELL',
                                  'time': '2021-04-22T00:00:00.000000Z',
                                  'trade_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}},
                       {'fee': {'collection_type': 'BEST',
                                'fee_amount': 'XXX',
                                'fee_currency': 'BEST',
                                'fee_group_id': 'default',
                                'fee_percentage': '0.12',
                                'fee_type': 'TAKER',
                                'running_trading_volume': 'XXX'},
                        'trade': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'amount': 'XXX',
                                  'instrument_code': 'LTC_EUR',
                                  'order_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'price': 'XXX',
                                  'price_tick_sequence': 0,
                                  'sequence': 1663679815,
                                  'side': 'BUY',
                                  'time': '2021-04-22T00:00:00.000000Z',
                                  'trade_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}},
                       {'fee': {'collection_type': 'BEST',
                                'fee_amount': 'XXX',
                                'fee_currency': 'BEST',
                                'fee_group_id': 'default',
                                'fee_percentage': '0.12',
                                'fee_type': 'TAKER',
                                'running_trading_volume': 'XXX'},
                        'trade': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'amount': 'XXX',
                                  'instrument_code': 'BEST_EUR',
                                  'order_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'price': 'XXX',
                                  'price_tick_sequence': 0,
                                  'sequence': 1663674738,
                                  'side': 'BUY',
                                  'time': '2021-04-22T00:00:00.000000Z',
                                  'trade_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}},
                       {'fee': {'collection_type': 'STANDARD',
                                'fallback_reason': {'best_balance': {'available': 'XXX',
                                                                     'locked': 'XXX',
                                                                     'needed': 'XXX'},
                                                    'caused_by': 'INSUFFICIENT_FUNDS'},
                                'fee_amount': 'XXX',
                                'fee_currency': 'EUR',
                                'fee_group_id': 'default',
                                'fee_percentage': '0.15',
                                'fee_type': 'TAKER',
                                'running_trading_volume': 'XXX'},
                        'trade': {'account_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'amount': 'XXX',
                                  'instrument_code': 'ETH_EUR',
                                  'order_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                                  'price': 'XXX',
                                  'price_tick_sequence': 0,
                                  'sequence': 1663646554,
                                  'side': 'SELL',
                                  'time': '2021-04-22T00:00:00.000000Z',
                                  'trade_id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}}]}
    

    I don't know how fees are handled in regards to taxation, though.

    In regards to historical price data, the relevant API endpoints seem to be either https://developers.bitpanda.com/exchange/#price-ticks-for-instrument or https://developers.bitpanda.com/exchange/#candlesticks (?)

    opened by uvok 22
  • Parsing fails when change is equal to

    Parsing fails when change is equal to "0E-X"

    When change is in scientific notation, for example "0E-8", the assertion fails (book.py, line 112). This does only occur when binance produces these strange 0E-X outputs.

    bug 
    opened by jhoogstraat 18
  • Resolve deposits and withdrawls

    Resolve deposits and withdrawls

    Foreign currency/coin deposits have to match withdrawls from another exchange. Otherwhise the program is not able to calculate the tax gains properly.

    Furthermore we have to resolve deposits and withdrawals between the exchanges to correctly evaluate the taxation (#86).

    We should check this in between the book read-in and the evaluation nd raise a warning or an exception.

    • [x] Find matching withdrawals and deposits or raise a warning
    • [x] Resolve withdrawals/deposits from one exchange to another with FIFO/LIFO principle (according to config): Move transactions from the withdrawal-exchange to the deposit-exchange by changing operations.platform. Transactions might have to be splitted for this.

    Adressed in https://github.com/provinzio/CoinTaxman/tree/4-resolve-deposits

    good first issue Book 
    opened by provinzio 17
  • calculate prices from csv

    calculate prices from csv

    This pr does 4 Things:

    1. updates the year to 2021
    2. All values are now stored as str in db to prevent floating point bugs in the future (there is no decimal in sqlite)
    3. Tablenames are now Alphabeticaly sorted ETH/BNB -> BNB/ETH and converted to prevent two tables being created for the same pair
    4. If there are two timestamps from the same platform the price between them is calculated when one is a buy operation and the other is a sell operation (#50)
    opened by scientes 15
  • Add more binance csv operations

    Add more binance csv operations

    binance has some products which are not yet implemented fully: https://www.binance.com/de/earn#flex-item

    For Example binance has a product called bnb vault and launchpool which generate some interesting statement currently not implemented: https://launchpad.binance.com/ here is one from tests (bnb vault):

    2021-03-18 01:02:29,Spot,Super BNB Mining,ALICE,0.00006904,""
    

    should we count that as normal staking?

    ill test it some more to generate statement we currently do not know

    opened by scientes 14
  • Kraken: Action Types in CSV Exports

    Kraken: Action Types in CSV Exports

    This PR addresses #97 (but does not resolve all points mentioned in the issue).

    @oldgitdaddy Feel free to use this version for your Kraken exports. Let me know if you run into any problems. If you have trades in USD, you can add this line in kraken_pair_map in core.py:

        "USDEUR": "USDTEUR",
    

    The virtual sell feature may not work properly right now, so I recommend to disable CALCULATE_VIRTUAL_SELL in the config.ini. The problem is that no valid trades may be returned from the API for the current timestamp. Alternatively, a workaround for this is to use an older timestamp in https://github.com/provinzio/CoinTaxman/blob/main/src/taxman.py#L227.

    I introduced a new refids list to track duplicate deposits/withdrawals and the additional deposit/withdrawal entries for staking / unstaking / staking reward actions. By tracking the Ref-IDs, duplicate entries can also be correctly identified when e.g. multiple deposits arrive in a short period of time (I think "overlapping" deposits/withdrawals could have been a problem before). With this implementation, all first entries of deposits/withdrawals are ignored, and only the second entry leads to an operation. This way, the additional deposit/withdrawal lines for staking / unstaking / staking rewards are ignored.

    The question is which deposit/withdrawal to ignore for "real" deposit/withdrawal actions? The current approach in the main branch considers the events on the blockchain as taxable (first deposit / second withdrawal). However, this could lead to erroneous FIFO/LIFO calculations e.g. if trades occur during the deposits/withdrawals (see #57). As I understand, the assets are only available for trading after the second deposit and before the first withdrawal. @shredEngineer What do you think?

    opened by Griffsano 13
  • Unable to detect the exchange of file

    Unable to detect the exchange of file

    I get an "Unable to detect the exchange of file" when trying to start the program?

    My account_statement is from binance. Is there anything else apart from moving the CSV file to the account_statements folder that I need to do before starting?

    opened by tkso1997 13
  • Add Margin support

    Add Margin support

    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

    opened by scientes 13
  • Manage dependencies using pip-compile

    Manage dependencies using pip-compile

    ~This cleans up requirements.txt and requirements-dev.txt to only include direct dependencies of the project. I also used the opportunity to update the version constraints to allow updates up to the next major version. This can be reverted if requested. I don't see why we should not pull the latest patches automatically, though.~

    Edit: The direction of this pr changed and is now aimed at managing the dependencies better. The idea stems from here.

    opened by jhoogstraat 12
  • Add deposit when buying with fiat

    Add deposit when buying with fiat

    This adds a deposit operation when buying coins with fiat on coinbase. Also sets the platform from "coinbase_pro" to "coinbase" to remove issue regarding transfers between the two.

    Tracking issue: #138

    bug coinbase Book 
    opened by jhoogstraat 3
  • Transfers between Coinbase and Coinbase Pro not considered

    Transfers between Coinbase and Coinbase Pro not considered

    The reports from Coinbase and Coinbase Pro do not explicitly state transfers between the two. In case of MULTI_DEPOT being enabled, this leads to missing coins on either side.

    I am unsure whether the two can be considered as distinct exchanges at all. This hints at that they are not.

    Edit: Just saw that the Account statement on Coinbase Pro does include deposits and withdrawals. I think we should use that instead of the Fills statement. Doesn't fix the issue on the Coinbase side though.

    bug coinbase Book 
    opened by jhoogstraat 7
  • Resolve ops in edge cases

    Resolve ops in edge cases

    This is the pr for issue #135.

    It's not finished yet, but I wanted to allow for feedback early on.

    Implemented edge cases:

    • [x] Two pairs at a particular utc_time via a bridge coin
    • [ ] Orders not being fulfilled at once, leading to Buy/Sell ops later on (can this even happen? Buy/Sell come in pairs, no?)
    • [x] Commissions / Withdrawals / Deposits / Airdrop / CoinLendInterest not relevant for trade linking
    • [x] BNB small asset exchange at multiple utc_times (buy/sell 1 second apart for me)
    • [ ] Fees paid (partly) in BNB in the double_buy_sell_pair case

    Currently, the is_binance_bnb_small_asset_transfer case catches almost everything that was not handled by the other cases. I tried my best to make sure that only ops that really are small asset exchanges get handled (assert that the buy coin is BNB).

    Book 
    opened by jhoogstraat 6
  • trade and fee resolving edge cases

    trade and fee resolving edge cases

    resolve_trades currently only works when there is exactly one Buy and one Sell op for any particular utc_time. This leaves many cases unhandled, which could result in miscalculated gains. Here are four such cases:

    1. Multiple buy/sell-pairs at a particular utc_time
    2. Orders not being fulfilled at once, leading to Buy/Sell ops later on.
    3. Commissions / Withdrawals / Deposits / Airdrop / CoinLendInterest increasing the op count (more than 2 ops in that case)
    4. It can happen that bnb small asset exchange happen at multiple utc_times (sell ops one second before buy ops)

    The first case can be resolved for 3 coins if there is a "bridge coin" (sell btc -> usdt, buy eth -> usdt), because usdt is included in both orders. The third case can be resolved by filtering the irrelevant ops.

    Binance does provide an order history, which contains the required information to resolve trades correctly, even when multiple trades occur. Maybe that can help us.

    pr: #136

    Book 
    opened by jhoogstraat 2
  • How to create a report for former years?

    How to create a report for former years?

    Another - maybe stupid - question and/or a feature request:

    Is it possible to create reports for each year without having a file for each year and running the app several times?

    bug Taxman 
    opened by tobias-p 8
  • German Taxation: Versteuerung von geschenkten und wieder verkauften Airdrops

    German Taxation: Versteuerung von geschenkten und wieder verkauften Airdrops

    As this is only relevant for the german taxation, I'll state this issue in German.

    Gemäß BMF-Schreiben kann ein Airdrop durch

    • Einkünfte aus sonstiger Leistung oder
    • Schenkung erhalten werden.

    Falls man selber keine Aktion tätigen musste, um den Airdrop zu erhalten, gilt er als geschenkt und die schenkungssteuerlichen Regelung treten ein (Randnummer 74)

    Beim Verkauf dieses Airdrops könnte es sich um ein privates Veräußerungsgeschäft handeln. Verstehe ich es richtig, dass dann folgender Satz zutrifft: Bei unentgeltlichem Erwerb ist die Anschaffung des Rechtsvorgängers maßgebend (§ 23 Absatz 1 Satz 3 EStG).

    Heißt dass, dass man zur Berechnung des Gewinns wissen muss, wann und zu welchem Preis der Vorgänger den Coin gekauft hat? Oder ist damit nur gemeint, dass wenn man eine Leistung für 0 € erbracht hat, dass dann die Anschaffung des Rechtsvorgängers maßgebend ist. Auch das stelle ich mir unmöglich vor, auszuwerten.

    Bspw. der FLAR Airdrop wurde allen gegeben, die XRP gehalten haben. Das geschah nicht zwingend mit eigenem Zutun, könnte also als Schenkung angesehen werden. Nun kann man aber wohl nichts über die Anschaffung des Rechtsvorgängers vermuten, das ist ja alles andere als Ungewiss...

    @tobias-p Meinung dazu?

    help wanted good first issue Taxman 
    opened by provinzio 1
Owner
Jeppy
Jeppy
Cryptocurrency application that displays instant cryptocurrency prices and reads prices with the Google Text-to-Speech library.

?? Cryptocurrency Price App ?? ◽ Cryptocurrency application that displays instant cryptocurrency prices and reads prices with the Google Text-to-Speec

Furkan Mert 2 Nov 8, 2021
Run with one command grafana, prometheus, and a python script to collect and display cryptocurrency prices and track your wallet balance.

CryptoWatch Track your favorite crypto coin price and your wallet balance. Install Create .env: ADMIN_USER=admin ADMIN_PASSWORD=admin Configure you

Rafael Zimmermann 13 Dec 13, 2022
PytoPrice is an automation program to fetch the latest price of a cryptocurrency of your choice at a user-customizable update interval.

PyToPrice (Python Crypto Price) PytoPrice is an automation program to fetch the latest price of a cryptocurrency of your choice at a user-customizable

Peter 1 Jun 16, 2022
A bot for FaucetCrypto a cryptocurrency faucet. The bot can currently claim PTC ads, main reward and all the shortlinks except exe.io and fc.lc.

A bot for the high paying popular cryptocurrency faucet Faucet Crypto. The bot is built using Python and Selenium, currently it is under active develo

Sourav R S 81 Dec 19, 2022
This python module can analyse cryptocurrency news for any number of coins given and return a sentiment. Can be easily integrated with a Trading bot to keep an eye on the news.

Python script that analyses news headline or body sentiment and returns the overall media sentiment of any given coin. It can take multiple coins an

null 185 Dec 22, 2022
GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time consensus algorithm.

GreenDoge Blockchain Download GreenDoge blockchain GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time con

null 40 Sep 11, 2022
Stor is a community-driven green cryptocurrency based on a proof of space and time consensus algorithm.

Stor Blockchain Stor is a community-driven green cryptocurrency based on a proof of space and time consensus algorithm. For more information, see our

Stor Network 15 May 18, 2022
Signarly is a cryptocurrency trading bot.

Signarly is a cryptocurrency trading bot.

Zakaria EL Mesaoudi 5 Oct 6, 2022
SHIBgreen is a cryptocurrency forked from Chia and uses the Proof of Space and Time consensus algorithm

SHIBgreen is a cryptocurrency forked from Chia and uses the Proof of Space and Time consensus algorithm

null 13 Jul 13, 2022
Cryptocurrency with implementet Blockchain

Cryptocurrency with implementet Blockchain

Mario 1 Mar 24, 2022
A Docker image for plotting and farming the Chia™ cryptocurrency on one computer or across many.

An easy-to-use WebUI for crypto plotting and farming. Offers Plotman, MadMax, Chiadog, Bladebit, Farmr, and Forktools in a Docker container. Supports Chia, Cactus, Chives, Flax, Flora, HDDCoin, Maize, N-Chain, Staicoin, and Stor among others.

Guy Davis 328 Jan 1, 2023
Python Dash app that tracks whale activity in cryptocurrency markets.

Introduction Welcome! This is a Python-based Dash app meant to track whale activity in buy / sell walls on crypto-currency exchanges (presently just o

Paul Jeffries 549 Dec 25, 2022
This is a simple application to generate HD wallet addresses for cryptocurrency coins.

HD-Wallet-Address This is a mini service to generate addresses in the master HD-Wallet. It will use py_crypto_hd_wallet package as a base. Prerequisit

Amin Abbasi 1 Dec 16, 2021
Cryptocurrency trading bot with a graphical user interface with support for simulations, backtests, optimizations, and running live bots.

Cryptocurrency trading bot with a graphical user interface with support for simulations, backtests, optimizations, and running live bots.

Mihir Shrestha 834 Dec 30, 2022
Python Cryptocurrency with stealth addresses

Python Cryptocurrency with stealth addresses. Goal is to have create a cryptocurency that hides transactions totally. I.E. Cant see ammount sent, to who, or from who.

null 3 Aug 4, 2022
Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists.

tvbuddy Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists. Developed and tested on Pyth

Ossian Winter 2 Jan 7, 2022
💰 An Alfred Workflow that provides current price of cryptocurrency

Coin Ticker for Alfred Workflow An Alfred Workflow that provides current price and status about cryptocurrency from cryptocompare.com. Supports Alfred

Bumsoo Kim (Ian) 14 Nov 17, 2022
Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure

gold-blockchain (Gold) Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of

zcomputerwiz 3 Mar 9, 2022
Modern(-ish) password hashing for your software and your servers

bcrypt Good password hashing for your software and your servers Installation To install bcrypt, simply: $ pip install bcrypt Note that bcrypt should b

Python Cryptographic Authority 947 Dec 28, 2022