Exemple #1
0
        public async Task <ActionResult> GetFinboxObject(string symbol, string function)
        {
            string       getUrl = symbol + "/" + function;
            string       client = _configuration["API:Finbox:Client"];
            FinboxObject finbox = Helpers.SelectEnum(function, new FinboxObject());

            switch (finbox)
            {
            case FinboxObject.dividend:
                return(Ok(await Helpers.GetJson <DividendPerShare>(getUrl, client, _httpClientFactory)));

            case FinboxObject.ev_to_ebitda_ltm:
                return(Ok(await Helpers.GetJson <EnterpriseMultiple>(getUrl, client, _httpClientFactory)));

            case FinboxObject.fcf_yield_ltm:
                return(Ok(await Helpers.GetJson <List <Dividends> > (getUrl, client, _httpClientFactory)));

            case FinboxObject.price_to_sales_ltm:
                return(Ok(await Helpers.GetJson <PriceToSales>(getUrl, client, _httpClientFactory)));

            case FinboxObject.roe:
                return(Ok(await Helpers.GetJson <ReturnOnEquity>(getUrl, client, _httpClientFactory)));

            default:
                return(new BadRequestObjectResult("Finbox data for " + function + " NOT FOUND"));
            }
        }
Exemple #2
0
        public static FinboxObject SelectEnum(string s, FinboxObject fbx)
        {
            s = CleanString(s, "-");
            if (Enum.TryParse(s, out fbx))
            {
                if (Enum.IsDefined(typeof(FinboxObject), fbx))
                {
                    return(fbx);
                }
            }

            return(fbx);
        }