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

websocket auth check and updates to docs referencing kwargs for keys, base_url #46

Merged
merged 2 commits into from
Dec 23, 2018

Conversation

bdowling
Copy link
Contributor

I thought it might be useful to have the ability to independently set the polygon API key_id. In the current environment, this can be useful if a funded account holder wants to use the paper trading API with polygon (paper keys do not currently work with polygon NATs).

Also updated the readme to provide a little more clarity on passing this and the other keys to the API.

Note: this PR also adds a bit of checking for the websocket API credential check, raising an error if it is not successful. This does not address the polygon auth errors.

@umitanuki
Copy link
Contributor

Paper-only account does not work with polygon, but paper account for the user who has live account should work with polygon.

@umitanuki
Copy link
Contributor

This change would break existing uses, since most of the users have no problem with Alpaca key id for polygon.

@bdowling
Copy link
Contributor Author

@umitanuki I tried to make it as backwards compatible as possible, the POLYGON key ID is optional, it will default to using the provided APAC_API_KEY_ID, providing preference to the kwarg, environment, then default.

@bdowling
Copy link
Contributor Author

bdowling commented Dec 18, 2018

Actually, now that I looked back at this, I think I fixed a non-issue. The Alpaca side websocket streaming API is unavailable to paper trading credentials. I came back to this thinking the NATs was having the issue with paper trading keys (my tokens had reset).

It does provide the error message now though to let you know (otherwise it's just hidden in the authorization stream if you don't specify a handler for that).

ValueError: Invalid Alpaca API credentials, Failed to authenticate: {'stream': 'authorization', 'data': {'action': 'authenticate', 'status': 'unauthorized'}}

@bdowling bdowling changed the title Added POLYGON_API_KEY_ID as optional distinct credential websock auth check and updates to docs referencing kwargs for keys, base_url Dec 18, 2018
@bdowling bdowling changed the title websock auth check and updates to docs referencing kwargs for keys, base_url websocket auth check and updates to docs referencing kwargs for keys, base_url Dec 18, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants