Beispiel #1
0
        private static void ParseCorp(Element fieldData, string security)
        {
            Corp corp;

            try
            {
                string maturity   = fieldData.GetElementAsString("MATURITY");
                string name       = fieldData.GetElementAsString("NAME");
                string country    = fieldData.GetElementAsString("COUNTRY_ISO");
                double px_last    = fieldData.GetElementAsFloat64("PX_LAST");
                string currency   = fieldData.GetElementAsString("DDIS_CURRENCY");
                bool   is_covered = fieldData.GetElementAsBool("IS_COVERED");
                int    id_Mcorp   = fieldData.GetElementAsInt32("ID_BB_ULTIMATE_PARENT_CO");
                string name_Mcorp = fieldData.GetElementAsString("ID_BB_ULTIMATE_PARENT_CO_NAME");
                double duration   = fieldData.GetElementAsFloat64("YAS_MOD_DUR");

                string date_cpn       = fieldData.GetElementAsString("NXT_CPN_DT");
                int    nb_day_nxt_cpn = fieldData.GetElementAsInt32("DAYS_TO_NEXT_COUPON");
                double cpn            = fieldData.GetElementAsFloat64("CPN");
                int    cpn_freq       = fieldData.GetElementAsInt32("CPN_FREQ");

                // rating
                int rating = Rating.GetQuality(fieldData);

                corp = new Corp(security, d_title[security].Item1, country, currency, name, px_last, id_Mcorp, name_Mcorp, rating, d_title[security].Item2, date_cpn, maturity, duration, cpn, cpn_freq, nb_day_nxt_cpn, is_covered);
            }

            catch (NotFoundException e)
            {
                corp = new Corp(security, d_title[security].Item1, d_title[security].Item2, e.Description());
            }

            //curve.GetValue(date_cpn);

            l_title.Add(corp);
        }
Beispiel #2
0
        private static void ParseCorp(Element fieldData, string security)
        {
            Corp corp;
            try
            {
                string maturity = fieldData.GetElementAsString("MATURITY");
                string name = fieldData.GetElementAsString("NAME");
                string country = fieldData.GetElementAsString("COUNTRY_ISO");
                double px_last = fieldData.GetElementAsFloat64("PX_LAST");
                string currency = fieldData.GetElementAsString("DDIS_CURRENCY");
                bool is_covered = fieldData.GetElementAsBool("IS_COVERED");
                int id_Mcorp = fieldData.GetElementAsInt32("ID_BB_ULTIMATE_PARENT_CO");
                string name_Mcorp = fieldData.GetElementAsString("ID_BB_ULTIMATE_PARENT_CO_NAME");
                double duration = fieldData.GetElementAsFloat64("YAS_MOD_DUR");

                string date_cpn = fieldData.GetElementAsString("NXT_CPN_DT");
                int nb_day_nxt_cpn = fieldData.GetElementAsInt32("DAYS_TO_NEXT_COUPON");
                double cpn = fieldData.GetElementAsFloat64("CPN");
                int cpn_freq = fieldData.GetElementAsInt32("CPN_FREQ");

                // rating
                int rating = Rating.GetQuality(fieldData);

                corp = new Corp(security, d_title[security].Item1, country, currency, name, px_last, id_Mcorp, name_Mcorp, rating, d_title[security].Item2, date_cpn, maturity, duration, cpn, cpn_freq, nb_day_nxt_cpn, is_covered);
            }

            catch (NotFoundException e)
            {
                corp = new Corp(security, d_title[security].Item1, d_title[security].Item2,e.Description() );
            }

            //curve.GetValue(date_cpn);

            l_title.Add(corp);
        }
Beispiel #3
0
        /// <summary>
        /// Filtre la reponse pour les stocker dans des objets de types TITLE
        /// </summary>
        /// <param name="eventObj"></param>
        private static void handleResponseEvent(Event eventObj)
        {
            string marketSector;
            foreach (Message message in eventObj.GetMessages())
            {
                Element ReferenceDataResponse = message.AsElement;
                if (ReferenceDataResponse.HasElement("responseError"))
                {
                    //throw new Exception("responseError " + ReferenceDataResponse.ToString());
                    Console.WriteLine("Mode non connecté");
                    Remplissage_Non_connection();
                }

                Element securityDataArray = ReferenceDataResponse.GetElement("securityData");
                //Console.WriteLine(message.ToString());

                int numItems = securityDataArray.NumValues;
                for (int i = 0; i < numItems; ++i)
                {
                    Element securityData = securityDataArray.GetValueAsElement(i);
                    string security = securityData.GetElementAsString("security");
                    if(!isGetCurve)
                        security = security.Replace("/isin/", "");

                    //int sequenceNumber = securityData.GetElementAsInt32("sequenceNumber");
                    if (securityData.HasElement("securityError"))
                    {
                        Element securityError = securityData.GetElement("securityError");
                        Corp corp = new Corp(security,"Unknow", d_title[security].Item1, d_title[security].Item2, "securtity error : invalid isin");
                        l_err.Add(corp);
                    }

                    else
                    {
                        Element fieldData = securityData.GetElement("fieldData");

                        if (isGetCurve)
                        {
                            curve.ParseEquity(fieldData);
                        }

                        else if (isGetChange)
                        {
                            ParseChange(fieldData, security);
                        }

                        else
                        {
                            marketSector = fieldData.GetElementAsString("MARKET_SECTOR_DES");

                            switch (marketSector)
                            {
                                case "Equity":
                                    ParseEquity(fieldData, security);
                                    break;

                                case "Corp":
                                    ParseCorp(fieldData, security);
                                    break;

                                case "Govt":
                                    ParseGovt(fieldData, security);
                                    break;

                                case "Index":
                                    ParseEquity(fieldData, security);
                                    break;

                                /*case "Curncy":
                                    ParseEquity(fieldData, security);
                                    break;

                                case "Mmkt":
                                    ParseEquity(fieldData, security);
                                    break;

                                case "Mtge":
                                    ParseEquity(fieldData, security);
                                    break;

                                case "Muni":
                                    ParseEquity(fieldData, security);
                                    break;*/

                                default:
                                    throw new FormatException("market sector invalid: " + marketSector);
                            }
                        }
                    }
                }
            }
        }