question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Oauth

See original GitHub issue

Hi, does alpaca-backtrader-api support authenticating with Oauth access tokens? A quick look through the source code seems to imply that we can only authenticate with API keys.

Would adding support for Oauth be as simple as adding the oauth param to AlpacaStore and passing that parameter to API(tradeapi.REST)? If so, I can make a PR to add this functionality

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shlomikushchicommented, May 29, 2020

Hi, it should work. inside AlpacaStore (line 234) we do this

self.oapi = API(self.p.key_id,
                self.p.secret_key,
                self.p.base_url,
                self.p.api_version)

check if your Oauth works by adding that

0reactions
shlomikushchicommented, Jun 7, 2020

adding that if statement is not possible in the main repo. you could have a fork and do it there though the reason is that it is a patch for something it was not designed for, doing something like that could cause bugs in the future (just an example - someone forgets to add credentials and the streamer doesn’t start and no exception happens… he will not know why nothing works)

adding your credentials is never a good practice… so don’t do that (you may get unexpected results… if not now, maybe in a future commit) currently what happens is that the AlpacaBroker gets the REST interface from the AlpacaStore so if you initialize it there correctly it should probably work (but again, it’s not a good practice so operate with caution)

now… we have 2 streamers. one for prices, one for events. prices stream is not relevant for you since you use a different feed. the events are broker events… so I’m guessing you probably need that

in any case - do these actions only with paper trading and see if you get your desired results. also, please update it here so others may get that information

Read more comments on GitHub >

github_iconTop Results From Across the Web

OAuth Community Site
OAuth is a way to get access to protected data from an application. It's safer and more secure than asking users to log...
Read more >
Using OAuth 2.0 to Access Google APIs | Authorization
A service account's credentials, which you obtain from the Google API Console, include a generated email address that is unique, a client ID,...
Read more >
What the Heck is OAuth?
OAuth is a delegated authorization framework for REST/APIs. It enables apps to obtain limited access (scopes) to a user's data without giving ...
Read more >
OAuth 2.0 Authorization Framework
The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party web site or application access to the...
Read more >
Setting up OAuth 2.0 - Google Cloud Platform Console Help
To use OAuth 2.0 in your application, you need an OAuth 2.0 client ID, which your application uses when requesting an OAuth 2.0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found