/// <summary> /// Get pricing and security info for a single ticker. /// </summary> /// <param name="ticker"></param> /// <returns></returns> public Security GetSecurityInfo(string ticker) { if (!string.IsNullOrEmpty(ticker)) { using (var yahooAPI = new YahooAPIService()) { var result = yahooAPI.GetSingleSecurity(ticker, _securityDatabaseList); TryDatabaseInsert(result); return(result); } } return(new Stock("", "", "", 0, 0.00)); //If you hit this, the ticker was null or empty }
/// <summary> /// Get pricing and security info for a single ticker. /// </summary> /// <param name="ticker"></param> /// <returns></returns> public async Task GetSecurityInfo(string ticker, bool isScreener, bool isPreview) { if (!string.IsNullOrEmpty(ticker)) { using (var yahooAPI = new YahooAPIService()) { var result = await yahooAPI.GetSingleSecurity(ticker, _securityDatabaseList); if (!_localMode) { TryDatabaseInsert(result); } var responseMessage = new StockDataResponseMessage(result, isPreview, isScreener); Messenger.Default.Send <StockDataResponseMessage>(responseMessage); } } }