File Exchange

image thumbnail

get Intraday Stock Price

version (4.02 KB) by pangyuteng
function getHistoricalIntraDayStockPrice obtains intraday stock price from Google.


Updated 24 Oct 2018

View Version History

View License

*** looks like GOOGLE shut down the API ***
search stackover flow for more info and alternatives.

For the adventurous folks, I recommend giving Quantopian (python) or Quantconnect (python, c#) a try. Both platforms provide free intraday data as long as you are doing analysis/trading within their platform. I have had success with Quantopian, however they no longer provide live trading via Interactive Broker. Nevertheless, it still is a great platform for doing research given the data available within the platform. For folks considering live trading, you may have better luck with Quantconnect (I have never tried it though). Good luck!

function getHistoricalIntraDayStockPrice obtains intraday stock price from Google given the symbol of stock and the name of market which the stock is listed under. The accompanying file demonstrates one method for "cleaning" the data prior analysis.

Cite As

pangyuteng (2021). get Intraday Stock Price (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (15)

Sandy Ng

Great script Ted. But it seems the URL to download intraday data from google finance is not working anymore. Anyway to work around this?

Jenia Golbshtein

Any idea how can I retrieve stock's market cap? or # shares outstanding? THX

David Vidal

Google has changed its URL, if someone is using this script you have to change: by

David Vidal

Nothing, it is ok now, sorry for the comment. It works perfectly.

David Vidal

I do not know if it is only my case. But it does not wor any longer (nor with examples):

Struct contents reference from a non-struct array object.

Error in getHistoricalIntraDayStockPrice (line 80)
data.close =,1);

Peter Andersson

Interesting discussion! I also wonder if it is possible to get historical option data from Google or Yahoo. I am looking for years of data back?
I found but they only offer stocks and forex.


@ Jonathan, you can get the output and then filter by day.
@Jay, the number of outstanding shares can be found here:


Is there a way to use this to get a specific day's data? For example, I want to 1-min bars for GOOG on Feb 18th, 2015.

Jay Cheng

Besides the H L C O of a stock, can you also download the number of outstanding shares?


That is a great idea/question Taylor. I have been searching for free intraday forex data too, but I have not found one yet. Please share your implementation with the community if you do figure out how to get those data!

Taylor Xie

Hi,Teng,I want to know how to download the intraday data of Forex exchange data, for example EURUSD. I want to edit your function, but I don't know the url link to get the Forex exchange rate.


I have wondered that myself and could not find any documentation for Finviz. Stackoverflow might be a good place to ask this, I did a quick search there, there is not much on Finviz ( )

I'm not sure what kind of data you need, but if it is available on yahoo, you can refer to my other function "get-stock-information-from-yahoo" as a template for downloading data with YQL. Best of luck.


Another question Ted...Have you been able to find any actual documentation for I have been looking all over for it but can't find anything anywhere. All I have found is a few random posts where people have used queries similar to the one you have used.


Thanks Ryan. To my knowledge, there are no publicly accessible historical option data, intraday or daily. But if you do find it, it would be great if you can share it on this file exchange. :)


Great Work! By chance, do you know if it's possible to download historical intraday option data from google or yahoo?

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!