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 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计