Exemplo n.º 1
0
        public void DataDeal(IList<Model.StockModel> dtKLine, bool powerChange, Model.stockinfo stock)
        {
            IList<Model.StockModel> oldList = null;
            IList<Model.StockModel> list = null;
            string stockCode = stock.stockcode;
            if (!powerChange)
            {
                oldList = GetListFromDb(stockCode);//

            }
            if (oldList != null && oldList.Count > 0)
            {
                list = oldList;
            }
            else
            {
                list = new List<Model.StockModel>();
            }
            int count = list.Count;
            for (int i = count; i < dtKLine.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                list.Add(model);
                list[i].Sampledate = dtKLine[i].Sampledate;
                list[i].Dic["psy"] = GetPsy(dtKLine, i);
                list[i].Dic["psyma"] = GetPsyMa(dtKLine, list, i);
                list[i].Status = 1;
            }
            BatchSaveData(list, stockCode, powerChange);
        }
Exemplo n.º 2
0
        public Model.StockModel ConvertToKLineObject(string val)
        {
            string[] ret = val.Split(',');
            decimal tempD = 0;
            Model.StockModel model = new Model.StockModel();
            model.Sampledate = int.Parse(ret[0]);

            model.Dic["o"] = decimal.Parse(ret[1]);//开盘价
            model.Dic["c"] = decimal.Parse(ret[2]);//收盘价
            model.Dic["h"] = decimal.Parse(ret[3]);//最高价
            model.Dic["l"] = decimal.Parse(ret[4]);//最低价
            model.Dic["cjl"] = decimal.Parse(ret[5]);//成交量
            model.Dic["jye"] = decimal.Parse(ret[6]);//交易额(万)

            decimal.TryParse(ret[7].Replace("%",""),out tempD);//换手率
            model.Dic["hsl"] = tempD/100;
            model.Dic["je"] = decimal.Parse(ret[8]);//涨跌金额
            decimal.TryParse(ret[9].Replace("%", ""), out tempD);//换手率
            model.Dic["fd"] = tempD / 100;
            model.Dic["mid"] = (model.Dic["h"]+model.Dic["l"])/2;
            model.Dic["powerc"] = model.Dic["c"];
            model.Dic["powerh"] = model.Dic["h"];
            model.Dic["powerl"] = model.Dic["l"];
            model.Dic["powero"] = model.Dic["o"];
            model.Dic["powermid"] = model.Dic["mid"];
            return model;
        }
Exemplo n.º 3
0
        public void DataDeal(IList<Model.StockModel> dtKLine, bool powerChange, Model.stockinfo stock)
        {
            IList<Model.StockModel> oldList = null;
            IList<Model.StockModel> list = null;
            string stockCode = stock.stockcode;
            if (!powerChange)
            {
                oldList = GetListFromDb(stockCode);//

            }
            if (oldList != null && oldList.Count > 0)
            {
                list = oldList;
            }
            else
            {
                list = new List<Model.StockModel>();
            }
            int count = list.Count;
            for (int i = count; i < dtKLine.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                list.Add(model);
                list[i].Sampledate = dtKLine[i].Sampledate;
                list[i].Dic["mid"] = GetCrMid(dtKLine, i);
                list[i].Dic["cr"] = GetCr(dtKLine, list, i);
                list[i].Dic["ma1"] = GetCrMa1(dtKLine, list, i);
                list[i].Dic["ma2"] = GetCrMa2(dtKLine, list, i);
                list[i].Dic["ma3"] = GetCrMa3(dtKLine, list, i);
                list[i].Dic["ma4"] = GetCrMa4(dtKLine, list, i);
                list[i].Status = 1;
                //SaveData(crarr[i], stockCode, powerChange);
            }
            BatchSaveData(list, stockCode, powerChange);
        }
Exemplo n.º 4
0
        public void DataDeal(IList<Model.StockModel> dtKLine, bool powerChange, Model.stockinfo stock)
        {
            IList<Model.StockModel> oldList = null;
            IList<Model.StockModel> list = null;
            string stockCode = stock.stockcode;
            if (!powerChange)
            {
                oldList = GetListFromDb(stockCode);//

            }
            if (oldList != null && oldList.Count > 0)
            {
                list = oldList;
            }
            else
            {
                list = new List<Model.StockModel>();
            }
            int count = list.Count;
            for (int i = count; i < dtKLine.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                list.Add(model);
                list[i].Sampledate = dtKLine[i].Sampledate;
                list[i].Dic["upline"] = GetUpLine(dtKLine, list, i);
                list[i].Dic["downline"] = GetDownLine(dtKLine, list, i);
                list[i].Dic["upline1"] = GetUpLine1(dtKLine, list, i);
                list[i].Dic["downline1"] = GetDownLine1(dtKLine, list, i);
                list[i].Dic["bbi"] = GetBbi(dtKLine, i);
                list[i].Dic["upr"] = GetUpr(dtKLine, list, i);
                list[i].Dic["dwn"] = GetDwn(dtKLine, list, i);
                list[i].Dic["safe"] = GetSafe(dtKLine, i);
                list[i].Dic["lc"] = GetLc(dtKLine, i);
                list[i].Dic["rsifz"] = GetRsiFz(dtKLine, list, i);
                list[i].Dic["rsifm"] = GetRsiFm(dtKLine, list, i);
                list[i].Dic["rsi"] = GetRsi(dtKLine, list, i);
                list[i].Dic["a7"] = GetA7(dtKLine, list, i);
                list[i].Dic["opt"] = GetOpt(dtKLine, list, i);
                list[i].Dic["opt1"] = GetOpt1(dtKLine, list, i);
                list[i].Dic["opt2"] = GetOpt2(dtKLine, list, i);
                list[i].Dic["var1"] = GetVar1(dtKLine, list, i);
                list[i].Dic["var2"] = GetVar2(dtKLine, list, i);
                list[i].Dic["sk"] = GetSk(dtKLine, list, i);
                list[i].Dic["sd"] = GetSd(dtKLine, list, i);
                list[i].Dic["d"] = GetD(dtKLine, list, i);
                list[i].Status = 1;
            }
            BatchSaveData(list, stockCode, powerChange);
        }
Exemplo n.º 5
0
        public void DataDeal(IList<Model.StockModel> dtKLine, bool powerChange, Model.stockinfo stock)
        {
            IList<Model.StockModel> oldList = null;
            IList<Model.StockModel> list = null;
            string stockCode = stock.stockcode;
            if (!powerChange)
            {
                oldList = GetListFromDb(stockCode);//

            }
            if (oldList != null && oldList.Count > 0)
            {
                list = oldList;
            }
            else
            {
                list = new List<Model.StockModel>();
            }
            int count = list.Count;
            for (int i = count; i < dtKLine.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                list.Add(model);
                list[i].Sampledate = dtKLine[i].Sampledate;
                list[i].Dic["xlyg2"] = Get2(dtKLine, list, i);
                list[i].Dic["xlyg3"] = Get3(dtKLine, list, i);
                list[i].Dic["xlyg5"] = Get5(dtKLine, list, i);
                list[i].Dic["xlyg8"] = Get8(dtKLine, list, i);
                list[i].Dic["xlyg13"] = Get13(dtKLine, list, i);
                list[i].Dic["xlyg21"] = Get21(dtKLine, list, i);
                list[i].Dic["xlygup"] = GetUp(dtKLine, list, i);
                list[i].Dic["xlygdown"] = GetDown(dtKLine, list, i);
                list[i].Dic["xlygupgui"] = GetUpGui(dtKLine, list, i);
                list[i].Dic["xlygdowngui"] = GetDownGui(dtKLine, list, i);
                list[i].Dic["xlygstock"] = GetStock(dtKLine, list, i);
                list[i].Dic["xlygmoney"] = GetMoney(dtKLine, list, i);
                list[i].Status = 1;
            }
            BatchSaveData(list, stockCode, powerChange);
        }
Exemplo n.º 6
0
        public IList<Model.StockModel> DtToList(DataTable dt)
        {
            IList<Model.StockModel> list = new List<Model.StockModel>();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                foreach (DataColumn column in dt.Columns)
                {
                    string columnName = column.ColumnName.ToLower();
                    if (columnName == "id" || columnName == "stockcode")
                    {
                        continue;
                    }
                    else if (columnName == "sampledate")
                    {
                        model.Sampledate = int.Parse(dt.Rows[i]["sampledate"].ToString());
                    }
                    else
                    {
                        try
                        {
                            decimal temp = decimal.Parse(dt.Rows[i][columnName].ToString());
                            model.Dic.Add(columnName, temp);
                        }
                        catch
                        {
                            model.Dic.Add(columnName, 0);
                        }

                    }
                }

                list.Add(model);
            }
            return list;
        }
Exemplo n.º 7
0
        public void DataDeal(IList<Model.StockModel> dtKLine, bool powerChange, Model.stockinfo stock)
        {
            IList<Model.StockModel> oldList = null;
            IList<Model.StockModel> list = null;
            string stockCode = stock.stockcode;
            if (!powerChange)
            {
                oldList = GetListFromDb(stockCode);//

            }
            if (oldList != null && oldList.Count > 0)
            {
                list = oldList;
            }
            else
            {
                list = new List<Model.StockModel>();
            }
            int count = list.Count;
            for (int i = count; i < dtKLine.Count; i++)
            {
                Model.StockModel model = new Model.StockModel();
                list.Add(model);
                list[i].Sampledate = dtKLine[i].Sampledate;
                list[i].Dic["rsv"] = GetRsv(dtKLine, list, i);
                list[i].Dic["k"] = GetK(dtKLine, list, i);
                list[i].Dic["d"] = GetD(dtKLine, list, i);
                list[i].Dic["j"] = GetJ(dtKLine, list, i);
                list[i].Dic["var1"] = GetVar1(dtKLine, list, i);
                list[i].Dic["var2"] = GetVar2(dtKLine, list, i);
                list[i].Dic["var3"] = GetVar3(dtKLine, list, i);
                decimal low = Formula.LLV(i, "powerl", 27, dtKLine);
                decimal high = Formula.HHV(i, "powerh", 27, dtKLine);
                list[i].Dic["var4sma1"] = GetVar4Sma1(low, high, dtKLine, list, i);
                list[i].Dic["var4sma2"] = GetVar4Sma2(low, high, dtKLine, list, i);
                list[i].Dic["var4sma3"] = GetVar4Sma3(low, high, dtKLine, list, i);
                list[i].Dic["var4"] = GetVar4(dtKLine, list, i);
                list[i].Dic["var5"] = GetVar5(dtKLine, list, i);
                list[i].Dic["var6"] = GetVar6(dtKLine, list, i);
                list[i].Dic["var7"] = GetVar7(dtKLine, list, i);
                list[i].Dic["var8"] = GetVar8(dtKLine, list, i);
                list[i].Dic["var9"] = GetVar9(dtKLine, list, i);

                list[i].Dic["vara"] = GetVarA(dtKLine, list, i);
                list[i].Dic["varb"] = GetVarB(dtKLine, list, i);
                list[i].Dic["varc"] = GetVarC(dtKLine, list, i, stock.tradableshare);
                list[i].Dic["vard"] = GetVarD(dtKLine, list, i);
                list[i].Dic["vare"] = GetVarE(dtKLine, list, i);
                list[i].Dic["varf"] = GetVarF(dtKLine, list, i);
                list[i].Dic["var10"] = GetVar10(dtKLine, list, i);
                list[i].Dic["buy"] = GetBuy(dtKLine, list, i);
                list[i].Dic["high"] = 80;
                list[i].Dic["middle"] = 50;
                list[i].Dic["bottom"] = 10;
                list[i].Dic["waveline"] = GetWaveLine(dtKLine, list, i);
                list[i].Dic["referline"] = GetReferLine(dtKLine, list, i);
                list[i].Dic["openeye"] = GetOpenEye(dtKLine, list, i);
                list[i].Dic["a1"] = GetA1(dtKLine, list, i);
                list[i].Dic["a2"] = GetA2(dtKLine, list, i);
                list[i].Dic["a3"] = GetA3(dtKLine, list, i);
                list[i].Dic["a4"] = GetA4(dtKLine, list, i);
                list[i].Dic["a5"] = GetA5(dtKLine, list, i);
                list[i].Dic["i"] = GetI(dtKLine, list, i);
                list[i].Dic["r"] = GetR(dtKLine, list, i);
                list[i].Status = 1;
            }
            BatchSaveData(list, stockCode, powerChange);
        }
Exemplo n.º 8
0
        private Model.StockModel ConvertToWeekKLineObject(string[] strList)
        {
            Model.StockModel model = new Model.StockModel();

            if (strList.Length > 4)
            {
                #region model init
                model.Dic["h"] = 0;
                model.Dic["l"] = 0;
                model.Dic["cjl"] = 0;
                model.Dic["jye"] = 0;
                model.Dic["hsl"] = 0;
                model.Dic["je"] = 0;
                model.Dic["fd"] = 0;
                model.Dic["mid"] = 0;
                model.Dic["powerh"] = 0;
                model.Dic["powerl"] = 0;
                model.Dic["powermid"] = 0;
                #endregion
                for (int j = 0; j < 4; j++)
                {
                    string[] ret = strList[strList.Length - 1 - j].Split(',');
                    model.Sampledate = int.Parse("20" + ret[0].Substring(0, 6));
                    decimal tempD = 0;

                    if (j == 0)
                    {
                        model.Dic["c"] = decimal.Parse(ret[2]);//收盘价
                        model.Dic["powerc"] = model.Dic["c"];
                    }
                    else if (j == 3)
                    {
                        model.Dic["o"] = decimal.Parse(ret[1]);//开盘价
                        model.Dic["powero"] = model.Dic["o"];
                    }

                    model.Dic["h"] = Math.Max(decimal.Parse(ret[3]), model.Dic["h"]);//最高价
                    if (model.Dic["l"] == 0)
                    {
                        model.Dic["l"] = decimal.Parse(ret[4]);//最低价
                    }
                    else
                    {
                        model.Dic["l"] = Math.Min(decimal.Parse(ret[4]), model.Dic["l"]); ;//最低价
                    }

                    model.Dic["mid"] = (model.Dic["h"] + model.Dic["l"]) / 2;
                    model.Dic["powerh"] = model.Dic["h"];
                    model.Dic["powerl"] = model.Dic["l"];
                    model.Dic["powermid"] = model.Dic["mid"];

                    model.Dic["cjl"] += decimal.Parse(ret[5]);//成交量
                    model.Dic["jye"] += decimal.Parse(ret[6]);//交易额(万)

                    decimal.TryParse(ret[7].Replace("%", ""), out tempD);//换手率
                    model.Dic["hsl"] += tempD / 100;
                    model.Dic["je"] += decimal.Parse(ret[9]);//涨跌金额
                    decimal.TryParse(ret[8].Replace("%", ""), out tempD);//涨跌幅度
                    model.Dic["fd"] += tempD / 100;}
            }

            return model;
        }