Exemple #1
0
 public static Security Parse(string msg)
 {
     string[] r = msg.Split(' ');
     Console.WriteLine(msg);
     Security sec = new Security();
     sec.Symbol = r[0];
     if (r.Length > 2)
     {
         int f2id = SecurityID(r[2]);
         int f1id = SecurityID(r[1]);
         if (f2id != -1)
         {
             sec.Type = (SecurityType)f2id;
             sec.DestEx = r[1];
         }
         else if (f1id != -1)
         {
             sec.Type = (SecurityType)f1id;
             sec.DestEx = r[2];
         }
     }
     else if (r.Length > 1)
     {
         int f1id = SecurityID(r[1]);
         if (f1id != -1) sec.Type = (SecurityType)f1id;
     }
     return sec;
 }
Exemple #2
0
        public void Parsing()
        {
            // tests to parse and generate user-supplied security specifiers
            Security nyse = new Security("LVS");
            string p = nyse.ToString();

            Security t = Security.Parse(p);
            Assert.That(t.Symbol == nyse.Symbol, t.Symbol);
            Assert.That(!t.hasDest, t.DestEx);
            Assert.That(t.Type == nyse.Type, t.Type.ToString());

            Security crude = Security.Parse("CLV8 GLOBEX FUT");
            Assert.That(crude.Symbol == "CLV8", crude.Symbol);
            Assert.That(crude.hasDest, crude.DestEx);
            Assert.That(crude.Type == SecurityType.FUT, crude.Type.ToString());

            
        }
Exemple #3
0
 public void Add(Security s) { if (s.isValid) stocks.Add((Stock)s); }
Exemple #4
0
 public void Add(Security item)
 {
     if (item.isValid) l.Add((Index)item);
     
 }