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
|
|
|
|
|
|
|
|
|
2024-12-24 19:12:50 +00:00
|
|
|
@dataclasses.dataclass
|
|
|
|
class LedgerEntry:
|
|
|
|
time: datetime.datetime
|
|
|
|
type: str
|
|
|
|
account_provider: str
|
|
|
|
amount: AssetAmount
|
|
|
|
balance: AssetAmount
|
|
|
|
|
|
|
|
|
2024-12-22 22:25:24 +00:00
|
|
|
@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]
|
2024-12-24 19:12:50 +00:00
|
|
|
ledger_entries: list[LedgerEntry]
|