Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions on initial set up #3

Open
AricLux opened this issue Dec 6, 2019 · 6 comments
Open

Questions on initial set up #3

AricLux opened this issue Dec 6, 2019 · 6 comments

Comments

@AricLux
Copy link

AricLux commented Dec 6, 2019

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_PUBLIC_KEY = "pk_..."
IEXCLOUD_SECRET_KEY = "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
Copy link
Owner

IEXCLOUD_API_VERSION = "https://cloud.iexapis.com/stable/"
IEXCLOUD_PUBLIC_KEY = "pk_..."
IEXCLOUD_SECRET_KEY = "sk_..."

need to be set in the environment.

@AricLux
Copy link
Author

AricLux commented Jan 19, 2020

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
Copy link
Owner

try

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

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

@no-dice-io
Copy link
Contributor

no-dice-io commented Oct 8, 2020

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
Copy link

sschiwek commented Jan 21, 2021

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
Copy link

george276 commented Feb 15, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants