Я хочу разместить заказ с помощью bitmex api, но мой код не работает.
Сообщение об ошибке: {"error": {"message": "Подпись недействительна.", "Name": "HTTPError "}}
https://testnet.bitmex.com/app/apiKeysUsage#full -счет-расчет
$key = ""; /* api key */
$sec = ""; /* api secret */
$url = "https://testnet.bitmex.com/api/v1/order";
$verb = "POST";
$path = "/api/v1/order";
$exp = str_replace(".", "", microtime(true)); /* expires */
$data = array(
"symbol" => "XBTUSD",
"side" => "Buy",
"price" => 7500,
"ordType" => "Limit",
"orderQty" => 3, /* quantity */
"currency" => "USD",
"settlCurrency" => "XBt",
"displayQty" => 0,
"timeInForce" => "GoodTillCancel",
"ordStatus" => "New",
);
$data = json_encode($data);
$signature = hash_hmac("sha256", $sec, $verb . $path . $exp . $data);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => array(
"api-key: $key",
"api-signature: $signature",
"api-nonce: " . $exp,
'Content-Type: application/x-www-form-urlencoded',
'Accept: application/json',
'X-Requested-With: XMLHttpRequest',
),
));