Beispiel #1
0
        public bool isGoodTiming(string aStockCode)
        {
            bool retbool = false;

            try
            {
                SqlDal  sd      = new SqlDal(cConnString);
                DataSet dsCur   = sd.GetLatestStockCur(aStockCode);
                DataSet dsBuy01 = sd.GetBUY01(aStockCode);

                if (dsCur.Tables.Count > 0 && dsCur.Tables[0].Rows.Count > 0)
                {
                    if (dsBuy01.Tables.Count > 0 && dsBuy01.Tables[0].Rows.Count > 0)
                    {
                        if (HasStock(aStockCode))
                        {
                            // 해당 종목 보유시에는 구매 Timing 이 아님
                            retbool = false;
                        }
                        else if (BuyCheck(dsCur, dsBuy01))
                        {
                            retbool = true;
                        }
                        else
                        {
                            retbool = false;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Trader-gini_STOCKCUR-GoodTiming", e.ToString());
            }

            return(retbool);
        }
Beispiel #2
0
        private void ChecknBuy(object aStockCode)
        {
            try
            {
                string sCode = aStockCode.ToString();

                SqlDal  sd      = new SqlDal(cConnString);
                DataSet dsCur   = sd.GetLatestStockCur(sCode);
                DataSet dsBuy01 = sd.GetBUY01(sCode);

                if (dsCur.Tables.Count > 0 && dsCur.Tables[0].Rows.Count > 0)
                {
                    if (dsBuy01.Tables.Count > 0 && dsBuy01.Tables[0].Rows.Count > 0)
                    {
                        if (HasStock(sCode))
                        {
                            ChecknSell(sCode);
                        }
                        else
                        {
                            if (BuyCheck(dsCur, dsBuy01))
                            {
                                if (DateTime.Now <= sd.GetBuyLimitTime())
                                {
                                    Do_Buy(sCode);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Simulator", e.ToString());
            }
        }