1
0

Plans for the future
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Failing after 22s

This commit is contained in:
Jon Michael Aanes 2024-12-22 06:25:07 +01:00
parent 3f1d576611
commit cd630de70b
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
2 changed files with 27 additions and 19 deletions

View File

@ -1,6 +1,18 @@
"""# Crypto Tax. """# 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 import sys
@ -105,18 +117,6 @@ def compute_tax(transfers: list) -> TaxReport:
spend(fee, transfer.executed_time) spend(fee, transfer.executed_time)
del transfer, fee 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( return TaxReport(
bought_and_sold_for=bought_and_sold_for, bought_and_sold_for=bought_and_sold_for,
bought_and_spent_for=bought_and_spent_for, bought_and_spent_for=bought_and_spent_for,

View File

@ -26,6 +26,7 @@ KRAKEN_CLIENT = fin_depo.defi_kraken.KrakenDepoFetcher(
def main(): def main():
"""Main function.""" """Main function."""
logging.basicConfig()
logger = logging.getLogger('crypto_tax') logger = logging.getLogger('crypto_tax')
logger.setLevel('INFO') logger.setLevel('INFO')
@ -35,14 +36,21 @@ def main():
logger.info('-'*80) 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: for bas in tax_report.bought_and_sold_for:
logger.info(f'{bas.amount} ({bas.time_bought} ----> {bas.time_sold})') sys.stdout.write(f'{bas.amount} ({bas.time_bought} ----> {bas.time_sold})\n')
for c, prices in tax_report.current_assets.items():
logger.info('%s', c)
logger.info('%s', prices)
if __name__ == '__main__': if __name__ == '__main__':