• 大小: 0.40M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-05-03
  • 语言: C#
  • 标签: C#  股市  

资源简介

C#开发的看股市的小工具

资源截图

代码片段和文件信息

using System;

public class AccessStock
{
public AccessStock()
{
}
private string sinaURL=“http://hq.sinajs.cn/list=“;
public StockInfo accessCurStock(string ID) {
StockInfo stockInfo = new StockInfo(ID);
        string url = ““;
        url = sinaURL + stockInfo.getID();

        if (stockInfo.getID() == ““ || ““.Equals(stockInfo.getID())) {
            return null;
        }

        try
        {
            System.Net.WebClient client = new System.Net.WebClient();
            client.Encoding = System.Text.Encoding.GetEncoding(“GB2312“);
            string reply = client.DownloadString(url.ToString());
            string[] replyDetail;

            if (reply == null || reply == string.Empty || (“var hq_str_“ + stockInfo.getID() + “=\“\“;\n“).Equals(reply))
            {
                return null;
            }
            else
            {
                reply = reply.Replace(“var hq_str_“ + stockInfo.getID() + “=\““ ““);
                reply = reply.Replace(“\“;“ ““);
                replyDetail = reply.Split(““);
                stockInfo.setName(replyDetail[0]);
                stockInfo.setTodayFirstValue(Convert.ToDouble(replyDetail[1]));
                stockInfo.setLastDayEndValue(Convert.ToDouble(replyDetail[2]));
                stockInfo.setCurrentValue(Convert.ToDouble(replyDetail[3]));
                stockInfo.setTodayMaxValue(Convert.ToDouble(replyDetail[4]));
                stockInfo.setTodayMinValue(Convert.ToDouble(replyDetail[5]));

                stockInfo.setFifthBuy(Convert.ToInt64(replyDetail[10]));
                stockInfo.setFirstBuyValue(Convert.ToDouble(replyDetail[11]));

                stockInfo.setSecondBuy(Convert.ToInt64(replyDetail[12]));
                stockInfo.setSecondBuyValue(Convert.ToDouble(replyDetail[13]));

                stockInfo.setThirdBuy(Convert.ToInt64(replyDetail[14]));
                stockInfo.setThirdBuyValue(Convert.ToDouble(replyDetail[15]));

                stockInfo.setForthBuy(Convert.ToInt64(replyDetail[16]));
                stockInfo.setForthBuyValue(Convert.ToDouble(replyDetail[17]));

                stockInfo.setFifthBuy(Convert.ToInt64(replyDetail[18]));
                stockInfo.setFifthBuyValue(Convert.ToDouble(replyDetail[19]));

                stockInfo.setFirstSale(Convert.ToInt64(replyDetail[20]));
                stockInfo.setFirstSaleValue(Convert.ToDouble(replyDetail[21]));

                stockInfo.setSecondSale(Convert.ToInt64(replyDetail[22]));
                stockInfo.setSecondSaleValue(Convert.ToDouble(replyDetail[23]));

                stockInfo.setThirdSale(Convert.ToInt64(replyDetail[24]));
                stockInfo.setThirdSaleValue(Convert.ToDouble(replyDetail[25]));

                stockInfo.setForthSale(Convert.ToInt64(replyDetail[26]));
                stockInfo.setForthSaleValue(Convert.ToDouble(replyDetail[27]));

                stockInfo.setFifthSale(Convert.To

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-07-20 16:10  HelloWorld\
     目录           0  2020-07-20 16:10  HelloWorld\.vs\
     目录           0  2020-07-20 16:17  HelloWorld\.vs\HelloWorld\
     目录           0  2020-07-20 16:17  HelloWorld\.vs\HelloWorld\DesignTimeBuild\
     文件       73609  2020-08-03 15:39  HelloWorld\.vs\HelloWorld\DesignTimeBuild\.dtbcache.v2
     目录           0  2020-07-20 16:10  HelloWorld\.vs\HelloWorld\v16\
     文件       44544  2020-08-03 15:39  HelloWorld\.vs\HelloWorld\v16\.suo
     目录           0  2020-08-03 15:35  HelloWorld\HelloWorld\
     文件        1136  2020-07-20 16:10  HelloWorld\HelloWorld.sln
     文件        3357  2020-07-23 14:45  HelloWorld\HelloWorld\AccessStock.cs
     目录           0  2020-07-20 16:22  HelloWorld\HelloWorld\bin\
     目录           0  2020-07-20 16:10  HelloWorld\HelloWorld\bin\Debug\
     目录           0  2020-07-23 15:28  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\
     文件        1402  2020-07-23 16:16  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.deps.json
     文件       24576  2020-08-03 15:38  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.dll
     文件      176128  2020-08-03 15:38  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.exe
     文件        7400  2020-08-03 15:38  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.pdb
     文件         182  2020-07-20 17:13  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.runtimeconfig.dev.json
     文件         161  2020-07-20 17:13  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\HelloWorld.runtimeconfig.json
     文件         110  2020-07-22 10:25  HelloWorld\HelloWorld\bin\Debug\netcoreapp3.1\stock.ini
     目录           0  2020-07-20 16:22  HelloWorld\HelloWorld\bin\Release\
     目录           0  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\
     文件        1402  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.deps.json
     文件       22016  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.dll
     文件      174592  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.exe
     文件        6048  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.pdb
     文件         182  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.runtimeconfig.dev.json
     文件         161  2020-07-23 15:12  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\HelloWorld.runtimeconfig.json
     文件          70  2020-07-21 08:48  HelloWorld\HelloWorld\bin\Release\netcoreapp3.1\stock.ini
     文件        1817  2020-07-23 15:21  HelloWorld\HelloWorld\FileAction.cs
     文件       13397  2020-08-03 15:35  HelloWorld\HelloWorld\Form1.cs
............此处省略48个文件信息

评论

共有 条评论