.NET 7 API Client For https://financialmodelingprep.com/ API written in C#
PM> Install-Package MatthiWare.FinancialModelingPrep
You can find your API Key here https://site.financialmodelingprep.com/developer/docs/dashboard/
using MatthiWare.FinancialModelingPrep;
Services.AddFinancialModelingPrepApiClient(new FinancialModelingPrepOptions()
{
ApiKey = "API-KEY-HERE"
});
var api = ServiceProvider.GetRequiredService<IFinancialModelingPrepApiClient>();
// do something with api like getting the latest Apple Stock Quote
var quoteResult = await api.CompanyValuation.GetQuoteAsync("AAPL");
using MatthiWare.FinancialModelingPrep;
var api = FinancialModelingPrepApiClientFactory.CreateClient(new FinancialModelingPrepOptions());
// do something with api like getting the latest Apple Stock Quote
var quoteResult = await api.CompanyValuation.GetQuoteAsync("AAPL");
var response = await api.CompanyValuation.GetQuoteAsync("AAPL");
// Display Apple Stock Quote
Console.WriteLine($"$AAPL is currently trading at: {response.Data.Price}");
ApiResponse<T>
object.public class ApiResponse<T>
{
/// <summary>
/// Error message if any occured
/// </summary>
public string Error { get; }
/// <summary>
/// True if there was an error with the request otherwise false
/// </summary>
public bool HasError { get; }
/// <summary>
/// The FMP API response object <see cref="T"/>
/// </summary>
public T Data { get; }
}
Example:
var response = await api.CompanyValuation.GetQuoteAsync("AAPL");
// Display Apple Stock Quote
if (!quoteResult.HasError)
{
Console.WriteLine($"$AAPL is currently trading at: {response.Data.Price}");
}
else
{
Console.WriteLine($"Error occured, message: {response.Error}");
}
Create a PR where you add or improve an Endpoint