How to Get a Free Real-time Stock Quote from Google Finance Into Matlab

A while back I posted a link to my Matlab script that retrieves a stock quote (last trade) from Yahoo! Finance. Problem is, as one reader pointed out, Yahoo’s quotes are delayed by 15 minutes, limiting their timeliness.

There is no delay in Google Finance’s quotes though so we’d probably want to retrieve data from their site instead.

Below you can find a link to a starter Matlab script that does this. I say “starter” just because I’ve only tested it with a couple tickers and haven’t added much in the way of error handling for things like typing in an incorrect ticker.

Final note, I probably wouldn’t put this function into any sort of while loop that pings google day and night. They might think you’re some sort of DoS attacker wannabe.

Just sayin’…


get_last_trade_google.m

Amma and Ben