diff --git a/crypto_tax/__init__.py b/crypto_tax/__init__.py index 6aa42eb..65ca5e7 100644 --- a/crypto_tax/__init__.py +++ b/crypto_tax/__init__.py @@ -1,6 +1,18 @@ """# Crypto Tax. -WIP +Tool to automatically perform tax computations of crypto transactions from the danish perspective. + +## TODO + +This tool is a work in progress: + +- [ ] Support Partisia Blockchain +- [ ] Fix Kucoin issues. +- [ ] Produce Excel output file: + * Sheet 1: Gives a basic overview, including computed tax values from the rest of + the sheet, and reasonings for these. Gives an overview of the other sheets. + * Sheet 2: Current assets, including FIFO acquisition prices. + * Sheet 3: Historic sales, with FIFO. """ import sys @@ -105,18 +117,6 @@ def compute_tax(transfers: list) -> TaxReport: spend(fee, transfer.executed_time) del transfer, fee - if True: - logger.info('Bought for:') - for asset, prices in prices_bought_for.items(): - price_sum = sum((p.amount for p in prices), start=AssetAmount.ZERO) - sys.stdout.write(f' - {asset.raw_short_name():10} ({price_sum}): ') - for price in prices: - sys.stdout.write(str(price.amount.amount)) - sys.stdout.write(', ') - del price - sys.stdout.write('\n') - del asset, prices - return TaxReport( bought_and_sold_for=bought_and_sold_for, bought_and_spent_for=bought_and_spent_for, diff --git a/crypto_tax/__main__.py b/crypto_tax/__main__.py index 509d5a6..d4f0fe0 100644 --- a/crypto_tax/__main__.py +++ b/crypto_tax/__main__.py @@ -26,6 +26,7 @@ KRAKEN_CLIENT = fin_depo.defi_kraken.KrakenDepoFetcher( def main(): """Main function.""" + logging.basicConfig() logger = logging.getLogger('crypto_tax') logger.setLevel('INFO') @@ -35,14 +36,21 @@ def main(): logger.info('-'*80) + if True: + logger.info('Bought for:') + for asset, prices in tax_report.current_assets.items(): + price_sum = sum((p.amount for p in prices), start=AssetAmount.ZERO) + sys.stdout.write(f' - {asset.raw_short_name():10} ({price_sum}): ') + for price in prices: + sys.stdout.write(str(price.amount.amount)) + sys.stdout.write(', ') + del price + sys.stdout.write('\n') + del asset, prices + for bas in tax_report.bought_and_sold_for: - logger.info(f'{bas.amount} ({bas.time_bought} ----> {bas.time_sold})') - - - for c, prices in tax_report.current_assets.items(): - logger.info('%s', c) - logger.info('%s', prices) + sys.stdout.write(f'{bas.amount} ({bas.time_bought} ----> {bas.time_sold})\n') if __name__ == '__main__':