Skip to content

Commit 9c523d3

Browse files
authored
Update readme with quickstart
1 parent def62d0 commit 9c523d3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
11
# FinancialModelingPrep.NET
22
C# API Client For Financial Modeling Prep API written in .NET 5
3+
4+
## Installation
5+
```powershell
6+
PM> Install-Package MatthiWare.FinancialModelingPrep
7+
```
8+
9+
# Quick Start
10+
11+
Register FinancialModelingPrepApiClient in Dependency Injection provider
12+
13+
``` csharp
14+
Services.AddFinancialModelingPrepApiClient(new FinancialModelingPrepOptions()
15+
{
16+
ApiKey = "API-KEY-HERE"
17+
});
18+
```
19+
20+
Resolve FMP API Client
21+
22+
``` csharp
23+
var apiClient = ServiceProvider.GetRequiredService<IFinancialModelingPrepApiClient>();
24+
25+
// do something with apiClient like getting the latest Apple Stock Quote
26+
var quoteResult = await api.CompanyValuation.GetQuoteAsync("AAPL");
27+
```
28+
29+
All API Responses are wrapped in an `ApiResponse<T>` object.
30+
31+
``` csharp
32+
var quoteResult = await api.CompanyValuation.GetQuoteAsync("AAPL");
33+
34+
// Display Apple Stock Quote
35+
if (!quoteResult.HasError)
36+
{
37+
Console.WriteLine($"$AAPL is currently trading at: {quoteResult.Data.Price}");
38+
}
39+
else
40+
{
41+
Console.WriteLine($"Error Message: {quoteResult.Error}");
42+
}
43+
```
44+

0 commit comments

Comments
 (0)