使用 cURL 连接到 OKEX private api?

Connect to OKEX private api using cURL?

我正在尝试从终端检查我在 Okex Exchange 上的永久掉期合约。 我正在使用 openssl 制作 HMAC SHA256 签名。 但到目前为止,我只收到 "code":405," 错误,文档也不是很有见地: https://www.okex.com/docs/en/#summary-yan-zheng

我想知道是否有对 Okex Rest 有更多经验的人 Api 可以帮助这个脚本?

#!/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\}"

本次通话未 post。

GET/api/swap/v3/<instrument_id>/position

类型='GET'

其次是其他电话.. 确保将 (body) 添加到 MESSAGE

-->时间戳+方法+requestPath+json_encode(body)

此致