コード例 #1
0
 public Security Get_security()
 {
     if (string.IsNullOrEmpty(this.CUSIP.Value))
     {
         return(null);
     }
     return(SecurityMaster.GetSecurity_cusip(this.CUSIP.Value, this.RecordDate_ADR.Value));
 }
コード例 #2
0
        /// <summary>
        /// Add some rows from list to DT
        /// </summary>
        /// <param name="limit">max number of rows to be added</param>
        /// <returns>how many rows added</returns>
        public int Add_XBRLrows_to_DT(int limit = UltraGrid_helper.RowsLoaded_per_scroll)
        {
            int count = 0;

            if (limit < 1)
            {
                limit = UltraGrid_helper.RowsLoaded_per_scroll;
            }

            while (this.currList_id < this.XBRL_list.Count)
            {
                XBRL_SavedFile sf  = this.XBRL_list[this.currList_id];
                DataRow        row = sourceDT.Rows.Add();
                row["id_SavedfilesRcvd"] = sf.id_SavedfilesRcvd;
                row["UniqueUniversalEventIdentifier"] = sf.UniqueUniversalEventIdentifier.Value;
                row["CUSIP"]          = sf.cusip.Value;
                row["DepositaryName"] = sf.DepositaryName.Value;
                //row["UnderlyingSecurityIssuerCountryofIncorporation"] = sf.UnderlyingSecurityIssuerCountryofIncorporation.Value;
                //row["CountryOfIssue"] = sf.CountryOfIssue.Value;
                row["AnnouncementType"] = sf.AnnouncementType.Value;
                if (!sf.AnnouncementDate.IsNull_flag)
                {
                    row["AnnouncementDate"] = sf.AnnouncementDate.Value;
                }
                row["EventCompleteness"] = sf.EventCompleteness.Value;
                row["originalFileName"]  = sf.originalFileName.Value;
                if (!sf.DividendIndex.IsNull_flag)
                {
                    row["DividendIndex"] = sf.DividendIndex.Value;
                }

                row["Createdby"] = sf.createdby.Value;
                if (!sf.createddate.IsNull_flag)
                {
                    row["CreatedDate"] = sf.createddate.Value;
                }
                row["processState"] = sf.processState.Value;
                row["Processedby"]  = sf.Processedby.Value;
                if (!sf.WhenProcessed.IsNull_flag)
                {
                    row["WhenProcessed"] = sf.WhenProcessed.Value;
                }

                List <Security> sec_list = SecurityMaster.Get_secList_cusip(sf.cusip.Value);
                if (sec_list.Count > 0)
                {
                    row["$Country$"] = sec_list[0].Country.Value;
                }

                ++this.currList_id;
                if (++count > limit)
                {
                    break;
                }
            }

            return(count);
        }
コード例 #3
0
ファイル: ResearchForm.cs プロジェクト: huangss0/GTS0
        private void XBRL_button_Click(object sender, EventArgs e)
        {
            int            id_savedFile = (int)this.XBRL_numericUpDown.Value;
            XBRL_SavedFile sf           = new XBRL_SavedFile(id_savedFile);

            sf.Init_from_DB(false);

            XBRL_event_info xei = new XBRL_event_info(sf.savedfile);
            Security        sec = SecurityMaster.XBRL_Create_or_Get_Security(xei, false);
            Dividend        dvd = new Dividend();

            dvd.Init_from_XBRL(xei, sec);
            dvd.PrintAllAttributeValues();
        }
コード例 #4
0
        /// <summary>
        /// LoadMarketData
        /// </summary>
        /// <param name="ticker"></param>
        /// <returns></returns>
        public bool LoadMarketData(Action <string> failureAction)
        {
            bool   methodFail = false;
            bool   fail       = false;
            string message;

            if (SecurityMaster == null)
            {
                SecurityMaster = new GlobalSecuritiesData(R.EstimatedTicks);
            }

            SecurityMaster.Clear();

            // iterate over each security and populate the individual ticks within the security master;
            // WARNING: individual failures will trigger the failure callback; and, return FALSE.
            foreach (var security in GlobalExecutionSettings.Instance.SecurityMaster)
            {
                var tmpMarketData = R.Convert(security, new YahooDataRetriever().Retrieve(security, out message, out fail));

                if (fail)
                {
                    if (failureAction == null)
                    {
                        throw new ArgumentException("failureAction should be registered");
                    }

                    failureAction(message);

                    methodFail = true;
                }
                else
                {
                    SecurityMaster.Add(security, tmpMarketData);
                }
            }

            return(methodFail);
        }
コード例 #5
0
        public static Dividend ApproveXBRL(int xbrl_id)
        {
            XBRL_SavedFile  xsf = Helper_XBRL_approval.ApproveXBRL0_get_xsFile(xbrl_id);
            XBRL_event_info xei = new XBRL_event_info(xsf.XBRLobj);

            Security sec = SecurityMaster.XBRL_Create_or_Get_Security(xei, true);

            if (sec == null)
            {
                MessageBox.Show("Helper_XBRL error 0: no Security info in either XBRL or Security Master");
                return(null);
            }

            Dividend existing_dvd = Helper_XBRL_approval.ApproveXBRL0_find_existingDividend(xei);

            if (xei.IsCancellation_flag)
            {
                return(Helper_XBRL_approval.ApproveXBRL1_cancellation_XBRL(existing_dvd, xsf));
            }

            Action next_step = XBRL_event_matrix.ApproveXBRL_action(xei, existing_dvd);

            Dividend approved_dvd = null;

            if (next_step == Action.Create_New_Event)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL2_CreateNewDividend(xei, sec);
                Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd);

                if (approved_dvd != null)
                {
                    if (existing_dvd == null)
                    {
                        MessageBox.Show("New Dividend " + approved_dvd.DividendIndex + " created");
                    }
                    else
                    {
                        MessageBox.Show("Another Dividend " + approved_dvd.DividendIndex + " created with existing Dividend " + existing_dvd.DividendIndex);
                    }
                }
            }
            else if (next_step == Action.Update_Existing_event)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL2_UpdateDividend(xei, existing_dvd, sec);
                Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd);

                if (approved_dvd != null)
                {
                    MessageBox.Show("Existing Dividend " + approved_dvd.DividendIndex + " is updated");
                }
            }
            else if (next_step == Action.Add_Ref_to_Current)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, existing_dvd);

                if (approved_dvd != null)
                {
                    MessageBox.Show("XBRL ref# is added to existing Dividend " + approved_dvd.DividendIndex);
                }
            }

            if (approved_dvd != null)//Mark [XBRL_SavedFile] as approved
            {
                xsf.processState.Value  = 1;
                xsf.DividendIndex.Value = approved_dvd.DividendIndex;
                xsf.Update_to_DB();/*Commented out for testing by Steven if needed*/
            }

            return(approved_dvd);
        }