yogat3ch / AlpacaforR

Connecting to Alpaca API and using it with R
35 stars 20 forks source link

Issue connecting to live account #28

Closed brianfleharty closed 3 years ago

brianfleharty commented 4 years ago

I am having an issue connecting to a live account and am getting error code 40110000 "access key verification failure : verification failure" when calling get account. The paper account works great and I have ensured a new R session was started and keys were entered correctly and from the live account. I wrote to alpaca since this is a newer account a couple weeks old to see if they needed to do something on their end to allow access but wasnt sure what else I may be doing wrong or what I could try. Any help is appreciated.

library(devtools)

library(AlpacaforR)

id<-'my live id'

secret_key<-'my live secret key'

Sys.setenv('APCA-LIVE-API-KEY-ID' = id)

Sys.setenv('APCA-LIVE-SECRET-KEY' = secret_key)

get_account(live = TRUE)

as.matrix(get_account(live=TRUE))

Thanks,

Brian

yogat3ch commented 4 years ago

Hi @brianfleharty, I think you just need to double-check the Readme once more. The environment variables aren't quite right.

Sys.setenv('APCA-PAPER-API-KEY-ID' = "...")
Sys.setenv('APCA-PAPER-API-SECRET-KEY' = "...")
Sys.setenv('APCA-LIVE-API-KEY-ID' = "...")
Sys.setenv('APCA-LIVE-API-SECRET-KEY' = "...")
brianfleharty commented 4 years ago

I believe the environment variables are correct. Paper trading works but not live trading for some other reason. The account was funded on 17JUL2020 and funds are available to trade. Maybe something on Alpaca's end?

yogat3ch commented 4 years ago

@brianfleharty Yours: Sys.setenv('APCA-LIVE-SECRET-KEY' = secret_key) The readme: Sys.setenv('APCA-LIVE-API-SECRET-KEY' = "...")

Also a heads up, the AlpacaforR 1.0.0 update is going to be coming along soon. It's available here right now. Some of the changes are not backwards compatible with the current version on this repo, so I would suggest getting started with the 1.0.0 version so you won't need to do any revisions when it's rolled out. There's also a firstrun function built into the 1.0.0 version that makes this initial set-up that you're doing here quite a bit simpler. Hopefully, small user-friendly tweaks like this can make it such that common issues like these aren't stumbling points for folks trying to get set up in the future.

brianfleharty commented 4 years ago

Very helpful! Thanks! That was it.