简体   繁体   English

雅虎财务数据javascript

[英]yahoo finance data javascript

  1. I am currently holding a Drupal 7 site. 我目前持有一个Drupal 7网站。

  2. I would like to build a block with yahoo fiance api data on my sidebar, like: 我想在边栏上使用yahoo fiance api数据构建一个块,例如:

     Nasdaq 2,951.23 16.18 +0.55% Dow 12,871.39 -8.70 -0.07% 
  3. I would like to do it using javascript, because in Drupal, I could make the js code directly imbedded in my inline content, which is easier than doing with php codes. 我想使用javascript做到这一点,因为在Drupal中,我可以使js代码直接嵌入我的内联内容中,这比使用php代码更容易。

And the data I got from yahoo fiance is in .csv format, I need to parse it remotely from yahoo finance with the query looks like: http://download.finance.yahoo.com/d/quotes.csv?s= ^IXIC,^GSPC,^FTSE,^GDAXI,^FCHI,^N225,^HSI,^STI,^BSESN,^NSEI&f=sl1c1&e=.csv 我从yahoo fiance获得的数据是.csv格式,我需要使用以下查询从yahoo finance远程解析该数据: http : //download.finance.yahoo.com/d/quotes.csv?s = ^ IXIC,^ GSPC,^ FTSE,^ GDAXI,^ FCHI,^ N225,^ HSI,^ STI,^ BSESN,^ NSEI&f = sl1c1&e = .csv

Ok, guys, help me out of this please. 好的,伙计们,请帮助我。

Thanks 谢谢

Unfortunately you will not be able to download a csv file from an external domain (yahoo.com) and show it to your users using JavaScript alone. 不幸的是,您将无法从外部域(yahoo.com)下载csv文件,而仅使用JavaScript将其显示给用户。 There are cross domain restrictions preventing that. 有跨域限制可以防止这种情况。

You can however use a JSON version for finance data, like this with jQuery: 但是,您可以将JSON版本用于财务数据,例如使用jQuery:

See this example on jsfiddle.net: http://jsfiddle.net/grimreaper01/jVWwu/ 请参阅jsfiddle.net上的以下示例: http : //jsfiddle.net/grimreaper01/jVWwu/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM