示例#1
0
        private void TryAddToCache(IEnumerable <Security> securities)
        {
            if (securities == null)
            {
                throw new ArgumentNullException(nameof(securities));
            }

            var newSecurities = new List <Security>();

            foreach (var security in securities)
            {
                var nativeId = security.ExtensionInfo == null ? default(TNativeId) : CreateNativeId(security);

                if (nativeId == null)
                {
                    return;
                }

                bool isNew;
                _cacheByNativeId.SafeAdd(nativeId, key => security, out isNew);

                if (isNew)
                {
                    newSecurities.Add(security);
                }
            }

            Added.SafeInvoke(newSecurities);
        }
        private void AddCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var element = new CompositionDiagramElement
            {
                Name = "New strategy"
            };

            Added.SafeInvoke(this, element);
        }
        private void AddSecurity(Security security)
        {
            lock (_sync)
            {
                AddSuffix(security.Id, security);
                AddSuffix(security.Code, security);
                AddSuffix(security.Name, security);
                AddSuffix(security.ShortName, security);
                AddSuffix(security.ExternalId.Bloomberg, security);
                AddSuffix(security.ExternalId.Cusip, security);
                AddSuffix(security.ExternalId.Isin, security);
                AddSuffix(security.ExternalId.Ric, security);
                AddSuffix(security.ExternalId.Sedol, security);

                _allSecurities.Add(security);
            }

            //if (ExcludeFilter != null && ExcludeFilter(security))
            //	ExcludedCount++;

            Added.SafeInvoke(security);
        }
        private void TryAddToCache(Security security)
        {
            if (security == null)
            {
                throw new ArgumentNullException("security");
            }

            var nativeId = security.ExtensionInfo == null ? default(TNativeId) : CreateNativeId(security);

            if (nativeId == null)
            {
                return;
            }

            bool isNew;

            _cacheByNativeId.SafeAdd(nativeId, key => security, out isNew);

            if (isNew)
            {
                Added.SafeInvoke(security);
            }
        }
 private void AddSecurities(IEnumerable <Security> securities)
 {
     securities.ForEach(_trie.Add);
     Added.SafeInvoke(securities);
 }
 private void AddSecurity(Security security)
 {
     _trie.Add(security);
     Added.SafeInvoke(security);
 }