계정 거래 내역을 검색하는 방법

최종 업데이트: More than 3 months ago

REST API TradesHistory 엔드포인트를 사용하여 계정의 전체 거래 내역을 검색할 수 있습니다.

TradesHistory 엔드포인트는 요청당 최대 50개의 거래를 역순(가장 최근 거래부터)으로 반환하며, 다음 그룹(페이지)의 최대 50개 거래를 검색하기 위한 페이지네이션 오프셋 파라미터(ofs)를 제공합니다.

예를 들어, 오프셋 파라미터 없이 또는 오프셋을 0(ofs=0)으로 하여 TradesHistory 엔드포인트를 호출하면 계정의 가장 최근 50개 거래가 반환되고, 오프셋을 50(ofs=50)으로 하여 TradesHistory를 호출하면 다음 50개 거래 그룹(51번째부터 100번째 거래)이 반환됩니다.

예시 코드 (krakenex 라이브러리를 사용한 Python)

#!/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

더 많은 도움이 필요하신가요?