I am trying to check my Perpetual Swap contracts on Okex Exchange, from the terminal. I am using openssl to make the HMAC SHA256 signature. But so far I am only getting a "code":405," error, and the docs are not very insightful: https://www.okex.com/docs/en/#summary-yan-zheng
I wonder if someone who has more experience with the Okex Rest Api could help with this script?
#!/bin/bash
API_KEY=xxxxxx
API_SECRET=yyyyy
PASSPHRASE=zzzzzzzz
TIMESTAMP=$(date --utc +%FT%T.%3NZ)
TYPE='POST'
ENDPOINT='/api/swap/v3/BTC-USD-SWAP/position'
MESSAGE=$(printf "%s+%s+%s" "$TIMESTAMP" "$TYPE" "$ENDPOINT")
SIGNED_MESSAGE=$(echo -n "$MESSAGE" | openssl dgst -sha256 -hmac $API_SECRET -binary | base64 | tr -d "\n")
curl 'https://www.okex.com' \
--header "Content-Type: application/json" \
--request POST \
--data "\{\"OK-ACCESS-SIGN\":$SIGNED_MESSAGE, \"OK-ACCESS-KEY\":$API_KEY, \"OK-ACCESS-TIMESTAMP\":$TIMESTAMP, \"OK-ACCESS-PASSPHRASE\":$PASSPHRASE\}"