last_quote API keeps returning "Not found" regardless of the symbol

last_quote API keeps returning “Not found” regardless of the symbol

This is likely due to the fact that today is Thanksgiving. Markets are closed.

I mean, there should still be a last quote, right? There must be a most recent price that is being referenced when the buying power decreases following an order placed when markets are closed. Simply getting “Not Found” is kind of dubious.

On further trials and observations, it looks like the “Not Found” response may not be coming from Alpaca, but from the curl connection. Could someone please verify that this is the correct uri to get the last quote for GOOG ?
https://paper-api.alpaca.markets/v1/last_quote/stocks/GOOG
Thank you.

The Data API endpoint is different from the Trading API endpoint. The URL for data requests such as last and last_quote is data.alpaca.markets. So the following should work

https://data.alpaca.markets/v1/last/stocks/GOOG

The paper-api.alpaca.markets URL is for account things like submitting orders, account status, etc. It’s easy to overlook, but check out the docs under “Endpoint”.

1 Like

Thank you. Very helpful.

I changed the uri and it worked for a while (Alpaca was responding with the quotes).
I did not use this api for a while. and now it responds “Token not valid in this context”.
So, I decided to use the API key/secret instead. It is a GET request, so I just appended them to the uri:
https://data.alpaca.markets/v1/last/stocks/GOOG?APCA-API-KEY-ID=key_value&APCA-API-SECRET-KEY=secret_value
(key_value and secret_value are constants set to the current values)
Now, Alpaca responds “Forbidden”
Could you please put me on the right track to fix this issue? Maybe I am using the wrong names?
Thank you
Frank

@Frank_Simtob My first guess would be that you are using your paper-trading API keys and you have recently reset your paper trading account. If so, that requires you to regenerate your keys. There is another post here which may also help. Try that and get back if it doesn’t work.

Thank you for your prompt reply.
I am using the paper account. I did not reset it but I regenerated a set of keys.
Using the new values, Alpaca still returns “message: forbidden”.
There is no code or error code.
What would you suggest next?
Frank

This is a long shot but would your account ID happen to be one in this list?

0674fe7f-151b-438e-ab0a-5fa70feb0c79
10d2ff10-8e23-4b5d-b239-9c785fd21dc5
36e308ab-7e98-4d4e-8ca0-e973ba685a31
3a432ae3-1fba-488d-ae30-c9ba28e19dca
93b1af3d-85d2-46fa-b5dd-b2fd59498c18
b22c7eff-f5aa-4d9b-9faa-a92724a25042
fc9e1224-23c9-44a0-aa5b-adee21632ce7

Those accounts for some reason have two or more paper accounts which is confusing some of the processes.

I’d be surprised if your account ID is one of those but it’s worth a try?

Neither my API Key nor API Secret match any number in this list.
I also have an account number, but it does not match any in the list
Where do I find my account ID ?

When I call the “account” API (using “token” instead of key/secret), I get a parameter called “id”.
I assume that this would be the account id.
It is not on the list you have given me.
This “account” API is a also a GET request, so I tried it with the key and secret as query arguments appended to the uri., just like in the “last Quote” API. I get the following response :

code : 40110000
message : access key verification failed : access key not found (Code = 40110000)

What would be the next thing to try?
Thank you for your help
Frank