Closed aeolus-aircraft closed 5 years ago
Hello, I suggest you check your environment variables if you're still encountering a problem like this. (I assume that 'key' and 'secret_key' are replaced with the real values in your code.) If that's not the issue, please try seeing if account
is being returned properly. If you'd like to access the assets API, you should use api.list_assets()
.
I'm new to the API and am starting to build my trading algorithms. I'm having troubles getting access to any of the asset data. I keep getting the error that my get request has failed because my access key code was not found. I've looked through the issues and found a similar one that was resolved by requesting a new key code. This didn't help either.
The relevant sections of my code (at least I think) are as follows:
api = tradeapi.REST('key', 'secret_key', 'https://api.alpaca.markets') account = api.get_account()
response = requests.api.get( "https://api.alpaca.markets/v2/assets/AAPL?apiKey=key",
I've tried the url with and without the ?apiKey= included at the end and also with and without the ticker symbol with the same result. I've also tried other requests with the same result.
Thanks for any help!