zoukankan      html  css  js  c++  java
  • 抓数据

    做过股票的人都知道要选一个好股票往往要用到技术指标选股,而有时自己会有一些想法,想用其来挑选股票,并用历史数据进行校验,必须要有每日的数据,下面是我自己写的一个抓数据的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);
                }
            }
        }
    }

  • 相关阅读:
    Kotlin调用lambda表达式时,lambda中的参数名字省略问题
    Kotlin读取控制台输入
    安卓P(9)及以上Cleartext HTTP traffic to xxx not permitted错误,无法HTTP明文连接错误解决方法
    AS4.0以上查看R.id
    Kotlin Standard.kt解析(also,apply,let.run...)
    ext4文件解包打包
    Kotlin中的var、val和const
    Kotlin的构造方法探究
    Markdown语法
    uniapp遇到的小问题
  • 原文地址:https://www.cnblogs.com/zyizyizyi/p/2497835.html
Copyright © 2011-2022 走看看