1
我编写了一个代码来访问hitbtc API。它不起作用。我复制了hitbtc提供的代码。有用。我想看看我的原始代码出了什么问题。所以我把代码并排放置。事实上,为了确保没有误解,我慢慢地从hitbtc中更改了正确的代码,并用由错误代码计算得出的变量替换。这两行代码几乎完全一样,但它们产生不同的结果
结果是不同的。
第一个代码仍然失败。第二个代码正在工作。
我不知道为什么。
只要看看这些。这是相同的代码。这使用像一次使用完全相同的变量。
Dim nonce = exchanges.getNonce().ToString
代码紧接着此代码不能正常工作
Dim wc = New RestClient("https://api.hitbtc.com")
Dim request = New RestRequest("/api/1/trading/balance", Method.GET)
request.AddParameter("nonce", nonce)
request.AddParameter("apikey", _apiKey)
Dim texttobeSigned = wc.BuildUri(request).PathAndQuery()
Dim sigHash2 = CalculateSignature1(texttobeSigned, _secret)
request.AddParameter("X-Signature", sigHash2)
Dim response = wc.Execute(request)
'Dim sigsig1 = String.Concat(hasher.Hash.Select(Function(x) x.ToString("x2")).ToArray())
Dim content = response.Content '"{"error":{"code":1001,"message":"Missing signature header parameter","description":""}}"
,我这样做。这一个工程。
wc = New RestClient("https://api.hitbtc.com")
request = New RestRequest("/api/1/trading/balance", Method.GET)
request.AddParameter("nonce", nonce)
request.AddParameter("apikey", _apiKey)
request.AddHeader("X-Signature", sigHash2)
response = wc.Execute(request)
content = response.Content '{"balance":[{"currency_code":"1ST","cash":"0","reserved":"0"},{"currency_code":"8BT","cash":"0","reserved":"0"},{"
Copuld这可能是因为您在第一个代码使用相同的'RestClient'两次?这是一个完整的刺在黑暗中,但它只是我能看到的唯一区别。 – jmcilhinney
在第一个模块中,您使用'.AddParameter(“X-Signature”,..',而在第二个模块中,您有'.AddHeader(“X-Signature”,..'。 –
AHHHHHHhhhh。这就是问题 –