Skip to content

Commit b086a55

Browse files
committed
Add financial statements
1 parent 48aae63 commit b086a55

File tree

6 files changed

+453
-6
lines changed

6 files changed

+453
-6
lines changed

FinancialModelingPrepApi/Abstractions/CompanyValuation/ICompanyValuation.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ public interface ICompanyValuation
1414
public Task<ApiResponse<List<SymbolResponse>>> GetETFListAsync();
1515

1616
public Task<ApiResponse<List<EnterpriseValueResponse>>> GetEnterpriseValueAsync(string symbol, Period period = Period.Quarter, int limit = 40);
17+
18+
public Task<ApiResponse<List<BalanceSheetResponse>>> GetBalanceSheetStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40);
19+
public Task<ApiResponse<List<CashFlowResponse>>> GetCashFlowStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40);
20+
public Task<ApiResponse<List<IncomeStatementResponse>>> GetIncomeStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40);
1721
}
1822
}

FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuation.cs

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using FinancialModelingPrepApi.Abstractions;
2-
using FinancialModelingPrepApi.Abstractions.CompanyValuation;
1+
using FinancialModelingPrepApi.Abstractions.CompanyValuation;
32
using FinancialModelingPrepApi.Core.Http;
43
using FinancialModelingPrepApi.Model;
54
using FinancialModelingPrepApi.Model.CompanyValuation;
@@ -89,12 +88,78 @@ public Task<ApiResponse<List<EnterpriseValueResponse>>> GetEnterpriseValueAsync(
8988

9089
queryString.Add("limit", limit);
9190

92-
if (period != Period.Quarter)
91+
if (period == Period.Quarter)
9392
{
9493
queryString.Add("period", period.ToString().ToLower());
9594
}
9695

9796
return client.GetAsync<List<EnterpriseValueResponse>>(url, pathParams, queryString);
9897
}
98+
99+
public Task<ApiResponse<List<BalanceSheetResponse>>> GetBalanceSheetStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40)
100+
{
101+
const string url = "[version]/balance-sheet-statement/[symbol]";
102+
103+
var pathParams = new NameValueCollection()
104+
{
105+
{ "version", ApiVersion.v3.ToString() },
106+
{ "symbol", symbol }
107+
};
108+
109+
var queryString = new QueryStringBuilder();
110+
111+
queryString.Add("limit", limit);
112+
113+
if (period == Period.Quarter)
114+
{
115+
queryString.Add("period", period.ToString().ToLower());
116+
}
117+
118+
return client.GetAsync<List<BalanceSheetResponse>>(url, pathParams, queryString);
119+
}
120+
121+
public Task<ApiResponse<List<CashFlowResponse>>> GetCashFlowStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40)
122+
{
123+
const string url = "[version]/cash-flow-statement/[symbol]";
124+
125+
var pathParams = new NameValueCollection()
126+
{
127+
{ "version", ApiVersion.v3.ToString() },
128+
{ "symbol", symbol }
129+
};
130+
131+
var queryString = new QueryStringBuilder();
132+
133+
queryString.Add("limit", limit);
134+
135+
if (period == Period.Quarter)
136+
{
137+
queryString.Add("period", period.ToString().ToLower());
138+
}
139+
140+
return client.GetAsync<List<CashFlowResponse>>(url, pathParams, queryString);
141+
}
142+
143+
public Task<ApiResponse<List<IncomeStatementResponse>>> GetIncomeStatementAsync(string symbol, Period period = Period.Quarter, int limit = 40)
144+
{
145+
const string url = "[version]/income-statement/[symbol]";
146+
147+
var pathParams = new NameValueCollection()
148+
{
149+
{ "version", ApiVersion.v3.ToString() },
150+
{ "symbol", symbol }
151+
};
152+
153+
var queryString = new QueryStringBuilder();
154+
155+
queryString.Add("limit", limit);
156+
157+
if (period == Period.Quarter)
158+
{
159+
queryString.Add("period", period.ToString().ToLower());
160+
}
161+
162+
return client.GetAsync<List<IncomeStatementResponse>>(url, pathParams, queryString);
163+
}
99164
}
100165
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace FinancialModelingPrepApi.Model.CompanyValuation
4+
{
5+
public class BalanceSheetResponse
6+
{
7+
[JsonPropertyName("date")]
8+
public string Date { get; set; }
9+
10+
[JsonPropertyName("symbol")]
11+
public string Symbol { get; set; }
12+
13+
[JsonPropertyName("reportedCurrency")]
14+
public string ReportedCurrency { get; set; }
15+
16+
[JsonPropertyName("fillingDate")]
17+
public string FillingDate { get; set; }
18+
19+
[JsonPropertyName("acceptedDate")]
20+
public string AcceptedDate { get; set; }
21+
22+
[JsonPropertyName("period")]
23+
public string Period { get; set; }
24+
25+
[JsonPropertyName("cashAndCashEquivalents")]
26+
public long CashAndCashEquivalents { get; set; }
27+
28+
[JsonPropertyName("shortTermInvestments")]
29+
public long ShortTermInvestments { get; set; }
30+
31+
[JsonPropertyName("cashAndShortTermInvestments")]
32+
public long CashAndShortTermInvestments { get; set; }
33+
34+
[JsonPropertyName("netReceivables")]
35+
public long NetReceivables { get; set; }
36+
37+
[JsonPropertyName("inventory")]
38+
public long Inventory { get; set; }
39+
40+
[JsonPropertyName("otherCurrentAssets")]
41+
public long OtherCurrentAssets { get; set; }
42+
43+
[JsonPropertyName("totalCurrentAssets")]
44+
public long TotalCurrentAssets { get; set; }
45+
46+
[JsonPropertyName("propertyPlantEquipmentNet")]
47+
public long PropertyPlantEquipmentNet { get; set; }
48+
49+
[JsonPropertyName("goodwill")]
50+
public double Goodwill { get; set; }
51+
52+
[JsonPropertyName("intangibleAssets")]
53+
public double IntangibleAssets { get; set; }
54+
55+
[JsonPropertyName("goodwillAndIntangibleAssets")]
56+
public double GoodwillAndIntangibleAssets { get; set; }
57+
58+
[JsonPropertyName("longTermInvestments")]
59+
public double LongTermInvestments { get; set; }
60+
61+
[JsonPropertyName("taxAssets")]
62+
public double TaxAssets { get; set; }
63+
64+
[JsonPropertyName("otherNonCurrentAssets")]
65+
public long OtherNonCurrentAssets { get; set; }
66+
67+
[JsonPropertyName("totalNonCurrentAssets")]
68+
public long TotalNonCurrentAssets { get; set; }
69+
70+
[JsonPropertyName("otherAssets")]
71+
public double OtherAssets { get; set; }
72+
73+
[JsonPropertyName("totalAssets")]
74+
public long TotalAssets { get; set; }
75+
76+
[JsonPropertyName("accountPayables")]
77+
public long AccountPayables { get; set; }
78+
79+
[JsonPropertyName("shortTermDebt")]
80+
public double ShortTermDebt { get; set; }
81+
82+
[JsonPropertyName("taxPayables")]
83+
public double TaxPayables { get; set; }
84+
85+
[JsonPropertyName("deferredRevenue")]
86+
public double DeferredRevenue { get; set; }
87+
88+
[JsonPropertyName("otherCurrentLiabilities")]
89+
public double OtherCurrentLiabilities { get; set; }
90+
91+
[JsonPropertyName("totalCurrentLiabilities")]
92+
public long TotalCurrentLiabilities { get; set; }
93+
94+
[JsonPropertyName("longTermDebt")]
95+
public long LongTermDebt { get; set; }
96+
97+
[JsonPropertyName("deferredRevenueNonCurrent")]
98+
public double DeferredRevenueNonCurrent { get; set; }
99+
100+
[JsonPropertyName("deferredTaxLiabilitiesNonCurrent")]
101+
public double DeferredTaxLiabilitiesNonCurrent { get; set; }
102+
103+
[JsonPropertyName("otherNonCurrentLiabilities")]
104+
public long OtherNonCurrentLiabilities { get; set; }
105+
106+
[JsonPropertyName("totalNonCurrentLiabilities")]
107+
public long TotalNonCurrentLiabilities { get; set; }
108+
109+
[JsonPropertyName("otherLiabilities")]
110+
public double OtherLiabilities { get; set; }
111+
112+
[JsonPropertyName("totalLiabilities")]
113+
public long TotalLiabilities { get; set; }
114+
115+
[JsonPropertyName("commonStock")]
116+
public long CommonStock { get; set; }
117+
118+
[JsonPropertyName("retainedEarnings")]
119+
public long RetainedEarnings { get; set; }
120+
121+
[JsonPropertyName("accumulatedOtherComprehensiveIncomeLoss")]
122+
public long AccumulatedOtherComprehensiveIncomeLoss { get; set; }
123+
124+
[JsonPropertyName("othertotalStockholdersEquity")]
125+
public double OthertotalStockholdersEquity { get; set; }
126+
127+
[JsonPropertyName("totalStockholdersEquity")]
128+
public long TotalStockholdersEquity { get; set; }
129+
130+
[JsonPropertyName("totalLiabilitiesAndStockholdersEquity")]
131+
public long TotalLiabilitiesAndStockholdersEquity { get; set; }
132+
133+
[JsonPropertyName("totalInvestments")]
134+
public double TotalInvestments { get; set; }
135+
136+
[JsonPropertyName("totalDebt")]
137+
public long TotalDebt { get; set; }
138+
139+
[JsonPropertyName("netDebt")]
140+
public long NetDebt { get; set; }
141+
142+
[JsonPropertyName("link")]
143+
public string Link { get; set; }
144+
145+
[JsonPropertyName("finalLink")]
146+
public string FinalLink { get; set; }
147+
}
148+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace FinancialModelingPrepApi.Model.CompanyValuation
4+
{
5+
public class CashFlowResponse
6+
{
7+
[JsonPropertyName("date")]
8+
public string Date { get; set; }
9+
10+
[JsonPropertyName("symbol")]
11+
public string Symbol { get; set; }
12+
13+
[JsonPropertyName("reportedCurrency")]
14+
public string ReportedCurrency { get; set; }
15+
16+
[JsonPropertyName("fillingDate")]
17+
public string FillingDate { get; set; }
18+
19+
[JsonPropertyName("acceptedDate")]
20+
public string AcceptedDate { get; set; }
21+
22+
[JsonPropertyName("period")]
23+
public string Period { get; set; }
24+
25+
[JsonPropertyName("netIncome")]
26+
public long NetIncome { get; set; }
27+
28+
[JsonPropertyName("depreciationAndAmortization")]
29+
public long DepreciationAndAmortization { get; set; }
30+
31+
[JsonPropertyName("deferredIncomeTax")]
32+
public long DeferredIncomeTax { get; set; }
33+
34+
[JsonPropertyName("stockBasedCompensation")]
35+
public long StockBasedCompensation { get; set; }
36+
37+
[JsonPropertyName("changeInWorkingCapital")]
38+
public long ChangeInWorkingCapital { get; set; }
39+
40+
[JsonPropertyName("accountsReceivables")]
41+
public double AccountsReceivables { get; set; }
42+
43+
[JsonPropertyName("inventory")]
44+
public long Inventory { get; set; }
45+
46+
[JsonPropertyName("accountsPayables")]
47+
public long AccountsPayables { get; set; }
48+
49+
[JsonPropertyName("otherWorkingCapital")]
50+
public long OtherWorkingCapital { get; set; }
51+
52+
[JsonPropertyName("otherNonCashItems")]
53+
public long OtherNonCashItems { get; set; }
54+
55+
[JsonPropertyName("netCashProvidedByOperatingActivities")]
56+
public long NetCashProvidedByOperatingActivities { get; set; }
57+
58+
[JsonPropertyName("investmentsInPropertyPlantAndEquipment")]
59+
public long InvestmentsInPropertyPlantAndEquipment { get; set; }
60+
61+
[JsonPropertyName("acquisitionsNet")]
62+
public double AcquisitionsNet { get; set; }
63+
64+
[JsonPropertyName("purchasesOfInvestments")]
65+
public double PurchasesOfInvestments { get; set; }
66+
67+
[JsonPropertyName("salesMaturitiesOfInvestments")]
68+
public long SalesMaturitiesOfInvestments { get; set; }
69+
70+
[JsonPropertyName("otherInvestingActivites")]
71+
public double OtherInvestingActivites { get; set; }
72+
73+
[JsonPropertyName("netCashUsedForInvestingActivites")]
74+
public double NetCashUsedForInvestingActivites { get; set; }
75+
76+
[JsonPropertyName("debtRepayment")]
77+
public double DebtRepayment { get; set; }
78+
79+
[JsonPropertyName("commonStockIssued")]
80+
public double CommonStockIssued { get; set; }
81+
82+
[JsonPropertyName("commonStockRepurchased")]
83+
public long CommonStockRepurchased { get; set; }
84+
85+
[JsonPropertyName("dividendsPaid")]
86+
public double DividendsPaid { get; set; }
87+
88+
[JsonPropertyName("otherFinancingActivites")]
89+
public double OtherFinancingActivites { get; set; }
90+
91+
[JsonPropertyName("netCashUsedProvidedByFinancingActivities")]
92+
public long NetCashUsedProvidedByFinancingActivities { get; set; }
93+
94+
[JsonPropertyName("effectOfForexChangesOnCash")]
95+
public double EffectOfForexChangesOnCash { get; set; }
96+
97+
[JsonPropertyName("netChangeInCash")]
98+
public long NetChangeInCash { get; set; }
99+
100+
[JsonPropertyName("cashAtEndOfPeriod")]
101+
public long CashAtEndOfPeriod { get; set; }
102+
103+
[JsonPropertyName("cashAtBeginningOfPeriod")]
104+
public long CashAtBeginningOfPeriod { get; set; }
105+
106+
[JsonPropertyName("operatingCashFlow")]
107+
public long OperatingCashFlow { get; set; }
108+
109+
[JsonPropertyName("capitalExpenditure")]
110+
public long CapitalExpenditure { get; set; }
111+
112+
[JsonPropertyName("freeCashFlow")]
113+
public long FreeCashFlow { get; set; }
114+
115+
[JsonPropertyName("link")]
116+
public string Link { get; set; }
117+
118+
[JsonPropertyName("finalLink")]
119+
public string FinalLink { get; set; }
120+
}
121+
}

0 commit comments

Comments
 (0)