Client_Id in Bitstamp's Api
In Bitstamp's Api Documentation, a Client_Id Is Mentioned. It Is Used to Generate a Signature. but I Couldn't Find How I Can Get That Client_Id. Any Hint on...
In Bitstamp's API documentation, a client_id is mentioned. It is used to generate a signature.
But I couldn't find how I can get that client_id.
Any hint on that? Many thanks.
4 Answers
Did you register for an API key via their instructions? They say:
To get an API key, go to "Account", "Security" and then "API Access". Set permissions and click "Generate key".`
Once you have the API key, you use a HMAC encoded of the API key, API secret, and your customer/client id. You should be able to get your client id by going to the "Account Balance" page, where I believe it's referred to as your "Customer ID".
Use this code to get idea. This is Ruby code
require 'open-uri'
require 'json'
require 'base64'
require 'openssl'
require 'hmac-sha2'
require 'net/http'
require 'net/https'
require 'uri'
def bitstamp_private_request(method, attrs = {})
secret = "xxx"
key = "xxx"
client_id = "xxx"
nonce = nonce_generator
message = nonce + client_id + key
signature = HMAC::SHA256.hexdigest(secret, message).upcase
url = URI.parse("")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
data = {
nonce: nonce,
key: key,
signature: signature
}
data.merge!(attrs)
data = data.map { |k,v| "#{k}=#{v}"}.join('&')
headers = {
'Content-Type' => 'application/x-www-form-urlencoded'
}
resp = http.post(url.path, data, headers)
console_log ""
resp.body
end
def nonce_generator
(Time.now.to_f*1000).to_i.to_s
end
The page where you change password on Bitstamp presents you your client id (contains letters and digits).
I have some probelm with bitstamp api
below is my code php
$message = $nonce.$client_id.$api_key;
$signature = strtoupper(hash_hmac('sha256', $message, $secret_key));
$post_string = 'api_key='.$api_key.'&signature='.$signature.'&nonce='.$nonce;
$url = "";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
$json = curl_exec($ch);
if(!$json) {
echo curl_error($ch);
}
curl_close($ch);
$tempData = json_decode($json);
print_r($tempData);<br>
Output:
stdClass Object ( [error] => Missing key, signature and nonce parameters )