# hledger CSV rules for pooltool.io's staking rewards Generic CSV export.
# This CSV includes only the rewards transactions of an address.
# It also includes the current market prices, which can be used to record
# each reward's cost basis.
#
# These are common rules, to be included by a wallet-specific rules file. Eg:
#
#  # wallet1-rewards.rules
#  source rewards_7d899c761869a1f8f36bbd005fdf4475cb7c9ec4b29def5aca3b429a_raw*.csv
#  include pooltool-rewards.csv.rules
#  account1 assets:cc:ada:wallet1:%date
#
# Download CSV:
#  pooltool.io, rewards data for taxes, search for your wallet's staking address or receive address,
#  scroll to the Export Tool at the bottom, Format: Generic(CSV), download data
# 
# Test conversion:
#  hledger -f pooltool-rewards.csv.rules print
#
# Import new transactions to a journal file:
#  hledger -f ada.journal import pooltool-rewards.csv.rules [--dry-run]

skip 1
fields date,epoch,stake,pool,operator_rewards,stake_rewards,total_rewards,rate,currency_,operator_rewards_value,stake_rewards_value,value
date-format %Y-%m-%dT%H:%M:%S%Q%Z

description staking rewards for epoch %epoch from %pool
account2 revenues:cc:ada:rewards:%pool
amount1 ADA  %stake_rewards @ %currency_ %rate
amount2 ADA -%stake_rewards @ %currency_ %rate
