public SecurityRemoteExtendedStorage(RemoteExtendedStorage parent, SecurityId securityId) { _parent = parent ?? throw new ArgumentNullException(nameof(parent)); _securityId = securityId; _securityIdStr = securityId.ToStringId(); }
/// <summary> /// Read instrument by identifier. /// </summary> /// <param name="securities">Instrument storage collection.</param> /// <param name="securityId">Identifier.</param> /// <returns>Instrument.</returns> public static Security ReadBySecurityId(this IStorageEntityList <Security> securities, SecurityId securityId) { if (securities == null) { throw new ArgumentNullException(nameof(securities)); } if (securityId.IsDefault()) { throw new ArgumentNullException(nameof(securityId)); } return(securities.ReadById(securityId.ToStringId())); }
/// <summary> /// To get the path to the folder with market data for the instrument. /// </summary> /// <param name="securityId">Security ID.</param> /// <returns>The path to the folder with market data.</returns> public string GetSecurityPath(SecurityId securityId) { if (securityId.IsDefault()) { throw new ArgumentNullException("securityId"); } var id = securityId.ToStringId(); var folderName = id.SecurityIdToFolderName(); return(UseAlphabeticPath ? IOPath.Combine(Path, id.Substring(0, 1), folderName) : IOPath.Combine(Path, folderName)); }
/// <summary> /// Получить инструмент по идентификатору. /// </summary> /// <param name="securityId">Идентификатор инструмента.</param> /// <returns>Инструмент.</returns> protected Security GetSecurity(SecurityId securityId) { var security = EntityRegistry.Securities.ReadBySecurityId(securityId); if (security == null) { security = new Security { Id = securityId.ToStringId(), }; SaveSecurity(security); } return(security); }
private Security TryCreateSecurity(SecurityId securityId) { if (securityId.SecurityCode.IsEmpty() || securityId.BoardCode.IsEmpty()) { return(null); } var security = new Security { Id = securityId.ToStringId(), Code = securityId.SecurityCode, Board = _exchangeInfoProvider.GetOrCreateBoard(securityId.BoardCode), }; _securityStorage.Save(security, false); return(security); }
private Security TryCreateSecurity(SecurityId securityId) { if (securityId.SecurityCode.IsEmpty() || securityId.BoardCode.IsEmpty()) { return(null); } var security = new Security { Id = securityId.ToStringId(), Code = securityId.SecurityCode, Board = ExchangeBoard.GetOrCreateBoard(securityId.BoardCode), ExtensionInfo = new Dictionary <object, object>() }; _entityRegistry.Securities.Add(security); return(security); }
private Security InitSecurity(SecurityId securityId, IExchangeInfoProvider exchangeInfoProvider) { var id = securityId.ToStringId(); var security = _entityRegistry.Securities.ReadById(id); if (security != null) { return(security); } security = new Security { Id = id, Code = securityId.SecurityCode, Board = exchangeInfoProvider.GetOrCreateBoard(securityId.BoardCode), Type = securityId.SecurityType, }; _entityRegistry.Securities.Save(security); this.AddInfoLog(LocalizedStrings.Str2871Params.Put(id)); return(security); }
private Security InitSecurity(SecurityId securityId) { var id = securityId.ToStringId(); var security = _entityRegistry.Securities.ReadById(id); if (security != null) return security; security = new Security { Id = id, ExtensionInfo = new Dictionary<object, object>(), Code = securityId.SecurityCode, Board = ExchangeBoard.GetOrCreateBoard(securityId.SecurityCode), Type = securityId.SecurityType, }; _entityRegistry.Securities.Save(security); _logManager.Application.AddInfoLog(LocalizedStrings.Str2871Params.Put(id)); return security; }
/// <summary> /// To get the path to the folder with market data for the instrument. /// </summary> /// <param name="securityId">Security ID.</param> /// <returns>The path to the folder with market data.</returns> public string GetSecurityPath(SecurityId securityId) { if (securityId.IsDefault()) throw new ArgumentNullException(nameof(securityId)); var id = securityId.ToStringId(); var folderName = id.SecurityIdToFolderName(); return UseAlphabeticPath ? IOPath.Combine(Path, id.Substring(0, 1), folderName) : IOPath.Combine(Path, folderName); }