How To Get Stock Price With MOEX API In Google Sheets

Google Sheets

20/09/2021


The Moscow Stock Exchange (MOEX) 🇷🇺 offers a great API to fetch any securities related data for free. However, it can be confusing at first to wrap your head around it.

Formula

This Excel formula is the key to it all. Pay attention to <ADD CODE HERE> towards the end. This needs to be replaced with the appropriate code of your desired stock.

EXCEL
=IMPORTxml("https://iss.moex.com/iss/engines/stock/markets/bonds/boards/TQOB/securities.xml?iss.meta=off&iss.only=securities&securities.columns=SECID,PREVADMITTEDQUOTE", concatenate("//row[@SECID='", <ADD CODE HERE> ,"']/@PREVADMITTEDQUOTE"))

Gazprom Example

Let's say you want to get the price of a particular stock, e.g. Gazprom. First off, search the stock on the MOEX website.

Search bar on MOEX website

Search for your desired security on
the MOEX website

Once you're on the details page of your desired stock, locate its Security Code (e.g. GAZP). Then plug it into the formula and let the magic happen! Don't forget 🧠 to put the code in double quotes.


WRITTEN BY

Code and stuff