4

If you use Google Finance, you see the stock price update in real time. However, I do not see ajax requests for each price change. How exactly is it receiving it's data? The ajax calls do happen every so often but not for every price change.

https://www.google.com/finance?q=aapl

KingKongFrog
  • 13,946
  • 21
  • 75
  • 124
  • I have no idea, but I guess that Google has enough power and interest from the financial sector to get such informations – Basile Starynkevitch May 10 '13 at 15:18
  • I'm not concerned about how it gets the price change but how it updates the price when you're on the page. – KingKongFrog May 10 '13 at 15:19
  • if you right click that chart you will see that it is flash based, so it doesn't need to be ajax; if you just want a javascript based solution similar to ajax you can use jsonp (http://rvyu.com/zrHK) – mishu May 10 '13 at 15:21

2 Answers2

2

It is true that the graph is supplied by flash, but the price of the stock is in HTML and updated in real time.

By looking at the connections, you'll notice that one of the connection stays open. My guess is that it provides the data:

https://www.google.com/finance/qs/channel?VER=8&RID=rpc&SID=628A5B4C83473350&CI=0&AID=0&TYPE=xmlhttp&zx=dcad1i8o61q8&t=1

Connections

Tchoupi
  • 14,560
  • 5
  • 37
  • 71
1

The graph is supplied by Adobe Flash Player so I don't think you'd see any traffic via inspector for that. The rest though does generate calls:

https://www.google.com/finance/getprices?q=AAPL&x=NASD&i=120&p=25m&f=d,c,v,o,h,l&df=cpct&auto=1&ts=1368199239667&ei=jw-NUcivEsmrqQGT7wE

would be an example of what I'm seeing.

Here's is the response from the server:

EXCHANGE%3DNASDAQ
MARKET_OPEN_MINUTE=570
MARKET_CLOSE_MINUTE=960
INTERVAL=120
COLUMNS=DATE,CLOSE,HIGH,LOW,OPEN,VOLUME
DATA=
TIMEZONE_OFFSET=-240
a1368197880,452.2847,452.29,451.6,452.0101,35458
1,451.81,452.3,451.661,452.24,91267
2,452.2,452.3,451.8314,451.84,35767
3,451.91,452.3,451.8,452.3,89882
4,452.4575,452.61,451.88,451.88,45130
5,452.77,452.88,452.45,452.48,35866
6,453.626,453.9,453.27,453.3571,0
7,453.05,453.6599,453,453.61,0
8,452.9,453.17,452.83,453.09,0
9,452.58,453.15,452.4377,452.865,0
10,452.7568,453.068,452.45,452.475,0
11,452.53,452.8,452.302,452.75,0

The other call is makes is to:

https://www.google.com/finance/qs/channel?VER=8&SID=6C5BE78E1E7D9597&RID=82123&AID=500&zx=p0b0io9ifynn&t=1

which responds with something like:

10
[1,500,0]
OnResolve
  • 4,016
  • 3
  • 28
  • 50
  • Here is the python code get the data http://trading.cheno.net/downloading-google-intraday-historical-data-with-python/ – arulraj.net Aug 03 '15 at 05:52