1
0
crypto-tax/crypto_tax/__main__.py

49 lines
1.1 KiB
Python
Raw Normal View History

2024-12-14 22:38:06 +00:00
import sys
import requests
import fin_depo
from . import secrets
from fin_defs import CryptoCurrency, AssetAmount, MPC, Asset, USDT
from decimal import Decimal
from collections import deque
from fin_depo.data import *
import datetime
import dataclasses
2024-12-22 05:10:23 +00:00
import logging
2024-12-22 22:25:24 +00:00
from pathlib import Path
2024-12-22 05:10:23 +00:00
2024-12-24 19:12:50 +00:00
from . import compute_fifo, output_excel
2024-12-14 22:38:06 +00:00
KUCOIN_CLIENT = fin_depo.defi_kucoin.KucoinDepoFetcher(
secrets.KUCOIN_KEY,
secrets.KUCOIN_SECRET,
secrets.KUCOIN_PASS,
)
2024-12-22 05:03:47 +00:00
KRAKEN_CLIENT = fin_depo.defi_kraken.KrakenDepoFetcher(
secrets.KRAKEN_KEY,
secrets.KRAKEN_SECRET,
)
2024-12-22 05:10:23 +00:00
def main():
"""Main function."""
2024-12-14 22:38:06 +00:00
2024-12-22 05:25:07 +00:00
logging.basicConfig()
2024-12-22 05:10:23 +00:00
logger = logging.getLogger('crypto_tax')
logger.setLevel('INFO')
2024-12-14 22:38:06 +00:00
2024-12-24 19:12:50 +00:00
TRANSFERS = []
TRANSFERS += list(KRAKEN_CLIENT._get_double_registers())
2024-12-24 19:55:16 +00:00
TRANSFERS += list(KUCOIN_CLIENT._get_double_registers())
2024-12-24 19:12:50 +00:00
tax_report = compute_fifo(TRANSFERS)
2024-12-14 22:38:06 +00:00
2024-12-22 05:10:23 +00:00
logger.info('-'*80)
2024-12-14 22:38:06 +00:00
2024-12-22 22:25:24 +00:00
output_path = Path('./output/report.xlsx')
output_excel.produce_excel_report(tax_report, output_path)
2024-12-14 22:38:06 +00:00
if __name__ == '__main__':
main()