Thread: stock quote retrieval via yahoo finance

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    9

    stock quote retrieval via yahoo finance

    I am trying to make my console application fetch stock quotes from yahoo finance so I can do calculations with that data. I have been looking on the internet been have not been able to find anything out there. Does anyone have any suggestions for me.

    Thanks,

    Pete

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    have you read this: http://developer.yahoo.com/finance/ ?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    9

    I'm using Microsoft Visual C++ 6

    your yahoo link talks about c#... Thanks for the link though

    Pete

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    9

    More specific of what i would like to do.

    http://www.gummy-stuff.org/Yahoo-data.htm

    this website has all the stuff needed to get quote data via internet explorer. What I would like to do is have my program call internet explorer so to speak use the url with stock symbol to retrieve the data I need and put it into a variable in my program.. Hope that makes things a little more clear.

    Thanks,

    Pete

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    so why not to open the socket, send the http request as described and parse the response?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    How do you "why not to open the socket"? I would like to try and write a program like that myself.

  7. #7
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    look up WinSock

  8. #8
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    I've gotten that far before. Is there a good "hello world" winsock tutorial anywhere?

  9. #9
    Registered User
    Join Date
    Jan 2007
    Posts
    9
    I am just learning C++ I am in my second semester of C++ so it is a challenge still.. Thanks for the response I will look up opening a socket to see if this will get me where I need to go.

    Thanks,

    Pete

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    HTTP in raw sockets is perhaps not such a good idea. But there are various free HTTP libraries out there, for example cURL or the W3C's libwww.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #11
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Completely incomprehensible<sigh>.

  12. #12
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    there were several samples on the board here and there
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  13. #13
    Registered User
    Join Date
    Jan 2007
    Posts
    9
    still haven't been able to have my program connect to yahoo finance.. Any other ideas?

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    - post your code
    - post your analysis of the problem
    -- does it compile - if not, what error messages
    -- does it run
    -- does it crash - if it does, what error messages
    -- does it connect - if not, what error messages
    -- does it fetch any data at all - is it correctly formatted or junk
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  15. #15
    Registered User
    Join Date
    Jan 2007
    Posts
    9

    What to do with this code?

    Code:
    const char HEAD_REQUEST_PART1[] =
    {
    	"HEAD / HTTP/1.1\r\n" 			// Get root index from server
    	"Host: "					// Specify host name used
    };
    
    const char HEAD_REQUEST_PART2[] =
    {
    	"\r\n"							// End hostname header from part1
    	"User-agent: HeadReqSample\r\n"          // Specify user agent
    	"Connection: close\r\n" 		// Close connection after response
    	"\r\n"				// Empty line indicating end of request
    };
    okay found a tutorial on winsock but stuck on the above code. I assume this is where I request the information from ther server.. Below is an example of getting the stock quote in the browser..
    http://finance.yahoo.com/d/quotes.cs...SFT&f=snd1l1yr
    but how do I incorporate this into the header request? I assume that is where I put the information I want.. Looked for info on HTTP protocol but I don't believe I found anything that helped...

    Thanks,

    Pete

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Niche Question: real time stock quotes
    By keira in forum C Programming
    Replies: 0
    Last Post: 03-08-2008, 11:06 AM
  2. Retail Outlet Managment System - the 4th
    By Presidentofusa in forum C Programming
    Replies: 3
    Last Post: 11-10-2007, 10:44 PM
  3. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  4. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  5. Stock Taking program
    By C Babe in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2003, 07:40 PM