historical data download in R/Python using yahoo

Discussion in 'App Development' started by jk90029, Nov 9, 2014.

  1. Dear-

    It is well known that we can use

    http://finance.yahoo.com/d/quotes.csv?s=MSFT C AXP&f=d1snohgl1v

    to download the OCLC for the day, for selected three MSFT, C, AXP together. (See the Excel download at left bottom corner in your browser)

    Consider the 500 pieces for the SnP 500 as follows (let it be stored in c:\MyInput.txt)

    ABT Abbott Laboratories
    ABBV AbbVie
    ACE ACE Limited
    **********
    ZION Zions Bancorp
    ZTS Zoetis


    ***************************************************************

    Now, how can we make a matrix for 1000 daily close and 500 stocks in c:\MyOut.txt (Excel or text with tab) Of course, the matrix will have dimension with 1000 rows and 500 columns?

    Hopefully, R or Python is preferred for a lot less line of commands, than old-fashioned Excel.
     
    Last edited: Nov 9, 2014
  2. Furthermore, can we download the present value (in every 1 minutes or every 10 seconds) between 9:50 and 4:00, by using open/free sites such as yahoo?

    I heard that many broker/InteractiveData (s) provide this quote service, mostly with charge.
     
  3. In R, here is some advance.

    temp <- c("ABT", "ABBV", ... "ZTS")
    getSymbols(temp[1:10] , from ="20xx-xx-xx",to="2014-11-08")

    give us 500 different place of storage in ABT, ... ZTS.

    Now how can we make 1000 row and 500 columns, consisting ONLY close?
     
  4. do.call(merge, lapply(temp, function(x) get(x)[,4]))