The REST API TradesHistory endpoint can be used to retrieve the entire trading history for your account.
The TradesHistory endpoint will return up to 50 trades per request in reverse chronological order (the most recent trades first), and provides a pagination offset parameter (ofs) to retrieve subsequent groups (pages) of up to 50 trades each.
For example, calling the TradesHistory endpoint without an offset parameter or with an offset of zero (ofs=0) would return the most recent 50 trades for your account, while calling TradesHistory with an offset of 50 (ofs=50) would return the next group of 50 trades (the 51st to 100th trades).
Example code (Python with krakenex library)
#!/usr/bin/env python3
# pretty-print the TradesHistory 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('TradesHistory', {'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
# pretty-print the TradesHistory 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('TradesHistory', {'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