private void OnReceiveTrData_Opt10060PriceMaedo(string sRQName, DataTable dt, int sPreNext) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10060, sRQName); DataTable dtDate = new DataTable(); KiwoomQuery kiwoom = new KiwoomQuery(); TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (dt != null) { foreach (DataRow dr in dt.Rows) { WriteTextSafe(stockCode + "(PRICE매도)" + "[" + dr["일자"].ToString() + "] 작업중"); arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"]); arrParam.Add("@MAEME_GB", "2"); arrParam.Add("@DATE_SEQNO", 0); arrParam.Add("@NUJUK_TRDAEGUM", dr["누적거래대금"]); arrParam.Add("@GAIN_PRICE", dr["개인투자자"]); arrParam.Add("@FORE_PRICE", dr["외국인투자자"]); arrParam.Add("@GIGAN_PRICE", dr["기관계"]); arrParam.Add("@GUMY_PRICE", dr["금융투자"]); arrParam.Add("@BOHUM_PRICE", dr["보험"]); arrParam.Add("@TOSIN_PRICE", dr["투신"]); arrParam.Add("@GITA_PRICE", dr["기타금융"]); arrParam.Add("@BANK_PRICE", dr["은행"]); arrParam.Add("@YEONGI_PRICE", dr["연기금등"]); arrParam.Add("@SAMO_PRICE", dr["사모펀드"]); arrParam.Add("@NATION_PRICE", dr["국가"]); arrParam.Add("@BUBIN_PRICE", dr["기타법인"]); arrParam.Add("@IOFORE_PRICE", dr["내외국인"]); arrParam.Add("@GIGAN_SUM_PRICE", Convert.ToInt32(dr["금융투자"]) + Convert.ToInt32(dr["보험"]) + Convert.ToInt32(dr["투신"]) + Convert.ToInt32(dr["기타금융"]) + Convert.ToInt32(dr["은행"]) + Convert.ToInt32(dr["연기금등"]) + Convert.ToInt32(dr["사모펀드"]) + Convert.ToInt32(dr["국가"])); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10060PriceAdd", CommandType.StoredProcedure, arrParam); } } _opt10060.Dispose(); tcs.SetResult(true); ClsAxKH.AxKH_10060_OnReceived -= new ClsAxKH.OnReceivedEventHandler(OnReceiveTrData_Opt10060PriceMaedo); GetOpt10060Caller(Opt10060TransType.QtyMaesu, stockCode, "", ""); }
private void Opt10081_OnReceived(string sRQName, DataTable dt, int sPreNext) { string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10081, sRQName); TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"]); arrParam.Add("@DATE_SEQNO", 0); arrParam.Add("@NOW_PRICE", dr["현재가"]); arrParam.Add("@TRADE_QTY", dr["거래량"]); arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); arrParam.Add("@START_PRICE", dr["시가"]); arrParam.Add("@HIGH_PRICE", dr["고가"]); arrParam.Add("@LOW_PRICE", dr["저가"]); arrParam.Add("@CHG_JUGA_GB", dr["수정주가구분"]); arrParam.Add("@CHG_RATE", dr["수정비율"]); arrParam.Add("@CHG_JUGA_EVENT", dr["수정주가이벤트"]); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10081Add", CommandType.StoredProcedure, arrParam); } } _opt10081.Dispose(); tcs.SetResult(true); GetOpt10060Caller(Opt10060TransType.PriceMaesu, stockCode: stockCode, MaxDate: "", MinDate: ""); }
private void Opt90002_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (tcs == null || tcs.Task.IsCompleted) { return; } string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt90002, sRQName); if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { arrParam.Clear(); //DataTable stockName = _dt.AsEnumerable().Where(Row => Row.Field<string>("STOCK_NAME") == dr["STOCK_NAME"].ToString().Trim()).CopyToDataTable(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@KTH_CODE", stockCode); arrParam.Add("@STOCK_CODE", dr["종목코드"].ToString().Trim()); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_KthstAdd", CommandType.StoredProcedure, arrParam); WriteTextSafe("(" + stockCode + ")" + dr["종목코드"].ToString().Trim()); } } _opt90002.Dispose(); tcs.SetResult(true); OnGetKthCode(); }
private void Opt10015_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ""; string stdDate = ""; string maxDate = ""; string minDate = ""; string chainMaxDate = ""; stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10015, sRQName); stdDate = ClsAxKH.RetStdDateBysRqName(ClsAxKH.OptType.Opt10015, sRQName); try { if (dt != null) { maxDate = dt.Compute("max([일자])", string.Empty).ToString().Trim(); minDate = dt.Compute("min([일자])", string.Empty).ToString().Trim(); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); var rows = _dtOptCalMagam.AsEnumerable().Where(Row => Row.Field <string>("STOCK_CODE") == stockCode); foreach (DataRow dr2th in rows) { if (dr2th["CHAIN_COMP_GB"].ToString().Trim() == "Y") { chainMaxDate = dr2th["CHAIN_MAX_DATE"].ToString().Trim(); } } } if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { WriteTextSafe(stockCode + "(" + dr["일자"] + ")"); arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"].ToString()); arrParam.Add("@LAST_PRICE", dr["종가"]); arrParam.Add("@OAGO_DAEBI_SYMBOL", dr["전일대비기호"]); arrParam.Add("@OAGO_DAEBI", dr["전일대비"]); arrParam.Add("@UPDOWN_RATE", dr["등락율"]); arrParam.Add("@TRADE_QTY", dr["거래량"]); arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); arrParam.Add("@BETRADE_QTY", dr["장전거래량"]); arrParam.Add("@BETRADE_BIJUNG", dr["장전거래비중"]); arrParam.Add("@INTRADE_QTY", dr["장중거래량"]); arrParam.Add("@INTRADE_BIJUNG", dr["장중거래비중"]); arrParam.Add("@AFTRADE_QTY", dr["장후거래량"]); arrParam.Add("@AFTRADE_BIJUNG", dr["장후거래비중"]); arrParam.Add("@SUM3", dr["합계3"]); arrParam.Add("@GITRADE_QTY", dr["기간중거래량"]); arrParam.Add("@BETRADE_DAEGUM", dr["장전거래대금"]); arrParam.Add("@BETRADE_DBIJUNG", dr["장전거래대금비중"]); arrParam.Add("@INTRADE_DAEGUM", dr["장중거래대금"]); arrParam.Add("@INTRADE_DBIJUNG", dr["장중거래대금비중"]); arrParam.Add("@AFTRADE_DAEGUM", dr["장후거래대금"]); arrParam.Add("@AFTRADE_DBIJUNG", dr["장후거래대금비중"]); arrParam.Add("@DEUNG_DATE", ""); arrParam.Add("@DEUNG_TIME", ""); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10015Add", CommandType.StoredProcedure, arrParam); if (chainMaxDate != "") { if (chainMaxDate == dr["일자"].ToString().Trim()) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10015.Dispose(); tcs.SetResult(true); WaitTime(); OnGetStockCode(); return; } } } } // 최근 거래일 100일을 가져오는걸로 한다면 if (chk100.Checked == true) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } else { if (sPreNext == 2) { tcs.SetResult(true); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "S", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); WaitTime(); _opt10015.SetInit(_FormId); _opt10015.JustRequest(StockCode: sRQNameArray[1].ToString().Trim(), StartDate: sRQNameArray[2].ToString().Trim(), StockName: "", nPrevNext: 2); OPS10060.Text = ClsAxKH._limitCount.ToString(); lblTime.Text = ClsAxKH._limitTime.ToString(); return; } else { if (dt != null) { ClsDbLogger.OptCallMagamStoredData(actionGb: "CE", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } else { ClsDbLogger.OptCallMagamStoredData(actionGb: "EE", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "F", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } } } catch (Exception ex) { _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); MessageBox.Show(ex.Message.ToString()); throw; } }
private void Opt10005_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10005, sRQName); if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { if (_MaxStockDate10005 == dr["날짜"].ToString().Trim()) { _opt10005.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } else { //arrParam.Clear(); //arrParam.Add("@ACTION_GB", "A"); //arrParam.Add("@STOCK_CODE", stockCode); //arrParam.Add("@STOCK_DATE", dr["일자"]); //arrParam.Add("@DATE_SEQNO", 0); //arrParam.Add("@NOW_PRICE", dr["현재가"]); //arrParam.Add("@TRADE_QTY", dr["거래량"]); //arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); //arrParam.Add("@START_PRICE", dr["시가"]); //arrParam.Add("@HIGH_PRICE", dr["고가"]); //arrParam.Add("@LOW_PRICE", dr["저가"]); //arrParam.Add("@CHG_JUGA_GB", dr["수정주가구분"]); //arrParam.Add("@CHG_RATE", dr["수정비율"]); //arrParam.Add("@CHG_JUGA_EVENT", dr["수정주가이벤트"]); //arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); //oSql.ExecuteNonQuery("p_Opt10005Add", CommandType.StoredProcedure, arrParam); } } } if (sPreNext == 2) { tcs.SetResult(true); _opt10005.SetInit(_FormId); _opt10005.JustRequest(StockCode: sRQNameArray[1].ToString().Trim(), StockName: "", nPrevNext: 2); } else { _opt10005.Dispose(); tcs.SetResult(true); } OnGetStockCode(); }
private void Opt10001_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10001, sRQName); if (tcs == null || tcs.Task.IsCompleted) { return; } try { if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", dr["종목코드"]); arrParam.Add("@CALL_DATE", ""); arrParam.Add("@CALL_TIME", ""); arrParam.Add("@결산월", dr["결산월"]); arrParam.Add("@액면가", ConvertInt32ToString(dr["액면가"].ToString())); arrParam.Add("@자본금", ConvertInt32ToString(dr["자본금"].ToString())); arrParam.Add("@상장주식", ConvertInt32ToString(dr["상장주식"].ToString())); arrParam.Add("@신용비율", ConvertDecimalToString(dr["신용비율"].ToString())); arrParam.Add("@연중최고", ConvertInt32ToString(dr["연중최고"].ToString())); arrParam.Add("@연중최저", ConvertInt32ToString(dr["연중최저"].ToString())); arrParam.Add("@시가총액", ConvertInt32ToString(dr["시가총액"].ToString())); arrParam.Add("@시가총액비중", dr["시가총액비중"].ToString()); arrParam.Add("@외인소진률", ConvertDecimalToString(dr["외인소진률"].ToString())); arrParam.Add("@대용가", ConvertInt32ToString(dr["대용가"].ToString())); arrParam.Add("@PER", ConvertDecimalToString(dr["PER"].ToString())); arrParam.Add("@EPS", ConvertInt32ToString(dr["EPS"].ToString())); arrParam.Add("@ROE", ConvertDecimalToString(dr["ROE"].ToString())); arrParam.Add("@PBR", ConvertDecimalToString(dr["PBR"].ToString())); arrParam.Add("@EV", ConvertDecimalToString(dr["EV"].ToString())); arrParam.Add("@BPS", ConvertInt32ToString(dr["BPS"].ToString())); arrParam.Add("@매출액", ConvertInt32ToString(dr["매출액"].ToString())); arrParam.Add("@영업이익", ConvertDecimalToString(dr["영업이익"].ToString())); arrParam.Add("@당기순이익", ConvertDecimalToString(dr["당기순이익"].ToString())); arrParam.Add("@최고250", ConvertInt32ToString(dr["250최고"].ToString())); arrParam.Add("@최저250", ConvertInt32ToString(dr["250최저"].ToString())); arrParam.Add("@시가", ConvertInt32ToString(dr["시가"].ToString())); arrParam.Add("@고가", ConvertInt32ToString(dr["고가"].ToString())); arrParam.Add("@저가", ConvertInt32ToString(dr["저가"].ToString())); arrParam.Add("@상한가", ConvertInt32ToString(dr["상한가"].ToString())); arrParam.Add("@하한가", ConvertInt32ToString(dr["하한가"].ToString())); arrParam.Add("@기준가", ConvertInt32ToString(dr["기준가"].ToString())); arrParam.Add("@예상체결가", ConvertInt32ToString(dr["예상체결가"].ToString())); arrParam.Add("@예상체결수량", ConvertInt32ToString(dr["예상체결수량"].ToString())); arrParam.Add("@최고가일250", dr["250최고가일"].ToString()); arrParam.Add("@최고가대비율250", ConvertDecimalToString(dr["250최고가대비율"].ToString())); arrParam.Add("@최저가일250", dr["250최저가일"].ToString()); arrParam.Add("@최저가대비율250", ConvertDecimalToString(dr["250최저가대비율"].ToString())); arrParam.Add("@현재가", ConvertInt32ToString(dr["현재가"].ToString())); arrParam.Add("@대비기호", dr["대비기호"].ToString()); arrParam.Add("@전일대비", ConvertDecimalToString(dr["전일대비"].ToString())); arrParam.Add("@등락율", ConvertDecimalToString(dr["등락율"].ToString())); arrParam.Add("@거래량", ConvertInt32ToString(dr["거래량"].ToString())); arrParam.Add("@거래대비액", ConvertDecimalToString(dr["거래대비"].ToString())); arrParam.Add("@액면가단위", dr["액면가단위"].ToString()); arrParam.Add("@유통주식", ConvertInt32ToString(dr["유통주식"].ToString())); arrParam.Add("@유통비율", ConvertDecimalToString(dr["유통비율"].ToString())); arrParam.Add("@R_ErrorCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10001Add", CommandType.StoredProcedure, arrParam); } } _opt10001.Dispose(); tcs.SetResult(true); OnGetStockCode(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); _opt10001.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; throw; } }
private void Opt20068_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt20068, sRQName); if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { if (_MaxStockDate20068 == dr["일자"].ToString().Trim()) { _opt20068.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } else { arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"]); arrParam.Add("@LT_CON_CNT", dr["대차거래체결주수"]); arrParam.Add("@LT_REPAY_CNT", dr["대차거래상환주수"]); arrParam.Add("@LT_INCRE", dr["대차거래증감"]); arrParam.Add("@BALANCE_CNT", dr["잔고주수"]); arrParam.Add("@BALANCE_PRICE", dr["잔고금액"]); arrParam.Add("@R_ErrorCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt20068Add", CommandType.StoredProcedure, arrParam); } } } if (sPreNext == 2) { tcs.SetResult(true); _opt20068.SetInit(_FormId); _opt20068.JustRequest(startDate: sRQNameArray[1].ToString().Trim(), endDate: sRQNameArray[2].ToString().Trim(), allGb: sRQNameArray[3].ToString().Trim(), stockCode: sRQNameArray[4].ToString().Trim(), nPrevNext: 2); } else { _opt20068.Dispose(); tcs.SetResult(true); } OnGetStockCode(); }
private void Opt10015_OnReceived(string sRQName, DataTable dt, int sPreNext) { string[] sRQNameArray = sRQName.Split(','); string stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10015, sRQName); TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (tcs == null || tcs.Task.IsCompleted) { return; } // 최근 100일 내역만 질의한다. if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { WriteTextSafe(stockCode + "(일자별상세)" + "[" + dr["일자"].ToString() + "] 작업중"); arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"].ToString()); arrParam.Add("@LAST_PRICE", dr["종가"]); arrParam.Add("@OAGO_DAEBI_SYMBOL", dr["전일대비기호"]); arrParam.Add("@OAGO_DAEBI", dr["전일대비"]); arrParam.Add("@UPDOWN_RATE", dr["등락율"]); arrParam.Add("@TRADE_QTY", dr["거래량"]); arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); arrParam.Add("@BETRADE_QTY", dr["장전거래량"]); arrParam.Add("@BETRADE_BIJUNG", dr["장전거래비중"]); arrParam.Add("@INTRADE_QTY", dr["장중거래량"]); arrParam.Add("@INTRADE_BIJUNG", dr["장중거래비중"]); arrParam.Add("@AFTRADE_QTY", dr["장후거래량"]); arrParam.Add("@AFTRADE_BIJUNG", dr["장후거래비중"]); arrParam.Add("@SUM3", dr["합계3"]); arrParam.Add("@GITRADE_QTY", dr["기간중거래량"]); arrParam.Add("@BETRADE_DAEGUM", dr["장전거래대금"]); arrParam.Add("@BETRADE_DBIJUNG", dr["장전거래대금비중"]); arrParam.Add("@INTRADE_DAEGUM", dr["장중거래대금"]); arrParam.Add("@INTRADE_DBIJUNG", dr["장중거래대금비중"]); arrParam.Add("@AFTRADE_DAEGUM", dr["장후거래대금"]); arrParam.Add("@AFTRADE_DBIJUNG", dr["장후거래대금비중"]); arrParam.Add("@DEUNG_DATE", ""); arrParam.Add("@DEUNG_TIME", ""); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10015Add", CommandType.StoredProcedure, arrParam); } } _opt10015.Dispose(); tcs.SetResult(true); GetOpt10081Caller(stockCode: stockCode); }
private void Opt10081_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ""; string stdDate = ""; string maxDate = ""; string minDate = ""; string chainMaxDate = ""; stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10081, sRQName); stdDate = ClsAxKH.RetStdDateBysRqName(ClsAxKH.OptType.Opt10081, sRQName); try { if (dt != null) { maxDate = dt.Compute("max([일자])", string.Empty).ToString().Trim(); minDate = dt.Compute("min([일자])", string.Empty).ToString().Trim(); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); var rows = _dtOptCalMagam.AsEnumerable().Where(Row => Row.Field <string>("STOCK_CODE") == stockCode); foreach (DataRow dr2th in rows) { if (dr2th["CHAIN_COMP_GB"].ToString().Trim() == "Y") { chainMaxDate = dr2th["CHAIN_MAX_DATE"].ToString().Trim(); } } } if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { WriteTextSafe(stockCode + "(" + dr["일자"] + ")"); arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"]); arrParam.Add("@DATE_SEQNO", 0); arrParam.Add("@NOW_PRICE", dr["현재가"]); arrParam.Add("@TRADE_QTY", dr["거래량"]); arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); arrParam.Add("@START_PRICE", dr["시가"]); arrParam.Add("@HIGH_PRICE", dr["고가"]); arrParam.Add("@LOW_PRICE", dr["저가"]); arrParam.Add("@CHG_JUGA_GB", dr["수정주가구분"]); arrParam.Add("@CHG_RATE", dr["수정비율"]); arrParam.Add("@CHG_JUGA_EVENT", dr["수정주가이벤트"]); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10081Add", CommandType.StoredProcedure, arrParam); if (chainMaxDate != "") { if (chainMaxDate == dr["일자"].ToString().Trim()) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10081.Dispose(); WaitTime(); tcs.SetResult(true); OnGetStockCode(); return; } } } } else { ClsDbLogger.OptCallMagamStoredData(actionGb: "EE", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "F", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); _opt10081.Dispose(); WaitTime(); tcs.SetResult(true); OnGetStockCode(); return; } // 최근 거래일 100일을 가져오는걸로 한다면 if (chk100.Checked == true) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10081.Dispose(); WaitTime(); tcs.SetResult(true); OnGetStockCode(); return; } else { if (sPreNext == 2) { tcs.SetResult(true); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "S", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); //_clsDataAccessUtil.Delay(3600); WaitTime(); _opt10081.SetInit(_FormId); _opt10081.JustRequest(StockCode: sRQNameArray[1].ToString().Trim(), StockName: "", StdDate: sRQNameArray[2].ToString().Trim(), ModifyJugaGb: sRQNameArray[3].ToString().Trim(), nPrevNext: 2); } else { if (dt != null) { ClsDbLogger.OptCallMagamStoredData(actionGb: "CE", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } else { ClsDbLogger.OptCallMagamStoredData(actionGb: "EE", optCaller: "OPT10081", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "F", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } _opt10081.Dispose(); WaitTime(); tcs.SetResult(true); OnGetStockCode(); return; } } } catch (Exception ex) { _opt10081.Dispose(); tcs.SetResult(true); OnGetStockCode(); WaitTime(); MessageBox.Show(ex.Message.ToString()); throw; } }