R Проблема с авторизацией с использованием `credentials $ OAuthRequest (tkURL, query)` - PullRequest
0 голосов
/ 15 февраля 2020

Я использую R для получения торговых данных с торговой платформы Ally. Следующий скрипт работает отлично, за исключением авторизации с использованием:

 response <- credentials$OAuthRequest(tkURL, query)

Может ли кто-нибудь помочь мне понять, почему я не авторизируюсь? Ключи и секретные строки скопированы из моей учетной записи, поэтому он должен работать.

> library(ROAuth)
> library(RJSONIO)
> # Set your application keys
> cKey <- '####################' # the actual key is not shown
> cSecret <- '##########################'  # the actual secret is not shown
> oKey <- '#################################'  # the actual key is not shown
> oSecret <- '########################'  # the actual secret is not shown
> # Set the API endpoint
> tkURL <- "https://api.tradeking.com/v1/market/ext/quotes.json"
> # Create the OAuth connection - this is straight from the ROAuth documentation on CRAN
> credentials <- OAuthFactory$new(consumerKey=cKey, consumerSecret=cSecret, oauthKey = oKey, oauthSecret = oSecret, needsVerifier=FALSE, signMethod='HMAC')
> # Update the connection so the handshake is TRUE
> credentials$handshakeComplete <- TRUE
> # Create the parameters to be passed with the GET request
> query <- list()
> query[[ "symbols" ]] <- "aapl, ibm, goog"
> query[[ "fids" ]] <- "last,bid,ask"
> # Make the GET request, passing along the parameters, storing the response, then parsing the response
> response <- credentials$OAuthRequest(tkURL, query)
Error: Unauthorized
...