Beispiel #1
0
        private void ChecknBuy(DataSet aDsCpWatch)
        {
            DataSet dsRaw = aDsCpWatch;
            SqlDal  sd    = new SqlDal(cConnString);

            sd.SellAction_Signal_21_22();
            sd.SellAction_Signal_MinusLimit();

            DateTime BuyStartTime = sd.GetBuyStartTime();

            foreach (DataRow dr in dsRaw.Tables[0].Rows)
            {
                string StockCode = dr["STOCKCODE"].ToString();
                string WatchCode = dr["MARKETWATCHCODE"].ToString();

                if (WatchCode == "21" || WatchCode == "29" ||
                    WatchCode == "22" || WatchCode == "43" ||
                    WatchCode == "23" || WatchCode == "81" ||
                    WatchCode == "24" || WatchCode == "82"
                    )
                {
                    if (DateTime.Now >= BuyStartTime)
                    {
                        if (!sd.HasStock_Signal(StockCode, WatchCode))
                        {
                            sd.BuyAction(StockCode, WatchCode);
                        }
                    }
                }
                else
                {
                    if (WatchCode == "41" || WatchCode == "50" ||
                        WatchCode == "45" || WatchCode == "52" ||
                        WatchCode == "46" || WatchCode == "54" ||
                        WatchCode == "48" || WatchCode == "56" ||
                        WatchCode == "58" || WatchCode == "66" ||
                        WatchCode == "60" || WatchCode == "68" ||
                        WatchCode == "62" || WatchCode == "70" ||
                        WatchCode == "64" ||
                        WatchCode == "C011-1" || WatchCode == "C011-3" ||
                        WatchCode == "C011-5" || WatchCode == "C011-7" ||
                        WatchCode == "D011-1" || WatchCode == "D011-3" ||
                        WatchCode == "D011-5" || WatchCode == "D011-7" ||
                        WatchCode == "A03" || WatchCode == "A05" || WatchCode == "A07"
                        )
                    {
                        // Day 기준
                        if (WatchCode == "A03" || WatchCode == "A05" || WatchCode == "A07")
                        {
                            if (!sd.HasStock_Signal(StockCode, WatchCode))
                            {
                                sd.BuyAction(StockCode, WatchCode);
                            }
                        }
                        // 그외 (Min 기준)
                        else if (DateTime.Now >= BuyStartTime)
                        {
                            if (!sd.HasStock_Signal(StockCode, WatchCode))
                            {
                                sd.BuyAction(StockCode, WatchCode);
                            }
                        }
                    }
                    else
                    {
                        string TargetWatchCode = string.Empty;
                        if (WatchCode == "42")
                        {
                            TargetWatchCode = "41";
                        }
                        else if (WatchCode == "44")
                        {
                            TargetWatchCode = "45";
                        }
                        else if (WatchCode == "47")
                        {
                            TargetWatchCode = "46";
                        }
                        else if (WatchCode == "49")
                        {
                            TargetWatchCode = "48";
                        }
                        else if (WatchCode == "51")
                        {
                            TargetWatchCode = "50";
                        }
                        else if (WatchCode == "53")
                        {
                            TargetWatchCode = "52";
                        }
                        else if (WatchCode == "55")
                        {
                            TargetWatchCode = "54";
                        }
                        else if (WatchCode == "57")
                        {
                            TargetWatchCode = "56";
                        }
                        else if (WatchCode == "59")
                        {
                            TargetWatchCode = "58";
                        }
                        else if (WatchCode == "61")
                        {
                            TargetWatchCode = "60";
                        }
                        else if (WatchCode == "63")
                        {
                            TargetWatchCode = "62";
                        }
                        else if (WatchCode == "65")
                        {
                            TargetWatchCode = "64";
                        }
                        else if (WatchCode == "67")
                        {
                            TargetWatchCode = "66";
                        }
                        else if (WatchCode == "69")
                        {
                            TargetWatchCode = "68";
                        }
                        else if (WatchCode == "71")
                        {
                            TargetWatchCode = "70";
                        }
                        else if (WatchCode == "C021-1")
                        {
                            TargetWatchCode = "('C011-1','D011-1')";
                        }
                        else if (WatchCode == "C021-3")
                        {
                            TargetWatchCode = "('C011-3','D011-3')";
                        }
                        else if (WatchCode == "C021-5")
                        {
                            TargetWatchCode = "('C011-5','D011-5')";
                        }
                        else if (WatchCode == "C021-7")
                        {
                            TargetWatchCode = "('C011-7','D011-7')";
                        }
                        else if (WatchCode == "A04")
                        {
                            TargetWatchCode = "A03";
                        }
                        else if (WatchCode == "A06")
                        {
                            TargetWatchCode = "A05";
                        }
                        else if (WatchCode == "A08")
                        {
                            TargetWatchCode = "A07";
                        }

                        if (sd.HasStock_Signal(StockCode, TargetWatchCode))
                        {
                            sd.SellAction_Signal_41_42(StockCode, TargetWatchCode);
                        }
                    }
                }
            }
        }