Bitcoin Forum
May 04, 2024, 01:34:52 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Kraken API Internal Error  (Read 97 times)
sharkann (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 28, 2018, 06:23:17 AM
 #1

Hello Gentlemen,

Recently I wanted to develop a trading bot in VB.net. I finally succeed in turning all the C, PHP and Python codes I saw in different forums (+ Kraken help) to a VB version, that seems to communicate with Kraken API with no "Invalid Key" or "Invalid Signature" errors.
Now I have a "Internal Error" from my request.

Has anyone experienced the same issue ?

Thanks !
Sharkann

Here is my code :

 Private Function QueryPrivate(a_sMethod As String, Optional data As String = Nothing) As String

    Dim base_url = "https://api.kraken.com"
         Dim _uri = "/0/private/Balance"

           Dim _key = XXX
           Dim _secret =YYY

           Dim nonce As Int64 = DateTime.Now.Ticks
           Dim post_data = Convert.ToString("nonce=" & nonce.ToString()) & data
        Dim url = base_url & _uri
        Dim webRequest__1 As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
        webRequest__1.ContentType = "application/x-www-form-urlencoded"
        webRequest__1.Method = "POST"
        webRequest__1.Headers.Add("API-Key", _key)

        Dim hash256Bytes = GenerateSHA256Bytes(nonce & post_data)

           'create the array [path + sha256(none + post data)]
           Dim pathBytes = Encoding.UTF8.GetBytes(_uri)
           Dim z(pathBytes.Length + (hash256Bytes.Length - 1)) As Byte
        pathBytes.CopyTo(z, 0)
           hash256Bytes.CopyTo(z, pathBytes.Length)

           Dim signature = GenerateHMACS_SHA512Bytes(z, _secret)
        webRequest__1.Headers.Add("API-Sign", Convert.ToBase64String(signature))

            Using webResponse As WebResponse = webRequest__1.GetResponse()
                Using str As Stream = webResponse.GetResponseStream()
                    Using sr As New StreamReader(str)
                        Dim responseContent3 As String = sr.ReadToEnd
                        Return responseContent3
                    End Using
                End Using
            End Using
       
    End Function
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!