• 抓数据


    做过股票的人都知道要选一个好股票往往要用到技术指标选股,而有时自己会有一些想法,想用其来挑选股票,并用历史数据进行校验,必须要有每日的数据,下面是我自己写的一个抓数据的C#代码。

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace 股票技术分析
    {
        public partial class Form3 : Form
        {
            string conn = System.Configuration.ConfigurationManager.ConnectionStrings["BusinessConnString"].ConnectionString;
            string stockcode = "";
            DataTable dt;
            int Count = 0;
            string beginday;
            string endday;
            public Form3()
            {
                InitializeComponent();
            }

            private void Form3_Load(object sender, EventArgs e)
            {
                DataSet ds = Platform.Data.SqlHelper.ExecuteDataset(conn, CommandType.Text, "select * from StockCodeInformation where IsActive=0 order by stockcode");
                dt = ds.Tables[0];
                stockcode = dt.Rows[0]["stockcode"].ToString();

                beginday = (1991 ).ToString() + "-01-01";
                endday = (1991 ).ToString() + "-12-31";
                webBrowser1.Url = new Uri(@"http://app.finance.ifeng.com/hq/stock_daily.php?code=" + stockcode + "&begin_day=" + beginday + "&end_day=" + endday);
            }

            private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                string sql = "update StockCodeInformation set IsActive=1 where stockcode = '" + stockcode + "'";
                Platform.Data.SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql);                       

                if (Count < dt.Rows.Count)
                {
                    Count++;
                    stockcode = dt.Rows[Count]["stockcode"].ToString();
                    webBrowser1.Url = new Uri(@"http://app.finance.ifeng.com/hq/stock_daily.php?code=" + stockcode + "&begin_day=" + beginday + "&end_day=" + endday);
                }
            }
        }
    }

  • 相关阅读:
    学习另外一门技术,叫Python
    子报表显示Total Page Count或Page Number
    Insus.NET是Leo Yeung的网名
    C# 以管理员身份运行WinForm程序
    python 里 certifi 库的作用
    CEF中文教程(google chrome浏览器控件) -- CEF简介CEF中文教程(google chrome浏览器控件) -- CEF简介
    CefInitialize崩溃 && Cef白屏
    Chrome设置
    CEF 开启webGl功能
    Qt5.9.1结合CEF开发基于chorm的浏览器(二)
  • 原文地址:https://www.cnblogs.com/zyizyizyi/p/2497835.html
Copyright © 2020-2023  润新知