public static Company GetCompanyBySymbol(string symbol) { try { FmgCompanyProfile fmgCompanyProfile = RetrieveJsonDataHelper.RetrieveFmgCompanyProfile(symbol); FmgInvestmentValuationRatios fmgInvestmentValuationRatios = RetrieveJsonDataHelper.RetrieveFmgInvestmentValuationRatios(symbol); Company company = new Company() { CompanyName = fmgCompanyProfile.CompanyName, Symbol = symbol, Exchange = fmgCompanyProfile.Exchange, MarketCapital = fmgCompanyProfile.MktCap, PriceToEarningRatio = fmgInvestmentValuationRatios.PriceEarningsRatio, PriceToSalesRatio = fmgInvestmentValuationRatios.PriceToSalesRatio, Industry = fmgCompanyProfile.Industry, Sector = fmgCompanyProfile.Sector, Description = fmgCompanyProfile.Description, //Website = fmgCompanyProfile.Website, CEO = fmgCompanyProfile.Ceo, Website = fmgCompanyProfile.Website, Logo = GetImageFromUrl(fmgCompanyProfile.Image) }; return(company); } catch (SystemException ex) { throw new SystemException(ex.Message); } }
public static FmgInvestmentValuationRatios RetrieveFmgInvestmentValuationRatios(string symbol) { string url = FmgBaseUrl + FmgInvestmentValuationRatiosUrl + symbol; string response = RetrieveFromUrl(url).Result; if (response == "{ }" || string.IsNullOrEmpty(response)) { throw new SystemException("FmgInvestmentValuationRatios null. " + symbol); } FmgInvestmentValuationRatios fmgInvRatioList = ParseStringToFmgInvestmentValuationRatios(response); return(fmgInvRatioList); }