Trade History

You can access the trade history of your account by using our "Get trades" history call: https://www.kraken.com/en-us/help/api#get-trades-history.

However, this will only retrieve the last 50 trades. To obtain more than 50 trades, you need to use the offset parameter to increment the counter and retrieve the next series of trades in your ledger. Using the python3 wrapper listed on our API, this example utilize the offset ‘ofs’ parameter:

#!/usr/bin/env python3
# pretty-print the ClosedOrders using offset parameter for more than 50 records

import sys
import pprint
import krakenex
import time

k = krakenex.API()
k.load_key('kraken.key')

iterations = 0
offSet = 0

while True:
        iterations +=1
        try:

            response = k.query_private('ClosedOrders', {'ofs': offSet})
            pprint.pprint(response)
            count = response['result']['count']
            print(count)
            offSet += 50
            time.sleep(2)
            print(offSet)
            if (offSet >= 400):
                    print("API offset count is 400 or more")
                    print("We made {0} Calls to the API".format(iterations))
                    raise SystemExit
        except:
            raise SystemExit