Search code examples
apihttpurltickeralpha-vantage

How to use a symbol with a "." in the URL with Alphavantage?


I am using the Alpha Vantage API and have come across a problem, every time I try to send an API request where the symbol (ticker) has a "." in it, the API call returns an Invalid API call error.

How do I get past this?

For example, to search for BT Group on the London Stock Exchange, you would use "LON:BT.A" which I would expect the formulate the URL like below:

https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=LON:BT.A&apikey=API_KEY

This does not work, but equally if I wanted to search for a ticker without a dot then it works perfectly fine, for example Sky plc is "LON:SKY" so the below works:

https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=LON:SKY&apikey=API_KEY

Solution

  • Most of the tickers that have a "." in them seem to require that you replace them with a "-", so this worked for me, however I have found that this is not always the case. I couldn't find any documentation with a comprehensive list of tickers (I guess probably because it's dynamic) so stopped using the API.