schardtbc / iexcloudR

iexcloud api wrapper
16 stars 5 forks source link

Questions on initial set up #3

Open AricLux opened 4 years ago

AricLux commented 4 years ago

Hi there:

I'm working on getting the API set up for the first time. I followed the instructions you lay out but encounter the following problem. Code below:

install_github("schardtbc/iexcloudR") library("iexcloudR")

IEXCLOUD_API_VERSION = "https://cloud.iexapis.com/stable/" IEXCLOUD_PUBLICKEY = "pk..." IEXCLOUD_SECRETKEY = "sk..."

But I get the following error:

historyFor("AAPL") Error in addToken(endpoint) : missing IEXCLOUD_PRIVATE_KEY value

I don't see any reference to a "Private Key" in the docs or in your instructions. Any advice?

schardtbc commented 4 years ago

IEXCLOUD_API_VERSION = "https://cloud.iexapis.com/stable/" IEXCLOUD_PUBLICKEY = "pk..." IEXCLOUD_SECRETKEY = "sk..."

need to be set in the environment.

AricLux commented 4 years ago

Thanks Bruce. You'll have to forgive me ignorance. I tried setting the keys as follows:

IEXCLOUD_API_VERSION = "https://cloud.iexapis.com/stable/" IEXCLOUD_PUBLIC_KEY = "pk_382d318a24f14e68918cfxxxxxxxx" IEXCLOUD_SECRET_KEY = "sk_656b4a58fa3f4d439e486xxxxxxxx"

setSecretKey(IEXCLOUD_SECRET_KEY) setToken(IEXCLOUD_PUBLIC_KEY)

Which seemed to work slightly better, but now I get the below message instead when I try to get history for TSLA:

historyFor("TSLA")

A tibble: 0 x 0 Warning message: IEX API request failed [404] Not Found endpoint requested: /stock/TSLA/chart/1m?chartCloseOnly=FALSE

Thoughts?

-Aric

schardtbc commented 4 years ago

try

url <- constructURL("/stock/TSLA/chart/1m?chartCloseOnly=FALSE")

what is URL? ( block out part of the key)

no-dice-io commented 4 years ago

Hello, I am running into the same issue. In my case, I'm trying to containerize this. I was able to get iexcloudR into my container fine. I've set my key and secret like Aric did above and this is where I'm at when I run constructURL:

constructURL("/stock/TSLA/chart/1m?chartCloseOnly=FALSE") [1] "https://sandbox.iexapis.com//stock/TSLA/chart/1m?chartCloseOnly=FALSE&token=Tpk_f087xxxxxe6d84xxxxxxxxxxxxx"

I should add, when I run this in R studio there are no issues. But inside my container I am getting this issue.

sschiwek commented 3 years ago

Hi guys, I have exactly the same issue. At first, I got the following error code: historyFor("AAPL") Error in addToken(endpoint) : missing IEXCLOUD_PRIVATE_KEY value

After I did what AricLux wrote: EXCLOUD_API_VERSION = "https://cloud.iexapis.com/stable/" IEXCLOUD_PUBLIC_KEY = "pk_382d318a24f14e68918cfxxxxxxxx" IEXCLOUD_SECRET_KEY = "sk_656b4a58fa3f4d439e486xxxxxxxx"

setSecretKey(IEXCLOUD_SECRET_KEY) setToken(IEXCLOUD_PUBLIC_KEY)

I got the same error: historyFor("TSLA") A tibble: 0 x 0 Warning message: IEX API request failed [404] Not Found endpoint requested: /stock/TSLA/chart/1m?chartCloseOnly=FALSE

When I run as schardtbc requested, I get the follwoing:

url <- constructURL("/stock/TSLA/chart/1m?chartCloseOnly=FALSE")

url [1] "https://cloud.iexapis.com//stock/TSLA/chart/1m?chartCloseOnly=FALSE&token=pk_XXXXXXXXXXXXXXXXXXXX"

Any help would be really appreciated!

george276 commented 3 years ago

Hi There,

I am having the same issue in addition to the fact that it is not clear where the following line is to be used (is it like an argument in a function?) or if this is something for us to check and see the state of the entire url used:

url <- constructURL("/stock/TSLA/chart/1m?chartCloseOnly=FALSE")

any thoughts?