stock quote retrieval via yahoo finance

This is a discussion on stock quote retrieval via yahoo finance within the C++ Programming forums, part of the General Programming Boards category; I am trying to make my console application fetch stock quotes from yahoo finance so I can do calculations with ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    have you read this: http://developer.yahoo.com/finance/ ?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    so why not to open the socket, send the http request as described and parse the response?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    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,662
    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,893
    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,662
    Completely incomprehensible<sigh>.

  12. #12
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    there were several samples on the board here and there
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    - 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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

Page 1 of 2 12 LastLast
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-24-2007, 12:05 AM
  4. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 01:05 PM
  5. Stock Taking program
    By C Babe in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2003, 08:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21