RのDELETE
リクエストに問題があります。下記のコードを使用してGET
とPOST
リクエストを作成しました。どんな助け/ポインタも高く評価されます。R GDAX-API削除リクエスト
GDAXのapi.key
,secret
& passphrase
が必要です。私が手
library(RCurl)
library(jsonlite)
library(httr)
library(digest)
cancel_order <- function(api.key,
secret,
passphrase) {
api.url <- "https://api.gdax.com"
#get url extension----
req.url <- "/orders/"
#define method----
method = "DELETE"
url <- paste0(api.url, req.url)
timestamp <-
format(as.numeric(Sys.time()), digits = 13) # create nonce
key <- base64Decode(secret, mode = "raw") # encode api secret
#create final end point----
what <- paste0(timestamp, method, req.url)
#create encoded signature----
sign <-
base64Encode(hmac(key, what, algo = "sha256", raw = TRUE)) # hash
#define headers----
httpheader <- list(
'CB-ACCESS-KEY' = api.key,
'CB-ACCESS-SIGN' = sign,
'CB-ACCESS-TIMESTAMP' = timestamp,
'CB-ACCESS-PASSPHRASE' = passphrase,
'Content-Type' = 'application/json'
)
##------------------------------------------------
response <- getURL(
url = url,
curl = getCurlHandle(useragent = "R"),
httpheader = httpheader
)
print(rawToChar(response)) #rawToChar only on macOS and not on Win
}
エラーは同じコマンドは、コードし、署名がGET
& POST
で動作しますにもかかわらず"{\"message\":\"invalid signature\"}"
です:
は、ここに私の関数です。
エンドポイントは2つあります。 1つはすべてを取り消し、もう1つは注文を取り消す。私が注文IDを紛失していた場合、無効な署名ではなく、悪い要求があったでしょう。 – Drj