csv: examples: more coinbase rules

[ci skip]
This commit is contained in:
Simon Michael 2018-07-16 06:30:09 +01:00
parent 37be414885
commit f62e308c9c
4 changed files with 79 additions and 19 deletions

View File

@ -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

View File

@ -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) # (https://www.coinbase.com/reports, type: transaction history)
# Sample:
# sample:
# Transactions # Transactions
# User,user@example.com,1234abcd # User,user@example.com,1234abcd
# Account,BTC Wallet,1111aaaa # 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-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,"" # 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 include coinbase-common.rules
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 account1 assets:coinbase:btc
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

View File

@ -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

View File

@ -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