1
0

Tighten systems

This commit is contained in:
Jon Michael Aanes 2024-12-24 20:55:16 +01:00
parent 857eb9b2b4
commit 421648d923
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
3 changed files with 6 additions and 6 deletions

View File

@ -44,11 +44,12 @@ def compute_fifo(transfers: list) -> TaxReport:
ledger_entries = [] ledger_entries = []
prices_bought_for: dict[Asset, deque[BoughtAndNotYetSold]] = {} prices_bought_for: dict[Asset, deque[BoughtAndNotYetSold]] = {}
if False: if True:
prices_bought_for[MPC] = deque() prices_bought_for[MPC] = deque()
prices_bought_for[MPC].append(BoughtAndNotYetSold(AssetAmount(MPC, Decimal(100)), datetime.datetime(2000, 1,1,1,1,1,1))) # TODO:
prices_bought_for[MPC].append(BoughtAndNotYetSold(AssetAmount(MPC, Decimal(40)), datetime.datetime(2024, 4,1,1,1,1,1)))
prices_bought_for[USDT] = deque() prices_bought_for[USDT] = deque()
prices_bought_for[USDT].append(BoughtAndNotYetSold(AssetAmount(USDT, Decimal(100)), datetime.datetime(2000, 1,1,1,1,1,1))) prices_bought_for[USDT].append(BoughtAndNotYetSold(AssetAmount(USDT, Decimal(20)), datetime.datetime(2020, 1,1,1,1,1,1)))
def current_balance(asset: Asset) -> AssetAmount: def current_balance(asset: Asset) -> AssetAmount:
return sum((p.amount for p in prices_bought_for[asset]), start=AssetAmount.ZERO) return sum((p.amount for p in prices_bought_for[asset]), start=AssetAmount.ZERO)
@ -83,7 +84,7 @@ def compute_fifo(transfers: list) -> TaxReport:
time = executed_time, time = executed_time,
type = variant, type = variant,
account_provider = 'Kraken (TODO)', account_provider = 'Kraken (TODO)',
amount = amount_to_sell, amount = -amount_to_sell,
balance = current_balance(amount.asset), balance = current_balance(amount.asset),
)) ))

View File

@ -33,7 +33,7 @@ def main():
TRANSFERS = [] TRANSFERS = []
TRANSFERS += list(KRAKEN_CLIENT._get_double_registers()) TRANSFERS += list(KRAKEN_CLIENT._get_double_registers())
#TRANSFERS += list(KUCOIN_CLIENT._get_double_registers()) TRANSFERS += list(KUCOIN_CLIENT._get_double_registers())
tax_report = compute_fifo(TRANSFERS) tax_report = compute_fifo(TRANSFERS)
logger.info('-'*80) logger.info('-'*80)

View File

@ -85,7 +85,6 @@ def write_fifo_sheet(sheet, tax_report: TaxReport):
sheet.append(column_headers) sheet.append(column_headers)
row_idx = 2 row_idx = 2
for fifo_entry in tax_report.bought_and_sold_for: for fifo_entry in tax_report.bought_and_sold_for:
print(fifo_entry)
asset = fifo_entry.amount.asset asset = fifo_entry.amount.asset
exchange_rate_dkk_bought = tax_report.exchange_rate_at_time(asset, fin_defs.DKK, fifo_entry.time_bought) exchange_rate_dkk_bought = tax_report.exchange_rate_at_time(asset, fin_defs.DKK, fifo_entry.time_bought)