;doc: csv: add new coinbase example

This commit is contained in:
Simon Michael 2023-01-19 07:47:00 -10:00
parent c403bb56a1
commit 9c20d7955b

View File

@ -3757,6 +3757,31 @@ The balance assertions don't raise an error above, because we're
reading directly from CSV, but they will be checked if these entries
are imported into a journal file.
### Coinbase
A simple example with some CSV from Coinbase. The spot price is recorded using cost notation.
The legacy `amount` field name conveniently sets amount2 to the total cost.
```csv
# Timestamp,Transaction Type,Asset,Quantity Transacted,Spot Price Currency,Spot Price at Transaction,Subtotal,Total (inclusive of fees and/or spread),Fees and/or Spread,Notes
# 2021-12-30T06:57:59Z,Receive,USDC,100,GBP,0.740000,"","","","Received 100.00 USDC from an external account"
```
```rules
# coinbase.csv.rules
skip 1
fields Timestamp,Transaction_Type,Asset,Quantity_Transacted,Spot_Price_Currency,Spot_Price_at_Transaction,Subtotal,Total,Fees_Spread,Notes
date %Timestamp
date-format %Y-%m-%dT%T%Z
description %Notes
account1 assets:coinbase:cc
amount %Quantity_Transacted %Asset @ %Spot_Price_at_Transaction %Spot_Price_Currency
```
```shell
$ hledger print -f coinbase.csv
2021-12-29 Received 100.00 USDC from an external account
assets:coinbase:cc 100 USDC @ 0.740000 GBP
income:unknown -74.000000 GBP
```
### Amazon
Here we convert amazon.com order history, and use an if block to