我无法获得Bluetrade API私人函数调用工作

问题描述 投票:1回答:1

这是他们的PHP Examaple。你可以在https://bleutrade.com/help/API找到整个api

$apikey = 'YOUR_API_KEY';
$apisecret = 'YOUR_API_SECRET';
$nonce = time();
$uri = 'https://bleutrade.com/api/v2/account/getbalances?                        
apikey='.$apikey.'&nonce='.$nonce;
$sign = hash_hmac('sha512',$uri,$apisecret);
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign)); // you can 
add the signature at the end of the uri if you prefer: &apisign=...
$execResult = curl_exec($ch);
$obj = json_decode($execResult);

下面是我的VB代码

    Dim sApiKey As String = "Enter API Key"
    Dim sApiSecret As String = "Enter API Secret Key"

    Dim sURI As String = "https://bleutrade.com/api/v2/account/getbalances?apikey=" + sApiKey
    Dim secretkey() As Byte = System.Text.Encoding.ASCII.GetBytes(sApiSecret)
    Dim uri() As Byte = System.Text.Encoding.ASCII.GetBytes(sURI)
    Dim myhmac As New HMACSHA512(secretkey)
    Dim bSign As Byte() = myhmac.ComputeHash(uri)
    Dim wrGETURL As WebRequest

    wrGETURL = WebRequest.Create(sURI)
    wrGETURL.Headers.Add("apsign:" & Convert.ToBase64String(bSign))
    Dim objStream As Stream
    objStream = wrGETURL.GetResponse.GetResponseStream()

    Dim objReader As New StreamReader(objStream)
    Dim sLine As String = ""
    Dim i As Integer = 0

    Do While Not sLine Is Nothing
        i += 1
        sLine = objReader.ReadLine
        If Not sLine Is Nothing Then

        End If
    Loop

我收到错误{“成功”:“错误”,“消息”:“无效的apikey或apisecret”,“结果”:[]}

我已经尝试过两次获得一个新的api密钥。

非常感谢万亿,无论你能用什么智慧。

.net vb.net api
1个回答
0
投票

wrGETURL.Headers.Add("apsign:" & Convert.ToBase64String(bSign))

尝试正确拼写apisign。另外,我认为你不需要对它进行base64编码,只需HEX编码即可。

© www.soinside.com 2019 - 2024. All rights reserved.