alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
142 stars 13 forks source link

Trading via Oauth account fails #106

Closed WhatIsTofu closed 3 years ago

WhatIsTofu commented 4 years ago

An account that was authorized with the following scopes, scope=account:write%20trading fails to place a trade with the following error: Failed to authorize current action. The returned scope is scope: 'account:write trading data'. Are there any additional steps that is required to be authorized?

Thank you :pray:

Neal commented 4 years ago

Are you trying to trade on a live or a paper account? To be able to trade with live accounts, your OAuth app requires additional approval which you can find more about on your app page here.

lvca commented 4 years ago

@Neal what are whose steps? This morning it failed to me to buy stocks with this error:

Error on retrieving json from POST URL 'https://api.alpaca.markets/v2/orders' posting {"symbol":"SQQQ","side":"buy","time_in_force":"day","extended_hours":true,"qty":"333",
"type":"limit","limit_price":"25.81"}

(error={"code":40110000,"message":"token is not authorized for this scope"})

I've always used account:write%20trading for scope.

This is the popup about my app on the website:

image

Neal commented 4 years ago

@lvca is your app approved for live trading? You can check that if you go to your app on https://app.alpaca.markets/brokerage/apps/manage and it should say something at the bottom about how to enable live trading.

lvca commented 4 years ago

Do you mean this? image

Neal commented 4 years ago

Under My Developed Apps. My Connected Apps are the apps you've authorized.

lvca commented 4 years ago

Is it this?

image

But I've used the token for weeks. Why changing policy now?

Neal commented 4 years ago

Yes. Have you used it for live trading? If your app isn't approved for live trading, it couldn't have worked for live trading. This is not a new policy.

lvca commented 4 years ago

Yes, I've traded for at least 2 weeks with the new token without problems. Anyway, I've just sent the request via email.

Neal commented 4 years ago

We can look into it more but there has been no code change around this for a while and this policy has existed since we launched OAuth.