Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Coinbase CSV importer #38

Open
501st-alpha1 opened this issue Aug 24, 2017 · 1 comment
Open

Add Coinbase CSV importer #38

501st-alpha1 opened this issue Aug 24, 2017 · 1 comment

Comments

@501st-alpha1
Copy link
Contributor

I'd like to request the ability to import my Coinbase history using ledger-autosync. You can download your Coinbase history as a CSV file here.

What follows is a description of the format of the CSV.

At the top is an extra header section that looks like this:

Transactions
User,username@example.com,0xsomehex
Account,BTC Wallet,0xsomehex

The email address is the one tied to your Coinbase user, and the last line represents which Account you have exported the history for.

Next is the header line, which I've split into one column per line for readability:

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)

Following that are the transactions. I'll give three examples.

First is a time I purchased BTC with a linked bank account.

2017-01-01 12:00:00 -0700,0.1,0.1,BTC,username@example.com,Paid for with $20.00 from Acme Bank - Bank xxxxxxxx1234.,false,20.00,USD,0.30,USD,Acme Bank - Bank ********1234,0xsomehex,"","","","","","","",0xsomehex,0xsomehex

The next two are similar but I'm not sure what the difference in cause was. It could be the first was me manually sending BTC to an address and the second was using the Coinbase integration from a third-party site.

2017-02-01 09:00:00 -0700,0.25,-0.03,BTC,SomeBTCAddress,"",false,"","","","","","",5.0,USD,0.04,ABC123,AABBCC112233,true,"",0xsomehex,0xsomehex

2017-03-01 18:00:00 -0700,0.4,-0.1,BTC,SomeBTCAddress,Merchant Order ABC123,false,"","","","","","",10.0,USD,0.1,ABC123,AABBCC112233,true,"",0xsomehex,""

So the full CSV would look like this:

Transactions
User,username@example.com,0xsomehex
Account,BTC Wallet,0xsomehex

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-01-01 12:00:00 -0700,0.1,0.1,BTC,username@example.com,Paid for with $20.00 from Acme Bank - Bank xxxxxxxx1234.,false,20.00,USD,0.30,USD,Acme Bank - Bank ********1234,0xsomehex,"","","","","","","",0xsomehex,0xsomehex
2017-02-01 09:00:00 -0700,0.25,-0.03,BTC,SomeBTCAddress,"",false,"","","","","","",5.0,USD,0.04,ABC123,AABBCC112233,true,"",0xsomehex,0xsomehex
2017-03-01 18:00:00 -0700,0.4,-0.1,BTC,SomeBTCAddress,Merchant Order ABC123,false,"","","","","","",10.0,USD,0.1,ABC123,AABBCC112233,true,"",0xsomehex,""

For completeness, this is what I would expect ledger-autosync to output:

2017/01/01 Coinbase
    Assets:Acme Bank xxxxxxxx1234          $-20.00
    Expenses:Transfer Fees                   $0.30
    Assets:Coinbase:BTC Wallet              0.1BTC @ $197.00
    ;; csvid: someid
2017/02/01 Unknown
    Assets:Coinbase:BTC Wallet            -0.03BTC @ $166.67
    ;; csvid: someid
    Expenses:Unknown                         $5.00
2017/03/01 Unknown
    Assets:Coinbase:BTC Wallet             -0.1BTC @ $100.00
    ;; csvid: someid
    Expenses:Unknown                        $10.00

Of course, the account names could be slightly different, or if possible we could detect them based on previous Ledger entries.

As a bonus, maybe we could include the Bitcoin Hash and the destination address (above SomeBTCAddress) as tags on the relevant transactions.

Thanks to the Balance column, it should also be possible to include balance assertions if requested.

@egh
Copy link
Owner

egh commented Aug 27, 2017

@501st-alpha1 Thanks for the detailed description. This looks easy enough to support. I'll see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants