Merge pull request #73 into master

42e97cb hledger-flow: ledger: skip aEthWETH (Aaron Fiore)
e570610 hledger-flow: ledger: add 'Status' column (Aaron Fiore)
This commit is contained in:
2024-07-03 18:52:54 -07:00
2 changed files with 19 additions and 18 deletions

View File

@@ -35,7 +35,7 @@ source "${DOCKER_FINANCE_CONTAINER_REPO}/src/hledger-flow/lib/lib_preprocess.bas
function parse()
{
lib_preprocess::assert_header "Operation Date,Currency Ticker,Operation Type,Operation Amount,Operation Fees,Operation Hash,Account Name,Account xpub,Countervalue Ticker,Countervalue at Operation Date,Countervalue at CSV Export"
lib_preprocess::assert_header "Operation Date,Status,Currency Ticker,Operation Type,Operation Amount,Operation Fees,Operation Hash,Account Name,Account xpub,Countervalue Ticker,Countervalue at Operation Date,Countervalue at CSV Export"
# NOTE: subaccount (account label) is entered within app.
# Label your subaccount as subaccount1:subaccount2:etc
@@ -56,22 +56,23 @@ function parse()
gsub(/,1INCH,/,",ONEINCH,")
printf $1 OFS # Operation Date
printf $2 OFS # Currency Ticker
printf $3 OFS # Operation Type
printf $2 OFS # Status
printf $3 OFS # Currency Ticker
printf $4 OFS # Operation Type
# Operation Amount (minus fee w/ this regexp)
amount=($3 ~ /^OUT$|^DELEGATE$/ ? $4-$5 : $4)
amount=($4 ~ /^OUT$|^DELEGATE$/ ? $5-$6 : $5)
printf("%.8f", amount); printf OFS
printf("%.8f", $5); printf OFS # Operation Fees
printf $6 OFS # Operation Hash
printf $7 OFS # Account Name (subaccount)
printf $8 OFS # Account xpub
printf $9 OFS # Countervalue Ticker
printf $10 OFS # Countervalue at Operation Date
printf $11 OFS # Countervalue at CSV Export
printf("%.8f", $6); printf OFS # Operation Fees
printf $7 OFS # Operation Hash
printf $8 OFS # Account Name (subaccount)
printf $9 OFS # Account xpub
printf $10 OFS # Countervalue Ticker
printf $11 OFS # Countervalue at Operation Date
printf $12 OFS # Countervalue at CSV Export
direction=($3 ~ /^OUT$|^DELEGATE$/ ? "OUT" : "IN")
direction=($4 ~ /^OUT$|^DELEGATE$/ ? "OUT" : "IN")
printf direction
printf "\n"

View File

@@ -15,7 +15,7 @@
# 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,currency_,type,amount_,fees,txid,account_name,xpub,counter_symbol,countervalue_at_op,countervalue_at_export,direction
fields date,status_,currency_,type,amount_,fees,txid,account_name,xpub,counter_symbol,countervalue_at_op,countervalue_at_export,direction
date-format %Y-%m-%d %H:%M:%S
description %date +0000
@@ -23,7 +23,7 @@ description %date +0000
account1 assets:ledger:%account_name:%currency_
amount %amount_ %currency_
comment type:%type, xpub:%xpub, txid:%txid, direction:%direction
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction
if %type ^OUT$
amount -%amount_ %currency_
@@ -41,7 +41,7 @@ if %type ^OUT$
amount3 -%fees %currency_
account4 expenses:ledger:fees:%account_name:%currency_
amount4 %fees %currency_
comment type:%type, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment2
comment3 %date +0000,SPEND,ledger,%currency_,%fees,USD,,FEE
# NOTE: comment3 apparently doesn't work (without comment2?) so use comment2 here.
@@ -84,7 +84,7 @@ if %currency_ ^ADA$
amount3 -%fees %currency_
account4 expenses:ledger:fees:%account_name:%currency_
amount4 %fees %currency_
comment type:%type, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment3 %date +0000,SPEND,ledger,%currency_,%fees,USD,,FEE
# Will be delegate-key amount, not pledged amount
@@ -97,7 +97,7 @@ if %currency_ ^ADA$
amount3 -%amount_ %currency_
account4 expenses:ledger:fees:%account_name:%currency_
amount4 %amount_ %currency_
comment type:%type, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment type:%type, status:%status_, xpub:%xpub, txid:%txid, direction:%direction, taxed_as:SPEND
comment2 Stake key registration withdrawal
comment3 %date +0000,SPEND,ledger,%currency_,%amount_,USD,,FEE
@@ -121,7 +121,7 @@ if %currency_ (^WETH$|^WBTC$)
skip
# Aave aTokens TODO: expand as needed
if %currency_ (^stkAAVE$|^aWETH$|^aSNX$|^aGUSD$)
if %currency_ (^stkAAVE$|^aWETH$|^aEthWETH$|^aSNX$|^aGUSD$)
skip
# Compound cTokens TODO: expand as needed