To export your trades or ledger history via API, follow these steps:
- 1Generate an API key with the relevant permissions.- Click on your name in the upper-right corner of the page.- Click on Security and navigate to the API Settings.- Press the Add key button.- Select these key permissions:- "Export Data"- "Query Ledger Entries" (for Ledger exports)- "Query Closed Orders & Trades" (for Trades exports)- Press the Generate key button.
- 2Install Kraken's REST API command line client.
- 3Run the relevant API commands.You can now easily run all the API commands from our API guide. Relevant commands for account history include:- AddExport (make an export request)- ExportStatus (see if an export request is "processed" or still"queued")- RetrieveExport (download a processed export)- RemoveExport (delete export request)
Example
Lets use the AddExport command to request:
Ledger history for 2018
./krakenapi.py AddExport description=MyLedgerHistory2018 report=ledgers starttm=1514764800 endtm=1546300799
Trades history for 2018
./krakenapi.py AddExport description=MyTradesHistory2018 report=trades starttm=1514764800 endtm=1546300799
Note: you need to use the UNIX timestamp for start and end times.
After successfully running the AddExport command, you can go to the History > Export page on Kraken.com to view your request's status, download it, or delete it.
Alternatively, you can complete these further actions by using the other API commands listed above.