Пример #1
0
        private void FormatELWFMDropModel()
        {
            try
            {
                for (var i = 0; i < dropList.Count; i++)
                {
                    ELWFMDropModel drop           = (ELWFMDropModel)dropList[i]; //미래1507OCI머티콜
                    char[]         temp_array     = drop.OrgSource.ToCharArray();
                    string         str_issuername = "";
                    foreach (var item in temp_array)
                    {
                        int asciiCode = (int)item;
                        if (asciiCode > 47 && asciiCode < 58)
                        {
                            break;
                        }
                        str_issuername += item;
                    }

                    int no = 0;
                    for (var j = 0; j < temp_array.Length; j++)
                    {
                        int asciiCode = (int)temp_array[j];
                        if (asciiCode > 47 && asciiCode < 58)
                        {
                            no = j;
                            break;
                        }
                    }
                    string CharLen = drop.OrgSource.Substring(no, 4).Trim().ToString();

                    drop.Type = "WNT";

                    string          shortname = "";
                    KoreaIssuerInfo issuer    = KoreaIssuerManager.SelectIssuer(str_issuername);
                    if (issuer != null)
                    {
                        drop.Ticker = issuer.IssuerCode2 + CharLen;
                        drop.RIC    = issuer.IssuerCode2 + CharLen + ".KS";
                        shortname   = issuer.IssuerCode4;
                    }
                    string tempCompany = string.Empty;
                    //현대1882삼성엔지콜
                    if (!drop.OrgSource.Contains("조기종료"))
                    {
                        tempCompany  = drop.OrgSource;
                        drop.Comment = "Premature";
                    }
                    else
                    {
                        tempCompany  = drop.OrgSource.Replace("조기종료", "");
                        drop.Comment = "KOBA Drop";
                    }
                    string last = tempCompany.Substring((no + 4)).Trim().ToString();
                    string str_underlying_Dsply_Nmll = last.Substring(0, (last.Length - 1)).Trim().ToString();
                    if (str_underlying_Dsply_Nmll == "KOSPI200")
                    {
                        str_underlying_Dsply_Nmll = "코스피";
                    }
                    else if (str_underlying_Dsply_Nmll == "스탠차")
                    {
                        str_underlying_Dsply_Nmll = "스탠다드차타드";
                    }
                    else if (str_underlying_Dsply_Nmll == "IBK")
                    {
                        str_underlying_Dsply_Nmll = "아이비케이";
                    }
                    else if (str_underlying_Dsply_Nmll == "HMC")
                    {
                        str_underlying_Dsply_Nmll = "에이치엠씨";
                    }
                    else if (str_underlying_Dsply_Nmll == "KB")
                    {
                        str_underlying_Dsply_Nmll = "케이비";
                    }
                    string str_call_or_put = last.Substring((last.Length - 1)).Trim().ToString();

                    string idn_name = "***";
                    KoreaUnderlyingInfo underlying = KoreaUnderlyingManager.SelectUnderlying(str_underlying_Dsply_Nmll, KoreaNameType.KoreaNameForDrop);
                    if (underlying == null)
                    {
                        Logger.Log("Can not find underlying info with Korea Name for Drop:" + str_underlying_Dsply_Nmll + ". Please input the ISIN.", Logger.LogType.Warning);
                        string isin = InputISIN.Prompt(str_underlying_Dsply_Nmll, "Korea Name For Drop");
                        if (!string.IsNullOrEmpty(isin))
                        {
                            underlying = KoreaUnderlyingManager.SelectUnderlyingByISIN(isin);
                            KoreaUnderlyingManager.UpdateKoreaNameDrop(str_underlying_Dsply_Nmll, isin);
                        }
                    }
                    if (underlying != null)
                    {
                        idn_name = underlying.IDNDisplayNamePart;
                    }
                    if (drop.Comment == "KOBA Drop")
                    {
                        idn_name += "KO";
                    }
                    if (str_call_or_put == "콜")
                    {
                        str_call_or_put = "C";
                    }
                    else if (str_call_or_put == "풋")
                    {
                        str_call_or_put = "P";
                    }

                    string _idn_display_name = (shortname + CharLen + idn_name + str_call_or_put).ToString();
                    drop.IDNDisplayName = _idn_display_name;

                    if (str_issuername == "스탠차")
                    {
                        str_issuername = "스탠다드차타드";
                    }
                    if (str_issuername == "IBK")
                    {
                        str_issuername = "아이비케이";
                    }
                    if (str_issuername == "HMC")
                    {
                        str_issuername = "에이치엠씨";
                    }
                    if (str_issuername == "KB")
                    {
                        str_issuername = "케이비";
                    }

                    //우리1C83삼성테크콜
                    drop.Issuername = str_issuername;
                    drop.Num        = "제" + CharLen + "호";
                }
            }
            catch (Exception ex)
            {
                string msg = "Error found in _ELWFMDropModelFormat()    : " + ex.ToString();
                Logger.Log(msg, Logger.LogType.Error);
            }
        }
Пример #2
0
        private void FormatEntityData(List <FMELWEntity> listFMELW)
        {
            if (listFMELW == null || listFMELW.Count == 0)
            {
                string msg = "there is not useful data in the file";
                Logger.Log(msg, Logger.LogType.Warning);
                return;
            }

            string updateDate   = DateTime.Now.ToString("dd-MMM-yy");
            string updateYear   = DateTime.Now.ToString("yyyy");
            int    lengthTicker = 0;

            try
            {
                foreach (var fm in listFMELW)
                {
                    lengthTicker = fm.Ticker.Length;
                    DateTime matDate   = DateTime.Parse(fm.MatDate);
                    DateTime issueDate = DateTime.Parse(fm.IssueDate);
                    fm.Ticker        = fm.Ticker.Substring(lengthTicker - 6, 6);
                    fm.UpdatedDate   = updateDate;
                    fm.EffectiveDate = updateYear;
                    fm.RIC           = fm.Ticker + ".KS";
                    fm.FM            = "1";
                    string bcastRef = string.Empty;

                    if (string.IsNullOrEmpty(fm.XSovereignIssuingAuthority.Trim()))
                    {
                        bcastRef = fm.YStockIndexTypes.Trim();
                    }
                    else
                    {
                        bcastRef = fm.XSovereignIssuingAuthority.Trim();
                        bcastRef = bcastRef.Replace("(주)", "").Replace("구성주식비율: 1", "");
                    }

                    KoreaUnderlyingInfo underlying = KoreaUnderlyingManager.SelectUnderlying(bcastRef);
                    KoreaIssuerInfo     issuer     = KoreaIssuerManager.SelectIssuerByIssuerCode2(fm.Ticker.Trim().Substring(0, 2));
                    fm.IDNDisplayName += issuer.IssuerCode4;
                    fm.IDNDisplayName += fm.Ticker.Substring(2, 4);
                    fm.IDNDisplayName += underlying.IDNDisplayNamePart;

                    if (fm.KoreaWarrantName.Trim() == "콜")
                    {
                        fm.IDNDisplayName += "C";    //  "C" ***************** KBIS  +4019 + underlying.IDNDisplayNamePart  +C
                    }
                    else
                    {
                        fm.IDNDisplayName += "P";  // "P"**************** KBIS  +4019 + underlying.IDNDisplayNamePart    +P
                    }

                    fm.BCAST_REF    = underlying.UnderlyingRIC;
                    fm.QACommonName = " ";
                    fm.MatDate      = matDate.ToString("dd-MMM-yy");
                    fm.StrikePrice  = "";
                    fm.IssueDate    = issueDate.ToString("dd-MMM-yy");
                    fm.Issuer       = fm.Issuer.ToUpper();
                    string koreanWarrantName = fm.KoreaWarrantName;
                    fm.KoreaWarrantName  = string.Empty;
                    fm.KoreaWarrantName += issuer.KoreaIssuerName;
                    fm.KoreaWarrantName += fm.Ticker.Substring(2, 4);
                    fm.KoreaWarrantName += underlying.KoreaNameDrop;
                    fm.KoreaWarrantName += koreanWarrantName;

                    if (fm.BCAST_REF.Trim() == ".KS200")
                    {
                        fm.Chain = "0#WARRANTS.KS, 0#ELW.KS, 0#.KS200W.KS";
                    }
                    else
                    {
                        fm.Chain = "0#WARRANTS.KS, 0#ELW.KS, 0#CELW.KS,0#" + fm.BCAST_REF.Substring(0, 6) + "W.KS";
                    }

                    fm.LastTradingDate = "";
                    fm.KnockOutPrice   = "";
                }
            }
            catch (Exception ex)
            {
                string msg = string.Format("error happened when format result entity :{0}", ex.Message);
                Logger.Log(msg, Logger.LogType.Error);
            }
        }