Exemple #1
0
        private void CreateCommonData()
        {
            var securityIds = Securities.GetSecurityIds().ToHashSet();

            var securities = new List <Security>();

            securities.AddRange(CreateSecurities("RI", securityIds));
            securities.AddRange(CreateSecurities("SR", securityIds));

            if (!securityIds.Contains("SBER@TQBR"))
            {
                securities.Add(new Security
                {
                    Id            = "SBER@TQBR",
                    Code          = "SBER",
                    Board         = ExchangeBoard.MicexTqbr,
                    Type          = SecurityTypes.Stock,
                    ExtensionInfo = new Dictionary <object, object>()
                });
            }

            if (securities.Count > 0)
            {
                securities.ForEach(s => Securities.Add(s));
                Securities.DelayAction.WaitFlush();
            }

            const string pfName = "Simulator";

            if (Portfolios.ReadById(pfName) == null)
            {
                Portfolios.Save(new Portfolio
                {
                    Name          = pfName,
                    BeginValue    = 1000000,
                    Board         = ExchangeBoard.Test,
                    ExtensionInfo = new Dictionary <object, object>()
                });
                Portfolios.DelayAction.WaitFlush();
            }
        }