/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal override bool AddMember(DateTime utcTime, Security security) { // never add members to disposed universes if (DisposeRequested) { return(false); } if (Securities.ContainsKey(security.Symbol)) { return(false); } // method take into account the case, when the option has experienced an adjustment // we update member reference in this case if (Securities.Any(x => x.Value.Security == security)) { Member member; Securities.TryRemove(security.Symbol, out member); } var added = Securities.TryAdd(security.Symbol, new Member(utcTime, security)); if (added && _liveMode) { _addTimesBySymbol[security.Symbol] = utcTime; } return(added); }
/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal bool AddMember(DateTime utcTime, Security security) { if (Securities.ContainsKey(security.Symbol)) { return(false); } return(Securities.TryAdd(security.Symbol, new Member(utcTime, security))); }
/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal virtual bool AddMember(DateTime utcTime, Security security) { if (security.IsDelisted) { return(false); } return(Securities.TryAdd(security.Symbol, new Member(utcTime, security))); }
/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal virtual bool AddMember(DateTime utcTime, Security security) { // never add members to disposed universes if (DisposeRequested) { return(false); } if (security.IsDelisted) { return(false); } return(Securities.TryAdd(security.Symbol, new Member(utcTime, security))); }
/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal override bool AddMember(DateTime utcTime, Security security) { if (Securities.ContainsKey(security.Symbol)) { return(false); } // method take into account the case, when the option has experienced an adjustment // we update member reference in this case if (Securities.Any(x => x.Value.Security == security)) { Member member; Securities.TryRemove(security.Symbol, out member); } return(Securities.TryAdd(security.Symbol, new Member(utcTime, security))); }
/// <summary> /// Adds the specified security to this universe /// </summary> /// <param name="utcTime">The current utc date time</param> /// <param name="security">The security to be added</param> /// <returns>True if the security was successfully added, /// false if the security was already in the universe</returns> internal virtual bool AddMember(DateTime utcTime, Security security) { return(Securities.TryAdd(security.Symbol, new Member(utcTime, security))); }