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 LedgerEntry: time: datetime.datetime type: str account_provider: str amount: AssetAmount balance: AssetAmount @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] ledger_entries: list[LedgerEntry]