# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

fields date,type,txid,fee,fee_unit,address,label,amount_,amount_unit,fiat_amount,other,direction,subaccount

date-format %Y-%m-%d %H:%M:%S
description %date +0000

account1 assets:trezor:%subaccount:%amount_unit
amount %amount_ %amount_unit

comment label:%label, type:%type, address:%address, txid:%txid, direction:%direction

if %direction ^OUT$
  amount -%amount_ %amount_unit

# Default equity, use custom rules for expenses
if %direction ^IN$
  account2 equity:trezor:%subaccount:withdrawal:%amount_unit

if %direction ^OUT$
  account2 equity:trezor:%subaccount:deposit:%amount_unit

if %direction ^OUT$
& %fee [1-9]
  account3 assets:trezor:%subaccount:%amount_unit
  amount3 -%fee %amount_unit
  account4 expenses:trezor:%subaccount:fees:%amount_unit
  amount4 %fee %amount_unit
  comment label:%label, type:%type, address:%address, txid:%txid, direction:%direction, taxed_as:SPEND
  comment2
  comment3 %date +0000,SPEND,trezor:%subaccount:%amount_unit,%fee_unit,%fee,USD,,FEE
# NOTE: in custom rules, use comment2 for SPENDs outside of fee

# Custom blockchain explorers are used for the following:

# Ethereum
if %amount_unit (^ETH$|^DAI$|^USDC$|^USDT$|^GUSD$)
  skip

if %amount_unit (^AAVE$|^SNX$|^NEXO$)
  skip

if %amount_unit (^WETH$|^WBTC$)
  skip

## Aave
if %amount_unit (^stkAAVE$|^aWETH$|^aSNX$|^aGUSD$)
  skip

## Compound
if %amount_unit (^cETH$)
  skip

# Tezos
if %amount_unit ^XTZ$
  skip

# TODO: expand as needed

# vim: sw=2 sts=2 si ai et
