Stock Base Small Helper

Source: Internet
Author: User

Recently the stock market roller coaster, I do not stock, and not so much time to play, so I play a stock base. In the process of playing I found this thing is very fun ah, just I switch back and forth in the web, constantly pressing the F5 process, so I wrote a small assistant, here to take out and share with you.

I have found that today's valuation, the estimated rate of rise, the latest net worth, the latest rate of rise, yesterday's rate of increase and the latest net earnings is what I want to know. See Hexun and Baidu Financial management, read their data, feel hexun more comprehensive and accurate, so use crawl Hexun data. First one:

Let's talk about how I do it, first of all, make sure the address of the request is: Http://quote.funds.hexun.com/list/outxml/quote/IOpenFundData.aspx?fundcode=XXX, View the resulting data:

You can see that there are four data, including the latest net worth, the latest rate of rise, the net value of yesterday, the update time. But when the time comes to market opening time, the data obtained is different, "the latest net value" into "Today's valuation", "the latest rate" into "estimated rate of rise." So I put some information into the configuration file:

Where the automatic refresh time is used to automatically refresh the data at intervals, the funds configuration holds the stock base that you want to monitor, and the form is "fund number, fund name, purchase amount, holding share, start date." did not buy the value of the first two fields, there are buy assignments all fields ", did not buy the assignment of the first two fields, there are buy assignments all fields. Then build a stock base class:

    public class Fund    {public        string fund number {get; set;}        public string fund name {get; set;}        Public double today's value {get; set;}        Public double estimated liter rate {get; set;}        Public double New net value {get; set;}        Public double the latest liter rate {get; set;}        Public double yesterday's net value {get; set;}        Public double total {get; set;}        Public double Latest net gain {get; set;}        Public DateTime start date {get; set;}        Public double holds the share {get; set;}        public string update time {get; set;}    }

Then add a DataGridView and a refresh button to the interface (for manual refresh), and the code focuses on how to refresh a single fund class:

        private void Updatefund (Fund Fund)        {            string data = _client. Downloadstring (resources.urlhexunfund + Fund. Fund number);            string[] datas = data. Split (', ');            if (Datas[0]. Contains ("Latest net value"))            {                fund. Latest Equity = Convert.todouble (Datas[1]);                Fund. Latest rate of rise = convert.todouble (datas[2]);                Fund. Net Worth yesterday = Convert.todouble (datas[4). Split ('] ') [0]);            }            else            {                Fund. Today's valuation = convert.todouble (datas[1]);                Fund. Estimated rate of rise = convert.todouble (datas[2]);                Fund. Latest Equity = Convert.todouble (Datas[4]. Split ('] ') [0]);            }            var money = fund. Latest Net worth * fund. Holding share-fund. Total;            Fund. Latest Net gain = money;            Fund. Update time = datas[5]. Split (' \ ') [1];        }

What needs to be explained is that _client is a WebClient, the latest net profit is to use the latest net value multiplied by the holding share minus the total, the holding share is the number of shares held, the total amount is the total amount of money purchased, so that the latest net gain is actually not minus the handling fee, management fee and redemption fee, Need to reduce the people to download their own code, you change it.

Need the stock base small software, click on the right text: stock-based small software

Stock Base Small Helper

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.