From d40f1c7c9347c6c3b6a61cb3abd6a5c19d93ab1e Mon Sep 17 00:00:00 2001 From: juanlf Date: Sun, 15 Jun 2025 13:55:28 +0200 Subject: [PATCH] =?UTF-8?q?Versi=C3=B3n=201=20-=20KEY=20Works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spot-record.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 spot-record.sh diff --git a/spot-record.sh b/spot-record.sh new file mode 100755 index 0000000..c28d308 --- /dev/null +++ b/spot-record.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# === CONFIGURACIÓN: Tus credenciales === +API_KEY="bg_28730a088b4b71c307ed5773b84d8267" +API_SECRET="f7e4872f828c99612df009c3641421fc41d9dfb9cfc56dce3311fdaae70f5b29" +PASSPHRASE="cQTVzepB6KuFWgWLgCpB6kW84iiqJr3u" + +# === ENDPOINT Y PARÁMETROS === +METHOD="GET" +BASE_URL="https://api.bitget.com" +ENDPOINT="/api/v2/tax/spot-record" + +# Rango de tiempo: del 1 al 30 de enero de 2025 (máx. permitido) +START_TIME="1735689600000" # 2025-01-01 00:00:00 UTC +END_TIME="1738272000000" # 2025-01-31 00:00:00 UTC +LIMIT="100" + +QUERY_STRING="startTime=${START_TIME}&endTime=${END_TIME}&limit=${LIMIT}" +FULL_URL="${BASE_URL}${ENDPOINT}?${QUERY_STRING}" + +# === TIMESTAMP oficial desde Bitget === +TIMESTAMP=$(curl -s https://api.bitget.com/api/v2/public/time | jq -r '.data.serverTime') + +# === STRING A FIRMAR === +PREHASH="${TIMESTAMP}${METHOD}${ENDPOINT}?${QUERY_STRING}" + +# === FIRMA BASE64 === +SIGNATURE=$(echo -n "${PREHASH}" | openssl dgst -sha256 -hmac "${API_SECRET}" -binary | base64) + +# === PETICIÓN FIRMADA === +curl -s "${FULL_URL}" \ + -H "ACCESS-KEY: ${API_KEY}" \ + -H "ACCESS-SIGN: ${SIGNATURE}" \ + -H "ACCESS-TIMESTAMP: ${TIMESTAMP}" \ + -H "ACCESS-PASSPHRASE: ${PASSPHRASE}" \ + -H "Content-Type: application/json" \ + -H "locale: en-US" \ + | jq . \ No newline at end of file