コード例 #1
0
        public static Security GetSecurity_cusip(string cusip, DateTime curr_dt)
        {
            List <Security> secList = SecurityMaster.Get_secList_cusip(cusip);

            if (secList.Count < 1)
            {
                return(null);
            }
            if (secList.Count == 1)
            {
                return(secList[0]);                   //if only one, return it
            }
            foreach (Security sec in secList)
            {
                if (curr_dt < sec.EffectiveDate.Value)
                {
                    continue;
                }
                else
                {
                    return(sec);
                }
            }

            return(secList[0]);//if no match based on time, give first one
        }
コード例 #2
0
        public static List <Security> Get_secList_cusip(string cusip)
        {
            SecurityMaster.Init_from_DB();
            if (string.IsNullOrEmpty(cusip))
            {
                return(new List <Security>());
            }

            if (SecurityMaster.secList_dic.ContainsKey(cusip))
            {
                return(secList_dic[cusip]);
            }
            else
            {
                return(new List <Security>());
            }
        }
コード例 #3
0
        public Attribute_Input_form(string secName, string cusip)
        {
            this.InitializeComponent();

            this.info_label.Text = "Please input Ticker for Security CUSIP: " + cusip;
            this.sec_label.Text  = "Security Name: " + secName;

            List <Security> sec_list = SecurityMaster.Get_secList_cusip(cusip);

            foreach (Security sec in sec_list)
            {
                this.values_comboBox.Items.Add(sec.TickerSymbol.Value);
            }
            if (this.values_comboBox.Items.Count > 0)
            {
                this.values_comboBox.SelectedIndex = 0;
            }
        }
コード例 #4
0
        /*---------------------------------------XBRL----------------------------------------------------*/
        /// <summary>
        /// Create new Security or Get existing Security from DB
        /// </summary>
        /// <param name="xbrl">XML</param>
        /// <param name="autoSaveNew_flag">If automatically save new security to DB</param>
        /// <returns></returns>
        public static Security XBRL_Create_or_Get_Security(XBRL_event_info xei, bool autoSaveNew_flag)
        {
            if (xei == null)
            {
                return(null);
            }

            Security existing_sec = SecurityMaster.GetSecurity_cusip(xei.CUSIP, xei.RecordDate_ADR);
            Security xbrl_sec     = SecurityMaster.CreateSecurity_fromXBRL(xei);

            if (existing_sec == null)
            {
                if (xbrl_sec == null)
                {
                    return(null);
                }
                else
                {
                    xbrl_sec.EffectiveDate.Value = Utility.MinDate;
                    if (autoSaveNew_flag)
                    {
                        if (xbrl_sec.Country.IsValueEmpty)
                        {
                            xbrl_sec.Country.Value = SecurityMaster.InputAttr_FromUI(xbrl_sec, "Country");
                        }
                        if (xbrl_sec.Country.IsValueEmpty)
                        {
                            return(null);
                        }
                        else
                        {
                            xbrl_sec.Insert_to_DB();
                        }
                    }
                    return(xbrl_sec);
                }
            }
            else
            {
                if (xbrl_sec == null)
                {
                    return(existing_sec);
                }
                else
                {
                    if (SecurityMaster.XBRL_isSameSecurity(existing_sec, xbrl_sec))
                    {
                        return(existing_sec);
                    }
                    else
                    {
                        xbrl_sec.EffectiveDate.Value = xei.RecordDate_ADR;
                        if (xbrl_sec.TickerSymbol.IsValueEmpty)
                        {
                            xbrl_sec.TickerSymbol.Value = existing_sec.TickerSymbol.Value;
                        }
                        if (xbrl_sec.ISIN.IsValueEmpty)
                        {
                            xbrl_sec.ISIN.Value = existing_sec.ISIN.Value;
                        }

                        if (autoSaveNew_flag)
                        {
                            string newSec_info      = "New: " + xbrl_sec.GetInfo_str();
                            string existingSec_info = "Old: " + existing_sec.GetInfo_str();

                            MessageBox.Show("New Security is created!!" + HssStr.WinNextLine + newSec_info + HssStr.WinNextLine + existingSec_info);
                            xbrl_sec.Insert_to_DB();
                        }

                        return(xbrl_sec);
                    }
                }
            }
        }