Thread: Share Price monitor program

  1. #1
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154

    Share Price monitor program

    Hi there. I haven't been hear in a while. I was hoping that someone maybe able to help me. I wanted to write a program which was able to get certain share prices off yahoo finance, and then save things like the open price, close price, change etc in a file.

    One way I have thought about doing it, is to 'hardwire' all the symbols of the companies I want to monitor into an array, and then just make it go to http://uk.finance.yahoo.com/q?s=??? where the ??? at the end is the code of the company from the array. It would then have to look at the source code for things like the open price etc, and then just have to save them to a file. The saving to a file bit isn't the problem, its more the getting the program to connect to the internet, go to the site, and search the source code, so most of it lol.

    In the past, I've normally programmed in C++, but I want to do this in C, to make it that much harder ;p


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Using a library like libcurl will make it a lot easier.

    Unless you're deliberately wanting to implement part of an HTML client using the socket level API.
    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.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Also, be aware that someone else found a stumbling block in that the code to actually present the data is "hidden" inside a java-script. So when you fetch the HTML, you don't actually get the share data, only the links and static graphics around it.

    I haven't looked at the Yahoo site, so I can't say if they do this or not. But before you write a lot of code, try having a look at the "HTML source" of the page, and see if you find the actual data you'd like to scrape out of there - if not, you may need to do quite a bit more than just fetch the HTML and clean it up to get the data out of there.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Price Calculation Problem using Class
    By Bernard4 in forum C++ Programming
    Replies: 4
    Last Post: 07-23-2008, 12:12 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. C++ Share Interface Problem
    By Morphios in forum C++ Programming
    Replies: 0
    Last Post: 04-28-2003, 07:30 PM