diff --git a/examples/csv/coinbase-all.csv.rules b/examples/csv/coinbase-all.csv.rules new file mode 100644 index 000000000..2efc46903 --- /dev/null +++ b/examples/csv/coinbase-all.csv.rules @@ -0,0 +1,29 @@ +# hledger CSV rules for coinbase combined transaction history CSV +# (https://www.coinbase.com/tax-center, Transaction History (All)) + +skip 3 +fields timestamp,transaction_type,asset,quantity_transacted,usd_spot_price_at_transaction,usd_amount_transacted_inclusive_of_coinbase_fees,address,notes + +date %timestamp +date-format %m/%d/%Y +description %notes +comment price-excl-fees:$%usd_spot_price_at_transaction + +account1 assets:personal:online:coinbase +if ,BCH, + account1 assets:personal:online:coinbase:bch +if ,BTC, + account1 assets:personal:online:coinbase:btc +if ,ETH, + account1 assets:personal:online:coinbase:eth +if ,LTC, + account1 assets:personal:online:coinbase:ltc + +currency %asset + +amount %quantity_transacted @@ $%usd_amount_transacted_inclusive_of_coinbase_fees +if ,(Sell|Send), + amount -%quantity_transacted @@ $%usd_amount_transacted_inclusive_of_coinbase_fees + +if ,(Buy|Receive), + account2 assets:bank:checking diff --git a/examples/csv/coinbase-btc.csv.rules b/examples/csv/coinbase-btc.csv.rules index c432adfdf..887870555 100644 --- a/examples/csv/coinbase-btc.csv.rules +++ b/examples/csv/coinbase-btc.csv.rules @@ -1,7 +1,6 @@ -# hledger conversion rules for coinbase report CSV +# Specific hledger CSV rules for coinbase per-account reports # (https://www.coinbase.com/reports, type: transaction history) - -# sample: +# Sample: # Transactions # User,user@example.com,1234abcd # Account,BTC Wallet,1111aaaa @@ -10,20 +9,6 @@ # 2017-04-06 17:09:04 -0700,0.04182499,0.04182499,BTC,1111aaaa,Bought 0.04182499 BTC for $52.00 USD.,false,52.0,USD,2.0,USD,Visa debit ********1234,2222bbbb,"","","","","","",3333cccc,4444dddd,"" # 2017-04-09 10:55:56 -0700,0.04973356,0.00790857,BTC,1111aaaa,Bought 0.00790857 BTC for $10.00 USD.,false,10.0,USD,0.38,USD,Visa debit ********1234,5555eeee,"","","","","","",3333cccc,6666ffff,"" -skip 4 -fields date, balance, amount, currency, to, notes, instantly_exchanged, transfer_total, etc... -date-format %Y-%m-%d %T %z -account1 assets:online:coinbase:btc wallet -description %notes -# add a trailing space to currency: -currency %currency +include coinbase-common.rules -if Visa debit.*1234 - account2 assets:bank:checking -# TODO want BTC on account1 posting, $ on account2 posting - -# if there's a transfer total, add that as price -# The double quotes enclosing each field have been removed at this point. -# TODO when supported, we'll set the other posting's amount instead -if ^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]+ - amount %amount @@ $%transfer_total +account1 assets:coinbase:btc diff --git a/examples/csv/coinbase-common.rules b/examples/csv/coinbase-common.rules new file mode 100644 index 000000000..0eae56852 --- /dev/null +++ b/examples/csv/coinbase-common.rules @@ -0,0 +1,32 @@ +# Common hledger CSV rules for coinbase per-account reports +# (https://www.coinbase.com/reports, type: transaction history) +# Sample: +# Transactions +# User,user@example.com,1234abcd +# Account,BTC Wallet,1111aaaa +# +# Timestamp,Balance,Amount,Currency,To,Notes,Instantly Exchanged,Transfer Total,Transfer Total Currency,Transfer Fee,Transfer Fee Currency,Transfer Payment Method,Transfer ID,Order Price,Order Currency,Order BTC,Order Tracking Code,Order Custom Parameter,Order Paid Out,Recurring Payment ID,Coinbase ID (visit https://www.coinbase.com/transactions/[ID] in your browser),Bitcoin Hash (visit https://www.coinbase.com/tx/[HASH] in your browser for more info) +# 2017-04-06 17:09:04 -0700,0.04182499,0.04182499,BTC,1111aaaa,Bought 0.04182499 BTC for $52.00 USD.,false,52.0,USD,2.0,USD,Visa debit ********1234,2222bbbb,"","","","","","",3333cccc,4444dddd,"" +# 2017-04-09 10:55:56 -0700,0.04973356,0.00790857,BTC,1111aaaa,Bought 0.00790857 BTC for $10.00 USD.,false,10.0,USD,0.38,USD,Visa debit ********1234,5555eeee,"","","","","","",3333cccc,6666ffff,"" + +skip 4 +fields date, balance, amount, currency, to, notes, instantly_exchanged, transfer_total, etc... +date-format %Y-%m-%d %T %z +account1 assets:online:coinbase:btc wallet +description %notes +# add a trailing space to currency: +currency %currency + +if Visa debit.*1234 + account2 assets:bank:checking +# TODO want BTC on account1 posting, $ on account2 posting + +if Brave wallet + account2 expenses:business:dues + +# if there's a transfer total, add that as price +# The double quotes enclosing each field have been removed at this point. +# TODO when supported, we'll set the other posting's amount instead +if ^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]+ + amount %amount @@ $%transfer_total + diff --git a/examples/csv/coinbase-usd.csv.rules b/examples/csv/coinbase-usd.csv.rules new file mode 100644 index 000000000..17fecd699 --- /dev/null +++ b/examples/csv/coinbase-usd.csv.rules @@ -0,0 +1,14 @@ +# Specific hledger CSV rules for coinbase per-account reports +# (https://www.coinbase.com/reports, type: transaction history) +# Sample: +# Transactions +# User,user@example.com,1234abcd +# Account,BTC Wallet,1111aaaa +# +# Timestamp,Balance,Amount,Currency,To,Notes,Instantly Exchanged,Transfer Total,Transfer Total Currency,Transfer Fee,Transfer Fee Currency,Transfer Payment Method,Transfer ID,Order Price,Order Currency,Order BTC,Order Tracking Code,Order Custom Parameter,Order Paid Out,Recurring Payment ID,Coinbase ID (visit https://www.coinbase.com/transactions/[ID] in your browser),Bitcoin Hash (visit https://www.coinbase.com/tx/[HASH] in your browser for more info) +# 2017-04-06 17:09:04 -0700,0.04182499,0.04182499,BTC,1111aaaa,Bought 0.04182499 BTC for $52.00 USD.,false,52.0,USD,2.0,USD,Visa debit ********1234,2222bbbb,"","","","","","",3333cccc,4444dddd,"" +# 2017-04-09 10:55:56 -0700,0.04973356,0.00790857,BTC,1111aaaa,Bought 0.00790857 BTC for $10.00 USD.,false,10.0,USD,0.38,USD,Visa debit ********1234,5555eeee,"","","","","","",3333cccc,6666ffff,"" + +include coinbase-common.rules + +account1 assets:coinbase:usd