forked from EvergreenCrypto/docker-finance
container: hledger-flow: support non-alpha chars (currency)
Removes old hack for currencies with non-alpha characters.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# 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
|
||||
@@ -43,13 +43,6 @@ function parse()
|
||||
if (NR<2 || $1 !~ global_year)
|
||||
next
|
||||
|
||||
# TODO: upstream feature-request so number-valued tokens can be used
|
||||
gsub(/,1INCH,/, ",ONEINCH,")
|
||||
gsub(/,USDC\.e,/, ",USDCe,") # USDC on Polygon
|
||||
gsub(/,cUSDCv3,/, ",cUSDC,") # TODO: are you sure?
|
||||
gsub(/,UNI-V3-POS,/, ",UNIVTHREEPOS,")
|
||||
gsub(/,UNI-V2,/, ",UNIVTWO,")
|
||||
|
||||
# TODO: full s/v/aToken support
|
||||
|
||||
# V2
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# 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
|
||||
@@ -85,9 +85,6 @@ function __parse()
|
||||
sub(/Z/, "", $9);
|
||||
sub(/\+.*/, "", $9);
|
||||
|
||||
# Allow numerical symbols
|
||||
gsub(/1INCH/, "ONEINCH")
|
||||
|
||||
# Print [info] object for rules consumption
|
||||
printf $1 OFS # account_id (prepended column)
|
||||
printf $2 OFS # info_id (coinbase_id)
|
||||
|
||||
@@ -84,7 +84,7 @@ date %created_at
|
||||
date-format %Y-%m-%d %H:%M:%S
|
||||
|
||||
account1 assets:coinbase:%subaccount:%amount_currency
|
||||
amount %amount_amount %amount_currency
|
||||
amount %amount_amount "%amount_currency"
|
||||
|
||||
# NOTE: server time is UTC, as are the timestamps.
|
||||
description %created_at +0000
|
||||
@@ -109,7 +109,7 @@ if %type ^fiat_deposit$
|
||||
account2 equity:coinbase:%subaccount:withdrawal:%amount_currency
|
||||
|
||||
if %type ^fiat_withdrawal$
|
||||
amount -%amount_amount %amount_currency
|
||||
amount -%amount_amount "%amount_currency"
|
||||
account2 equity:coinbase:%subaccount:deposit:%amount_currency
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
@@ -132,7 +132,7 @@ if %type ^send$
|
||||
# NOTE: use custom rules if expense or gift
|
||||
if %type ^send$
|
||||
& %direction ^OUT$
|
||||
amount -%amount_amount %amount_currency
|
||||
amount -%amount_amount "%amount_currency"
|
||||
account2 equity:coinbase:%subaccount:deposit:%amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, idem:%idem, network_status:%network_status, direction:%direction
|
||||
|
||||
@@ -158,9 +158,9 @@ if %type ^send$
|
||||
if %type ^send$
|
||||
& %direction ^OUT$
|
||||
& %native_network_transaction_fee_amount [1-9]
|
||||
amount -%network_transaction_amount_amount %amount_currency
|
||||
amount -%network_transaction_amount_amount "%amount_currency"
|
||||
account3 assets:coinbase:%subaccount:%network_transaction_fee_currency
|
||||
amount3 -%network_transaction_fee_amount %network_transaction_fee_currency @@ %native_network_transaction_fee_amount %native_amount_currency
|
||||
amount3 -%network_transaction_fee_amount "%network_transaction_fee_currency" @@ %native_network_transaction_fee_amount %native_amount_currency
|
||||
account4 expenses:coinbase:%subaccount:fees:send:%native_amount_currency
|
||||
amount4 %native_network_transaction_fee_amount %native_amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, idem:%idem, network_status:%network_status, network_name:%network_network_name, to_address:%to_address, txid:%network_hash, direction:%direction, taxed_as:SPEND
|
||||
@@ -220,7 +220,7 @@ if %type (^vault_withdrawal$|^transfer$)
|
||||
# NOTE: apparently there's no such thing as vault_deposit ...
|
||||
if %type ^transfer$
|
||||
& %direction ^OUT$
|
||||
amount -%amount_amount %amount_currency
|
||||
amount -%amount_amount "%amount_currency"
|
||||
|
||||
# Remove duplicate vault tx (use wallet tx instead)
|
||||
if %type ^transfer$
|
||||
@@ -257,7 +257,7 @@ if %type ^vault_withdrawal$
|
||||
|
||||
# From wallet -> To Pro
|
||||
if %type (^pro_deposit$|^exchange_deposit$)
|
||||
amount -%amount_amount %amount_currency
|
||||
amount -%amount_amount "%amount_currency"
|
||||
account2 equity:coinbase-pro:deposit:%amount_currency
|
||||
|
||||
# To wallet <- From Pro
|
||||
@@ -273,7 +273,7 @@ if %type ^pro_withdrawal$
|
||||
if %type ^send$
|
||||
& %description reward
|
||||
& %from_name (^Coinbase Card$|^Card Rewards$)
|
||||
amount %amount_amount %amount_currency @@ %native_amount_amount %native_amount_currency
|
||||
amount %amount_amount "%amount_currency" @@ %native_amount_amount %native_amount_currency
|
||||
account2 income:coinbase:%subaccount:card:%native_amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, taxed_as:REBATE
|
||||
comment2 %created_at +0000,BUY,coinbase:%subaccount,%amount_currency,%amount_amount,%native_amount_currency,%native_amount_amount,,
|
||||
@@ -281,7 +281,7 @@ if %type ^send$
|
||||
# Crypto Spend
|
||||
|
||||
if %type ^cardspend$
|
||||
amount -%amount_amount %amount_currency @@ %native_amount_amount %native_amount_currency
|
||||
amount -%amount_amount "%amount_currency" @@ %native_amount_amount %native_amount_currency
|
||||
account2 expenses:coinbase:%subaccount:card:%amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, taxed_as:SPEND
|
||||
comment2 %created_at +0000,SPEND,coinbase:%subaccount,%amount_currency,%amount_amount,%native_amount_currency,%native_amount_amount,Coinbase Card
|
||||
@@ -290,7 +290,7 @@ if %type ^cardspend$
|
||||
# TODO: any reference to USD should be a backreferenced %native_amount_currency
|
||||
if %type ^cardspend$
|
||||
& %amount_currency ^USD$
|
||||
amount -%amount_amount %amount_currency
|
||||
amount -%amount_amount "%amount_currency"
|
||||
account2 expenses:coinbase:%subaccount:card:%amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id
|
||||
comment2
|
||||
@@ -355,7 +355,7 @@ if %type (^buy$|^sell$)
|
||||
#
|
||||
|
||||
if %type ^buy$
|
||||
amount %amount_amount %amount_currency @@ %buy_total_amount %buy_total_currency
|
||||
amount %amount_amount "%amount_currency" @@ %buy_total_amount "%buy_total_currency"
|
||||
account2 assets:coinbase:%subaccount:%buy_total_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, buy_id:%buy_id, taxed_as:BUY
|
||||
comment2 %created_at +0000,BUY,coinbase:%subaccount,%amount_currency,%amount_amount,%buy_total_currency,%buy_total_amount,,
|
||||
@@ -373,16 +373,16 @@ if %type ^buy$
|
||||
|
||||
if %type ^buy$
|
||||
& %buy_total_currency ^USDC$
|
||||
amount %amount_amount %amount_currency @@ %native_amount_amount %native_amount_currency
|
||||
amount %amount_amount "%amount_currency" @@ %native_amount_amount %native_amount_currency
|
||||
comment2 %created_at +0000,BUY,coinbase:%subaccount,%amount_currency,%amount_amount,%native_amount_currency,%native_amount_amount,,
|
||||
|
||||
if %type ^buy$
|
||||
& %buy_fee_amount [1-9]
|
||||
amount %amount_amount %amount_currency @@ %buy_subtotal_amount %buy_subtotal_currency
|
||||
amount %amount_amount "%amount_currency" @@ %buy_subtotal_amount "%buy_subtotal_currency"
|
||||
account2 assets:coinbase:%subaccount:%buy_subtotal_currency
|
||||
amount3 -%buy_fee_amount %buy_fee_currency
|
||||
amount3 -%buy_fee_amount "%buy_fee_currency"
|
||||
account3 assets:coinbase:%subaccount:%buy_fee_currency
|
||||
amount4 %buy_fee_amount %buy_fee_currency
|
||||
amount4 %buy_fee_amount "%buy_fee_currency"
|
||||
account4 expenses:coinbase:%subaccount:fees:trading:%buy_fee_currency
|
||||
|
||||
if %type ^buy$
|
||||
@@ -392,17 +392,17 @@ if %type ^buy$
|
||||
if %type ^buy$
|
||||
& %buy_fee_amount [1-9]
|
||||
& %buy_payment_method_name (bank|checking|credit|debit|saving)
|
||||
amount5 %buy_total_amount %buy_total_currency
|
||||
amount5 %buy_total_amount "%buy_total_currency"
|
||||
account5 assets:coinbase:%subaccount:%buy_total_currency
|
||||
amount6 -%buy_total_amount %buy_total_currency
|
||||
amount6 -%buy_total_amount "%buy_total_currency"
|
||||
account6 equity:coinbase:%subaccount:withdrawal:%buy_total_currency
|
||||
|
||||
if %type ^buy$
|
||||
& %buy_fee_amount ^[^1-9]*$
|
||||
& %buy_payment_method_name (bank|checking|credit|debit|saving)
|
||||
amount3 %buy_total_amount %buy_total_currency
|
||||
amount3 %buy_total_amount "%buy_total_currency"
|
||||
account3 assets:coinbase:%subaccount:%buy_total_currency
|
||||
amount4 -%buy_total_amount %buy_total_currency
|
||||
amount4 -%buy_total_amount "%buy_total_currency"
|
||||
account4 equity:coinbase:%subaccount:withdrawal:%buy_total_currency
|
||||
|
||||
#
|
||||
@@ -410,7 +410,7 @@ if %type ^buy$
|
||||
#
|
||||
|
||||
if %type ^sell$
|
||||
amount -%amount_amount %amount_currency @@ %sell_total_amount %sell_total_currency
|
||||
amount -%amount_amount "%amount_currency" @@ %sell_total_amount "%sell_total_currency"
|
||||
account2 assets:coinbase:%subaccount:%sell_total_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, sell_id:%sell_id, taxed_as:SELL
|
||||
comment2 %created_at +0000,SELL,coinbase:%subaccount,%amount_currency,%amount_amount,%sell_total_currency,%sell_total_amount,,
|
||||
@@ -433,11 +433,11 @@ if %type ^sell$
|
||||
|
||||
if %type ^sell$
|
||||
& %sell_fee_amount [1-9]
|
||||
amount -%amount_amount %amount_currency @@ %sell_subtotal_amount %sell_subtotal_currency
|
||||
amount -%amount_amount "%amount_currency" @@ %sell_subtotal_amount "%sell_subtotal_currency"
|
||||
account2 assets:coinbase:%subaccount:%sell_subtotal_currency
|
||||
amount3 -%sell_fee_amount %sell_fee_currency
|
||||
amount3 -%sell_fee_amount "%sell_fee_currency"
|
||||
account3 assets:coinbase:%subaccount:%sell_fee_currency
|
||||
amount4 %sell_fee_amount %sell_fee_currency
|
||||
amount4 %sell_fee_amount "%sell_fee_currency"
|
||||
account4 expenses:coinbase:%subaccount:fees:trading:%sell_fee_currency
|
||||
|
||||
if %type ^sell$
|
||||
@@ -447,17 +447,17 @@ if %type ^sell$
|
||||
if %type ^sell$
|
||||
& %sell_fee_amount [1-9]
|
||||
& %sell_payment_method_name (bank|checking|credit|debit|saving)
|
||||
amount5 -%sell_total_amount %sell_total_currency
|
||||
amount5 -%sell_total_amount "%sell_total_currency"
|
||||
account5 assets:coinbase:%subaccount:%sell_total_currency
|
||||
amount6 %sell_total_amount %sell_total_currency
|
||||
amount6 %sell_total_amount "%sell_total_currency"
|
||||
account6 equity:coinbase:%subaccount:deposit:%sell_total_currency
|
||||
|
||||
if %type ^sell$
|
||||
& %sell_fee_amount ^[^1-9]*$
|
||||
& %sell_payment_method_name (bank|checking|credit|debit|saving)
|
||||
amount3 -%sell_total_amount %sell_total_currency
|
||||
amount3 -%sell_total_amount "%sell_total_currency"
|
||||
account3 assets:coinbase:%subaccount:%sell_total_currency
|
||||
amount4 %sell_total_amount %sell_total_currency
|
||||
amount4 %sell_total_amount "%sell_total_currency"
|
||||
account4 equity:coinbase:%subaccount:deposit:%sell_total_currency
|
||||
|
||||
#
|
||||
@@ -630,7 +630,7 @@ if %type ^sell$
|
||||
|
||||
if %type ^trade$
|
||||
& %direction ^OUT$
|
||||
amount -%amount_amount %amount_currency @@ %native_amount_amount %native_amount_currency
|
||||
amount -%amount_amount "%amount_currency" @@ %native_amount_amount %native_amount_currency
|
||||
account2 equity:coinbase:%subaccount:conversion:%native_amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, taxed_as:SELL
|
||||
comment2 %created_at +0000,SELL,coinbase:%subaccount,%amount_currency,%amount_amount,%native_amount_currency,%native_amount_amount,,
|
||||
@@ -646,7 +646,7 @@ if %type ^trade$
|
||||
|
||||
if %type ^trade$
|
||||
& %direction ^IN$
|
||||
amount %amount_amount %amount_currency @@ %native_amount_amount %native_amount_currency
|
||||
amount %amount_amount "%amount_currency" @@ %native_amount_amount %native_amount_currency
|
||||
account2 equity:coinbase:%subaccount:conversion:%native_amount_currency
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, taxed_as:BUY
|
||||
comment2 %created_at +0000,BUY,coinbase:%subaccount,%amount_currency,%amount_amount,%native_amount_currency,%native_amount_amount,,
|
||||
@@ -705,7 +705,7 @@ if %type ^advanced_trade_fill$
|
||||
& %advanced_trade_fill_order_side ^buy$
|
||||
& %advanced_trade_fill_real_value_amount [1-9]
|
||||
& %direction ^IN$
|
||||
amount %amount_amount %advanced_trade_fill_pair_lhs @@ %advanced_trade_fill_real_value_amount %advanced_trade_fill_pair_rhs
|
||||
amount %amount_amount "%advanced_trade_fill_pair_lhs" @@ %advanced_trade_fill_real_value_amount "%advanced_trade_fill_pair_rhs"
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, advanced_trade_fill_fill_price:%advanced_trade_fill_fill_price, advanced_trade_fill_product_id:%advanced_trade_fill_product_id, advanced_trade_fill_order_id:%advanced_trade_fill_order_id, advanced_trade_fill_order_side:%advanced_trade_fill_order_side, advanced_trade_fill_pair_lhs:%advanced_trade_fill_pair_lhs, advanced_trade_fill_pair_rhs:%advanced_trade_fill_pair_rhs, direction:%direction, taxed_as:BUY
|
||||
comment2 %created_at +0000,BUY,coinbase:%subaccount,%advanced_trade_fill_pair_lhs,%amount_amount,%advanced_trade_fill_pair_rhs,%advanced_trade_fill_cost_basis_amount,,
|
||||
|
||||
@@ -741,7 +741,7 @@ if %type ^advanced_trade_fill$
|
||||
& %advanced_trade_fill_order_side ^sell$
|
||||
& %advanced_trade_fill_real_value_amount [1-9]
|
||||
& %direction ^OUT$
|
||||
amount -%amount_amount %advanced_trade_fill_pair_lhs @@ %advanced_trade_fill_real_value_amount %advanced_trade_fill_pair_rhs
|
||||
amount -%amount_amount "%advanced_trade_fill_pair_lhs" @@ %advanced_trade_fill_real_value_amount "%advanced_trade_fill_pair_rhs"
|
||||
comment type:%type, status:%status_, account_id:%account_id, coinbase_id:%coinbase_id, advanced_trade_fill_fill_price:%advanced_trade_fill_fill_price, advanced_trade_fill_product_id:%advanced_trade_fill_product_id, advanced_trade_fill_order_id:%advanced_trade_fill_order_id, advanced_trade_fill_order_side:%advanced_trade_fill_order_side, advanced_trade_fill_pair_lhs:%advanced_trade_fill_pair_lhs, advanced_trade_fill_pair_rhs:%advanced_trade_fill_pair_rhs, direction:%direction, taxed_as:SELL
|
||||
comment2 %created_at +0000,SELL,coinbase:%subaccount,%advanced_trade_fill_pair_lhs,%amount_amount,%advanced_trade_fill_pair_rhs,%advanced_trade_fill_cost_basis_amount,,
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ date-format %Y-%m-%d %H:%M:%S
|
||||
description %date +0000
|
||||
|
||||
account1 assets:gemini:%subaccount:%currency_one
|
||||
amount %amount_ %currency_one
|
||||
amount %amount_ "%currency_one"
|
||||
|
||||
comment type:%type, order_type:%order_type, eid:%code_, destination:%destination, txid:%txid, direction:%direction
|
||||
|
||||
@@ -32,7 +32,7 @@ comment type:%type, order_type:%order_type, eid:%code_, destination:%destination
|
||||
################################################################################
|
||||
|
||||
if %direction ^OUT$
|
||||
amount -%amount_ %currency_one
|
||||
amount -%amount_ "%currency_one"
|
||||
|
||||
if %direction ^IN$
|
||||
account2 equity:gemini:%subaccount:withdrawal:%currency_one
|
||||
@@ -42,9 +42,9 @@ if %direction ^OUT$
|
||||
|
||||
if %direction ^OUT$
|
||||
& %fees [1-9]
|
||||
amount3 -%fees %currency_two
|
||||
amount3 -%fees "%currency_two"
|
||||
account3 assets:gemini:%subaccount:%currency_one
|
||||
amount4 %fees %currency_two
|
||||
amount4 %fees "%currency_two"
|
||||
account4 expenses:gemini:%subaccount:fees:withdrawals:%currency_two
|
||||
comment type:%type, order_type:%order_type, eid:%code_, destination:%destination, txid:%txid, direction:%direction, taxed_as:SPEND
|
||||
comment3 %date +0000,SPEND,gemini:%subaccount,%currency_two,%fees,USD,,FEE
|
||||
@@ -90,7 +90,7 @@ if %type ^TRADE$
|
||||
account2 assets:gemini:%subaccount:%currency_two
|
||||
|
||||
if %order_type ^Buy$
|
||||
amount %amount_ %currency_one @@ %cost %currency_two
|
||||
amount %amount_ "%currency_one" @@ %cost "%currency_two"
|
||||
comment type:%type, order_type:%order_type, order_id:%txid, tid:%code_, taxed_as:BUY
|
||||
comment2 %date +0000,BUY,gemini:%subaccount,%currency_one,%amount_,%currency_two,%cost_basis,%currency_two,%fees
|
||||
# TODO: HACK: re: #51, FeeCurrency and Fee are added even though cost_basis is calculated (for non-fiat fee disposal, see lib_taxes)
|
||||
@@ -101,7 +101,7 @@ if %order_type ^Buy$
|
||||
comment2 %date +0000,BUY,gemini:%subaccount,%currency_one,%amount_,%currency_two,%cost_basis,,
|
||||
|
||||
if %order_type ^Sell$
|
||||
amount -%amount_ %currency_one @@ %cost %currency_two
|
||||
amount -%amount_ "%currency_one" @@ %cost "%currency_two"
|
||||
comment type:%type, order_type:%order_type, order_id:%txid, tid:%code_, taxed_as:SELL
|
||||
comment2 %date +0000,SELL,gemini:%subaccount,%currency_one,%amount_,%currency_two,%cost_basis,%currency_two,%fees
|
||||
# TODO: HACK: re: #51, FeeCurrency and Fee are added even though cost_basis is calculated (for non-fiat fee disposal, see lib_taxes)
|
||||
@@ -128,8 +128,8 @@ if %type ^TRADE$
|
||||
if %type ^TRADE$
|
||||
& %fees [1-9]
|
||||
account3 assets:gemini:%subaccount:%currency_two
|
||||
amount3 -%fees %currency_two
|
||||
amount3 -%fees "%currency_two"
|
||||
account4 expenses:gemini:%subaccount:fees:trades:%currency_two
|
||||
amount4 %fees %currency_two
|
||||
amount4 %fees "%currency_two"
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# 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
|
||||
@@ -77,9 +77,6 @@ function parse_transfers()
|
||||
# Get/set info_method (if available)
|
||||
if ($10 == "ACH" || $10 == "Wire" || $10 == "SEN" || $10 == "CreditCard") {$8=$10}
|
||||
|
||||
# Allow numerical symbols
|
||||
gsub(/1INCH/, "ONEINCH")
|
||||
|
||||
printf $1 OFS # UID (info_eid)
|
||||
printf date OFS # Date
|
||||
printf "TRANSFER" OFS # Type
|
||||
@@ -151,9 +148,6 @@ function parse_transfers()
|
||||
# Get/set info_method (if available)
|
||||
if ($8 == "ACH" || $8 == "Wire" || $8 == "SEN" || $8 == "CreditCard") {$6=$8}
|
||||
|
||||
# Allow numerical symbols
|
||||
gsub(/1INCH/, "ONEINCH")
|
||||
|
||||
printf $1 OFS # UID (info_eid)
|
||||
printf date OFS # Date
|
||||
printf "TRANSFER" OFS # Type
|
||||
@@ -215,8 +209,6 @@ function parse_trades()
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
gsub(/,1INCH,/,",ONEINCH,")
|
||||
|
||||
printf $9 OFS # UID (tid)
|
||||
printf date OFS # Date
|
||||
printf "TRADE" OFS # Type
|
||||
@@ -296,8 +288,6 @@ function parse_earn()
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
gsub(/,1INCH,/,",ONEINCH,")
|
||||
|
||||
printf $1 OFS # UID (earnTransactionId)
|
||||
printf date OFS # Date
|
||||
printf "INTEREST" OFS # Type
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# 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
|
||||
@@ -52,9 +52,6 @@ function parse()
|
||||
sub(/\.000Z/, "", $1)
|
||||
sub(/\.001Z/, "", $1)
|
||||
|
||||
# Patch for symbols with integers
|
||||
gsub(/,1INCH,/,",ONEINCH,")
|
||||
|
||||
printf $1 OFS # Operation Date
|
||||
printf $2 OFS # Status
|
||||
printf $3 OFS # Currency Ticker
|
||||
|
||||
@@ -21,12 +21,12 @@ date-format %Y-%m-%d %H:%M:%S
|
||||
description %date +0000
|
||||
|
||||
account1 assets:ledger:%account_name:%currency_
|
||||
amount %amount_ %currency_
|
||||
amount %amount_ "%currency_"
|
||||
|
||||
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction
|
||||
|
||||
if %type ^OUT$
|
||||
amount -%amount_ %currency_
|
||||
amount -%amount_ "%currency_"
|
||||
|
||||
# Default equity (use custom rules for expenses)
|
||||
if %type ^IN$
|
||||
@@ -38,9 +38,9 @@ if %type ^OUT$
|
||||
if %type ^OUT$
|
||||
& %fees [1-9]
|
||||
account3 assets:ledger:%account_name:%currency_
|
||||
amount3 -%fees %currency_
|
||||
amount3 -%fees "%currency_"
|
||||
account4 expenses:ledger:%account_name:fees:%currency_
|
||||
amount4 %fees %currency_
|
||||
amount4 %fees "%currency_"
|
||||
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
|
||||
comment2
|
||||
comment3 %date +0000,SPEND,ledger:%account_name:%currency_,%currency_,%fees,USD,,FEE
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# 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
|
||||
@@ -48,10 +48,6 @@ function parse()
|
||||
# NOTE: they use NEXONEXO for NEXO that isnt a deposit...
|
||||
sub(/NEXONEXO/, "NEXO", $3)
|
||||
|
||||
# Patch for symbols with integers
|
||||
sub(/1INCH/, "ONEINCH", $3)
|
||||
sub(/LUNA2/, "LUNATWO", $3)
|
||||
|
||||
# Remove symbol in "USD Equivalent"
|
||||
sub(/\$/, "", $7)
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ date-format %Y-%m-%d %H:%M:%S
|
||||
description %date +0000
|
||||
|
||||
account1 assets:nexo:%subaccount:%input_currency
|
||||
amount %input_amount %input_currency
|
||||
amount %input_amount "%input_currency"
|
||||
|
||||
comment description:%description_, code:%code_, status:%status_, type:%type, direction:%direction
|
||||
|
||||
# Capture all movement
|
||||
if %direction ^OUT$
|
||||
amount -%input_amount %input_currency
|
||||
amount -%input_amount "%input_currency"
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
@@ -95,7 +95,7 @@ if %type ^Repayment$
|
||||
# TODO: really an expense?
|
||||
if %type ^Liquidation$
|
||||
& %description_ ^Crypto Repayment$
|
||||
amount -%input_amount %input_currency @@ %usd_amount USD
|
||||
amount -%input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 expenses:nexo:%subaccount:liquidations:USD
|
||||
comment description:%description_, code:%code_, status:%status_, type:%type, direction:%direction, taxed_as:REPAY
|
||||
comment2 %date +0000,REPAY,nexo:%subaccount,%input_currency,%input_amount,USD,%usd_amount,
|
||||
@@ -109,9 +109,9 @@ if %type ^Liquidation$
|
||||
# Earned income by description
|
||||
# NOTE: not a fixed string
|
||||
if %description_ Interest Earned$
|
||||
amount %input_amount %input_currency @@ %usd_amount USD
|
||||
amount %input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 equity:nexo:%subaccount:conversion:USD
|
||||
amount3 %usd_amount USD @@ %input_amount %input_currency
|
||||
amount3 %usd_amount USD @@ %input_amount "%input_currency"
|
||||
account3 equity:nexo:%subaccount:conversion:USD
|
||||
account4 income:nexo:%subaccount:interest:%input_currency
|
||||
comment description:%description_, code:%code_, status:%status_, type:InterestEarned, direction:%direction, taxed_as:INCOME
|
||||
@@ -119,9 +119,9 @@ if %description_ Interest Earned$
|
||||
|
||||
# Earned income by type
|
||||
if %type ^FixedTermInterest$
|
||||
amount %input_amount %input_currency @@ %usd_amount USD
|
||||
amount %input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 equity:nexo:%subaccount:conversion:USD
|
||||
amount3 %usd_amount USD @@ %input_amount %input_currency
|
||||
amount3 %usd_amount USD @@ %input_amount "%input_currency"
|
||||
account3 equity:nexo:%subaccount:conversion:USD
|
||||
account4 income:nexo:%subaccount:interest:%input_currency
|
||||
comment description:%description_, code:%code_, status:%status_, type:InterestEarned, direction:%direction, taxed_as:INCOME
|
||||
@@ -130,9 +130,9 @@ if %type ^FixedTermInterest$
|
||||
# Airdrops
|
||||
# NOTE: not a fixed string
|
||||
if %description_ Airdrop
|
||||
amount %input_amount %input_currency @@ %usd_amount USD
|
||||
amount %input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 equity:nexo:%subaccount:conversion:USD
|
||||
amount3 %usd_amount USD @@ %input_amount %input_currency
|
||||
amount3 %usd_amount USD @@ %input_amount "%input_currency"
|
||||
account3 equity:nexo:%subaccount:conversion:USD
|
||||
account4 income:nexo:%subaccount:interest:%input_currency
|
||||
comment description:%description_, code:%code_, status:%status_, type:Airdrop, direction:%direction, taxed_as:INCOME
|
||||
@@ -145,9 +145,9 @@ if %type ^Administrator$
|
||||
|
||||
# Dividends (now deprecated, last dividend was released 2021)
|
||||
if %type ^Dividend$
|
||||
amount %input_amount %input_currency @@ %usd_amount USD
|
||||
amount %input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 equity:nexo:%subaccount:conversion:USD
|
||||
amount3 %usd_amount USD @@ %input_amount %input_currency
|
||||
amount3 %usd_amount USD @@ %input_amount "%input_currency"
|
||||
account3 equity:nexo:%subaccount:conversion:USD
|
||||
account4 income:nexo:%subaccount:dividend:%input_currency
|
||||
comment description:%description_, code:%code_, status:%status_, type:%type, direction:%direction, taxed_as:INCOME
|
||||
@@ -161,7 +161,7 @@ if %type ^Dividend$
|
||||
|
||||
# Exchange
|
||||
if %type ^Exchange$
|
||||
amount -%input_amount %input_currency @@ %output_amount %output_currency
|
||||
amount -%input_amount "%input_currency" @@ %output_amount "%output_currency"
|
||||
account2 assets:nexo:%subaccount:%output_currency
|
||||
comment description:%description_, code:%code_, status:%status_, type:%type, taxed_as:SELL
|
||||
comment2 %date +0000,SELL,nexo:%subaccount,%input_currency,%input_amount,%output_currency,%output_amount,,
|
||||
@@ -169,7 +169,7 @@ if %type ^Exchange$
|
||||
# Exchange Cashback
|
||||
# NOTE: cashback rewards are considered rebates and not taxable income
|
||||
if %type ^Exchange Cashback$
|
||||
amount %input_amount %input_currency @@ %usd_amount USD
|
||||
amount %input_amount "%input_currency" @@ %usd_amount USD
|
||||
account2 equity:nexo:%subaccount:conversion:USD
|
||||
amount3 %usd_amount USD @@ %input_amount %input_currency
|
||||
account3 equity:nexo:%subaccount:conversion:%input_currency
|
||||
|
||||
Reference in New Issue
Block a user