0

I am trying to get the latest value/rate for a given pair using the Kraken API, but I cannot really figure it out. Is there anyone that knows how to do it?

I am using the C# code provided on Git (https://github.com/trenki2/KrakenApi) and thought using the following function was the way to go:

client.GetRecentTrades("XETHZEUR",ID)

I however don't want to use an ID, which seems to be optional according to Kraken Website. I just want to know what is the current value, nothing more.

I have also used GetTicker to get the last trade, but this does not come with a Time stamp and will not give the actual currency pair value.

Cheers

progLearner
  • 123
  • 10

1 Answers1

1

Both GetTicker and GetRecentTrades will give you the value of the last trade. You can use either depending on what other data you need. I guess there could be some difference because most likely Kraken caches the results.

Of the two methods above only GetRecentTrades will provide a timestamp.

Alternatively instead of getting the last trade you can call GetOrderBook and calculate the average between the lowest Ask price and highest Bid price.

Daniel P
  • 3,314
  • 1
  • 36
  • 38
  • Thank you for your answer. How would you get the timestamp of the latest trade though? Also, latest trade does not mean "pair value". Is there a way to get that? I guess I could take the mean between latest sale and purchase. – progLearner Feb 12 '18 at 12:41
  • 1
    @progLearner I've expanded on my answer. I think you need to decide what "pair value" means to you because to most people that's the last trade. – Daniel P Feb 12 '18 at 13:23
  • Thanks again. By "pair value", I mean the actual rate at a time t. I guess taking the mean between min and max should be close enough, although there is no guaranty of either order to go through, but that should do as an estimate. – progLearner Feb 12 '18 at 14:40