Ejemplo n.º 1
0
 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 FmgCompanyProfile RetrieveFmgCompanyProfile(string symbol)
        {
            string url      = FmgBaseUrl + FmgCompanyProfileUrl + symbol;
            string response = RetrieveFromUrl(url).Result;

            if (response == "{ }" || string.IsNullOrEmpty(response))
            {
                throw new ArgumentException("FmgCompanyProfile null. " + symbol);
            }
            FmgCompanyProfile result = ParseStringToFmgCompanyProfile(response);

            return(result);
        }