C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles


Overload Operators The Right Way In C#
It's a good rule of thumb to overload the equality operators on classes. That ensures a correct comparison between to class instances of the same type. If you...

C#: Realtime Currency Exchange Class
Soon, I'm facing a new project where the need for up-to-date currency exchanges is crucial. This is not the first time I've done this, but I wanted to make a reusable, self-maintainable class so I don't have to do it...

Validating Strong Passwords In C# And ASP.NET
It's always a good idea to have a password policy when creating new applications. A password policy can vary from project to project, but the important part is just to...

Retrieve Subdomain From A URL In C#
I had to come up with a method that retrieved the subdomain from the current web request on an ASP.NET website. I thought that the System.Uri class contained that information in an easy retrievable way, but no.


02.01.07


C# Stock Quote Class


By Mads Kristensen

A couple of months ago one of my readers asked me to build a stock quote class that would automatically update the quote.

I forgot about it, but then I found the e-mail and decided to give it a go. I started looking for some free services that could provide the data in XML format or something similar that can be easy parsed.

Apparently that does not exist. All the stock sites charge you for that information and I want something free, so that was not the way to go.

Then I read about the Yahoo financial website and that it could be screen scraped fairly easy, so that's what the class will use.

The class is actually very simple to both use and modify. If the class isn't exactly what you need, you can just use its screen scraping methods to create your own implementation.

Examples of use

To get the quote for a specific stock, you can call the static Execute method. In this example a text box is filled with the quote:



Low Rate eCommerce & Retail Plans

You can also hook into the automatic update event, so that you can update a text box every time an update occurs. By default it is every minute.



Download

StockEngine.zip (1,92 KB)

Comments

About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com


-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article




CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact