Ejemplo n.º 1
0
        public static List <Security> Load(string file)
        {
            var securities = new List <Security>();

            using (var streamReader = new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)))
            {
                string line;
                while ((line = streamReader.ReadLine()) != null)
                {
                    var x = new SecurityDefinition();
                    x.Decode(Encoding.UTF8.GetBytes(line));
                    securities.Add(x.ToSecurity());
                }
            }

            return(securities);
        }
Ejemplo n.º 2
0
        public static Security Load(string file, string contract)
        {
            using (var streamReader = new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)))
            {
                string line;
                while ((line = streamReader.ReadLine()) != null)
                {
                    var x = new SecurityDefinition();
                    x.Decode(Encoding.UTF8.GetBytes(line));
                    var sec = x.ToSecurity();
                    if (sec.Contract == contract)
                    {
                        return(sec);
                    }
                }
            }

            return(null);
        }