Closed drixie closed 3 years ago
Does not work for both AlpacaClient and AlpacaStream
Can you show me an error or something to work with? Does this occur when trying a certain endpoint? I don't know where to begin without more information.
It occurs on all endpoints, since each endpoint requires authentication. I supplied the credentials and other parameters as outlined in the readme.
This is the error from AlpacaClient:
{ code: 40110000, message: 'access key verification failed : access key not found (Code = 40110000)' }
This is the error from AlpacaStream:
Error: There was an error in authorizing your websocket connection. Object received: { "stream": "authorization", "data": { "action": "authenticate", "message": "must provide key_id and secret_key or oauth_token", "status": "unauthorized" } }
Are you certain the paper: true/false
field matches the key type you are using?
const client = new AlpacaClient({
credentials: {
key: 'PK8Z6I3DLEFDZR******',
secret: 'QDDi0TSUCqT6WCnVluXEZyNB6FtITp3KqE******',
},
paper: true,
rate_limit: true,
})
client
.getAccount()
.then((account) =>
console.log(`account has $${account.buying_power} buying_power`)
)
Console output:
account has $200418.44 buying_power
The above is working for me.
I got it resolved. It's not a bug in your lib. The issue came from the way my env vars was set up as I had my key and secret stored in .env.
Thanks for the support :)
There's something wrong with how the credentials object is being handled. i am not skilled enough to troubleshoot and debug. I am using the official SDK with no authentication issues.