+ Reply to Thread
Results 1 to 10 of 10

Stock Prices import

  1. #1
    Registered User
    Join Date
    12-07-2010
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    4

    Stock Prices import

    Hi y`all,
    I am trying to have the current stock prices from yahoo finance imported to Excel and
    i m also looking to have prices of the last 30 days along with the current day price on excel.
    Therefore, for eg: if today`s date is Dec 7, 2010 the excel should show prices of Dec 7, 2010- Nov 8, 2010 and tomorrow (i.e. Dec 8, 2010) the prices shown should be Dec 8, 2010 to nov 7, 2010.


    I would really appreciate all the help for the above.

    Thanks

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Stock Prices import challenge

    Is there a URL you can grab from Yahoo that will always show the data you describe for the current day in a table? If so you should be able to set it up as a web data import (Data, Import External Data, New Web Query).

    If you aren't familiar with a web table import then I can give more detail, if you give more detail about what data you're getting and how you're getting it from Yahoo.

    (Your 30-day interval is clear but I think the dates in your example are a little hosed up. If today's date is Dec 7 then you want prices from Nov 8-Dec 7. The next day you want prices from Nov 9-Dec 8.)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    12-07-2010
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Stock Prices import challenge

    Quote Originally Posted by 6StringJazzer View Post
    Is there a URL you can grab from Yahoo that will always show the data you describe for the current day in a table? If so you should be able to set it up as a web data import (Data, Import External Data, New Web Query).

    If you aren't familiar with a web table import then I can give more detail, if you give more detail about what data you're getting and how you're getting it from Yahoo.

    (Your 30-day interval is clear but I think the dates in your example are a little hosed up. If today's date is Dec 7 then you want prices from Nov 8-Dec 7. The next day you want prices from Nov 9-Dec 8.)
    thanks for your reply . Yes, the date you quoted are correct. Concerning the URL, here is the URL: http://finance.yahoo.com/q/hp?s=IP&a...e=8&f=2010&g=d

    so what I am looking to do is, At the end of every day excel should update the prices by itsef by linking it up to that URL automatically. Is it possible??

    Thanks once again.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Stock Prices import challenge

    First I suggest you look at how to import web data using the menu sequence I provided above, possibly checking Excel Help for Web Data.

    It looks like the URL has the desired date hard-coded as parameters, so I'll have to look into the possibility of generating the URL dynamically, or possibly finding another way to get there.

  5. #5
    Registered User
    Join Date
    12-07-2010
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Stock Prices import challenge

    Hey, yeah..I m able to import the data as indicated, however, I am not able to have it update it accordingly...in terms of generating URL dynamically ..that is where i need you ehlp big time on...appreciate..

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Stock Prices import challenge

    This was an interesting little project, I learned a lot.

    Attached is a workbook that is seeded with a range of dates from earlier in the year, just to demonstrate how this works. When you open the workbook, you must allow macros to run. Then it automatically updates the URL to reflect the current date, and updates the web query with the new URL.

    One note: In the Yahoo page, if you enter Dec 9 as the end date, the latest date in the table is Dec 8 (at this moment). I don't know if there is a lag from the closing bell to when they make the data available in this form.

  7. #7
    Registered User
    Join Date
    11-13-2010
    Location
    Google, Earth
    MS-Off Ver
    Excel 2002
    Posts
    3

    Re: Stock Prices import challenge

    I'm only chiming in with my useless $0.00000002

    Ha I asked a very similar question about a month ago. here's the link if any of it may help you, and looks like this will help me.

    http://www.excelforum.com/excel-gene...ne-column.html

  8. #8
    Registered User
    Join Date
    12-07-2010
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Stock Prices import challenge

    HI Jazzer,
    Thank you for your hardwork. A small request : is it possible to NOT to have 11-Feb-10 0.025 Dividend
    showing up on excel?
    and yeah i guess a more challenging project: its again on stock quotes: I would like to have something like based on price parameters on sheet 1 (for eg: on sheet 1 put in a price range), have the excel file find stocks within that price range from yahoo finance ( on sheet 2) and once the stocks are listed on sheet 2, corresponding sheets get setup automatically for each stock (the price quotes would be just like you had done the first coding for) . i think this would be a rather challenging one eh..thanks once again..

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Stock Prices import challenge

    Quote Originally Posted by roger00782006 View Post
    Thank you for your hardwork. A small request : is it possible to NOT to have 11-Feb-10 0.025 Dividend
    showing up on excel?
    Not sure. Excel web import is designed to identify an HTML table in a web page and grab the entire table. It doesn't have hooks to edit it on the import step. You could create a new worksheet, and populate it with formulas referencing the imported data, skipping the stuff you don't want. Also, VBA might be able to edit the data once it's imported, although I don't know how that will affect the ability to accept future refreshes of the data. I may have time to take a look at this.

    and yeah i guess a more challenging project: its again on stock quotes: I would like to have something like based on price parameters on sheet 1 (for eg: on sheet 1 put in a price range), have the excel file find stocks within that price range from yahoo finance ( on sheet 2) and once the stocks are listed on sheet 2, corresponding sheets get setup automatically for each stock (the price quotes would be just like you had done the first coding for) . i think this would be a rather challenging one eh..thanks once again..
    I'll let you know what my consulting rate is

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Stock Prices import

    Here is an update that removes the dividend lines.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1