Google财经如何更新股票价格?

时间:2013-05-10 15:16:46

标签: ajax

如果您使用Google财经,则会实时看到股票价格更新。但是,我没有看到每个价格变化的ajax请求。它究竟是如何接收数据的呢? ajax调用确实经常发生,但并不是每次价格变化都会发生。

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

2 个答案:

答案 0 :(得分:2)

图表确实是由闪存提供的,但是股票的价格是用HTML格式实时更新的。

通过查看连接,您会注意到其中一个连接保持打开状态。我的猜测是它提供了数据:

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

Connections

答案 1 :(得分:1)

该图表由Adobe Flash Player提供,因此我认为您不会通过检查员看到任何流量。其余的确会产生电话:

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

将是我所看到的一个例子。

以下是服务器的响应:

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

另一个电话是:

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

响应类似:

10
[1,500,0]