Hey Dargo
Could you please talk to your developers to increase the number of calls from the API or find another solution?
I'm using the website "
www.coinreporting.com". It's a very useful website to have an overview of all the trades I made.
Unfortunately there is at the moment only one way to import the Kraken Trades. The Import works with the API. But the problem is that it only allows 50 calls, so I'm only able to import my last 50 trades.. but I need something like x thousand for my trades. =/
I don't know much about API's, but I think you made the 50 limit for a reason and I think you won't rase this to 10 thousand or something like this. So maybe there is another solution. How about a csv export or something simular for the trade history?
Hi Serpens,
I've been pushing for CSV export for a long time now. Our developers are somewhat snowed under with projects at the moment though, so it may not happen until we hire more developers (which we're in the process of doing right now).
As for the API, you can call all your trade history, but you probably can't do it directly through coinreporting.com. You need a script to do it because it'll require many calls to get all the data for an active trader. I believe you can only get historical data for 50 trades at a time, so you have to make many coordinated calls to get all your data. There's a sample script for doing this here:
https://github.com/matuszed/KrakenToolsKeep in mind that you may have to adjust the 'max' and 'window' parameters (set at 10/10 seconds in the script) if you hit the rate limit. I realize this won't help those who don't have at least basic familiarity with running script, but it's the best solution for now until we get CSV export.
Alternatively, you can download whole private trades history to csv using R and Rbitcoin package, in a little bit more elegant script, performed in HPC, with appropriate data types conversion
library(Rbitcoin)
options(digits.secs=4) # kraken time precision
req <- NULL
resDT <- data.table() # storage for results
repeat{
Rbitcoin:::antiddos("kraken", antispam_interval=11, verbose=1)
resList <- market.api.query(market = 'kraken', url = 'https://api.kraken.com/0/private/TradesHistory',
req = req,
key = '',
secret = '')
if(length(resList$error)>0) stop(paste("kraken market api error:",resList$error))
if((length(resList$result$trades)>0 & is.null(req)) | (length(resList$result$trades)>1 & !is.null(req))){
if(!is.null(req)) resList$result$trades[[1]] <- NULL #filter out row previously loaded
req <- list(end = names(resList$result$trades[length(resList$result$trades)]))
resDT <- rbindlist(list(
resDT,
data.table(txid = names(resList$result$trades), rbindlist(resList$result$trades)[,c("price","cost","fee","vol","margin") := lapply(.SD, as.numeric),.SDcols=c("price","cost","fee","vol","margin")][,`:=`(time=as.POSIXct(time,origin="1970-01-01",tz="UTC"))])
))
cat(paste0("\n",as.character(Sys.time()),": added ",length(resList$result$trades)," rows"))
} else {
cat(paste0("\n",as.character(Sys.time()),": completed"))
break # empty batch
}
# next batch
}
# save to csv (csv2 for EU, csv for US)
write.csv2(resDT,'private_trades_history.csv',row.names=FALSE)
# aggregate to orders using R data.table and then save
dt <- resDT[,list(time_start = min(time), time_end = max(time), tx_count = length(unique(txid)), price = sum(price*vol)/sum(vol), cost = sum(cost), fee = sum(fee), vol = sum(vol)), by=c("ordertxid","pair","type")]
write.csv2(dt,'private_filled_orders_history.csv',row.names=FALSE)