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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀