Authentication
use GuzzleHttp\\Client;
public function callApi()
{
$apiKey = '';
$apiSecret = '';
$request = ''; // /api/v1/order/new
$baseUrl = '<http://coinsbit.io>';
$data = [
'request' => $request,
'nonce' => (string)\\Carbon\\Carbon::now()->timestamp,
];
$completeUrl = $baseUrl . $request;
$dataJsonStr = json_encode($data, JSON_UNESCAPED_SLASHES);
$payload = base64_encode($dataJsonStr);
$signature = hash_hmac('sha512', $payload, $apiSecret);
$client = new Client();
try {
$res = $client->post($completeUrl, [
'headers' => [
'Content-type' => 'application/json',
'X-TXC-APIKEY' => $apiKey,
'X-TXC-PAYLOAD' => $payload,
'X-TXC-SIGNATURE' => $signature
],
'body' => json_encode($data, JSON_UNESCAPED_SLASHES)
]);
} catch (\\Exception $e) {
return response()->json(['error' => $e->getMessage()]);
}
return response()->json(['result' => json_decode($res->getBody()->getContents())]);
}
Public API
/api/v1/public/markets
/api/v1/public/tickers
/api/v1/public/ticker
/api/v1/public/book
/api/v1/public/history
/api/v1/public/history/result
/api/v1/public/products
/api/v1/public/symbols
/api/v1/public/depth/result