duan117890 2011-04-21 20:04
浏览 25
已采纳

雅虎股票饲料

I'm trying to get a chart of stock opening prices.

I want to use yahoo's data feed for stock data: http://www.gummy-stuff.org/Yahoo-data.htm

Has anyone ever used this? What I want is basically a 1 column table, each row represents one day, and the first column represents the opening price of a particular stock.

How can I query more than just one day?

  • 写回答

2条回答 默认 最新

  • duanla8800 2011-04-22 00:20
    关注

    This is how you could retrieve data and parse it:

    $sourceURL = 'http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=snd1lyr';
    
    $sourceData  = file_get_contents( $sourceURL );
    
    // separate into lines
    $sourceLines = str_getcsv($sourceData, "
    "); 
    
    foreach( $sourceLines as $line ) {
    
        $contents = str_getcsv( $line );
    
        // Now, is an array of the comma-separated contents of a line
    }
    

    Update:

    Yahoo provides historial data e.g. for AAPL on this page:

    http://de.finance.yahoo.com/q/hp?s=AAPL
    

    At the bottom of the page, you may download the table using this link:

    http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=3&e=22&f=2011&g=d&a=8&b=7&c=1984&ignore=.csv
    

    I'd propose to play with the webpage to learn which parameters represent what.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么