示例#1
0
        //Is it a Fidelity Index Fund
        //They all start with capital F and have 5 characters
        private bool FoundFIndexFunds(PFFind.data data)
        {
            string          FIndexPattern = @"\bF\w*[A-Z]{4}\b";
            Regex           rgx           = new Regex(FIndexPattern);
            MatchCollection matches_title = rgx.Matches(data.title);
            MatchCollection matches_text  = rgx.Matches(data.selftext);

            //First match, check title
            if (matches_title.Count > 0)
            {
                foreach (Match m in matches_title)
                {
                    if (!Funds.Contains(m.Value.ToUpper()))
                    {
                        this.Funds.Add(m.Value.ToUpper());
                    }
                }
            }
            //Second match, check text
            if (matches_text.Count > 0)
            {
                foreach (Match m in matches_text)
                {
                    if (!Funds.Contains(m.Value.ToUpper()))
                    {
                        this.Funds.Add(m.Value.ToUpper());
                    }
                }
            }
            return(this.Funds.Count > 0 ? true : false);
        }
示例#2
0
 public static PFFind.data Four01k_2()
 {
     PFFind.data data = new PFFind.data()
     {
         id           = "unit_testid",
         title        = "This is a test to not find four01k",
         score        = 4000,
         url          = "https://test.com/",
         num_comments = 100,
         subreddit_id = "subreddit_id",
         selftext     = "this is where the real test is four01k, then there is this four oh 1 k"
     };
     return(data);
 }
示例#3
0
 //Index fund test case
 public static PFFind.data FIndexFund()
 {
     PFFind.data data = new PFFind.data()
     {
         id           = "unit_testid",
         title        = "This is a test to find fidelity index funds",
         score        = 4000,
         url          = "https://test.com/",
         num_comments = 100,
         subreddit_id = "subreddit_id",
         selftext     = "this is where the real test is FUSVX, then there is this FSEVX"
     };
     return(data);
 }
示例#4
0
 public static PFFind.data FIndexFund_2()
 {
     PFFind.data data = new PFFind.data()
     {
         id           = "unit_testid",
         title        = "This is a test to not find fidelity index funds",
         score        = 4000,
         url          = "https://test.com/",
         num_comments = 100,
         subreddit_id = "subreddit_id",
         selftext     = "this is where the real test is FUSV (this is incorrect), then there is this fsevx (this is correct length"
                        + " but not capitalized)" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
     };
     return(data);
 }
示例#5
0
        //Is it a Fidelity Index Fund
        //They all start with capital F and have 5 characters
        private bool Found401k(PFFind.data data)
        {
            //First match, check title
            if (data.title.Contains(four01k))
            {
                if (!Funds401k.Contains(data))
                {
                    this.Funds401k.Add(data);
                }
            }

            //Second match, check text
            if (data.selftext.Contains(four01k))
            {
                if (!Funds401k.Contains(data))
                {
                    this.Funds401k.Add(data);
                }
            }

            return(this.Funds401k.Count > 0 ? true : false);
        }
示例#6
0
 public Four01k(PFFind.data data)
 {
     this.Funds401k = new List <PFFind.data>();
     this.Found401k(data);
 }
示例#7
0
 public FIndexFunds(PFFind.data data)
 {
     this.Funds = new List <string>();
     this.FoundFIndexFunds(data);
 }