1
0
crypto-tax/crypto_tax/data.py

35 lines
828 B
Python
Raw Normal View History

2024-12-22 22:25:24 +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 collections.abc import Callable
from fin_depo.data import *
import datetime
import dataclasses
import logging
@dataclasses.dataclass
class BoughtAndSold:
amount: AssetAmount
time_bought: datetime.datetime
time_sold: datetime.datetime
@dataclasses.dataclass
class BoughtAndNotYetSold:
amount: AssetAmount
time_bought: datetime.datetime
@dataclasses.dataclass
class TaxReport:
bought_and_sold_for: list[BoughtAndSold]
bought_and_spent_for: list[BoughtAndSold]
current_assets: dict[Asset, deque[BoughtAndNotYetSold]]
exchange_rate_at_time: Callable[[Asset,Asset, datetime.datetime ], Decimal]