File tree Expand file tree Collapse file tree 4 files changed +86
-0
lines changed
Abstractions/CompanyValuation Expand file tree Collapse file tree 4 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 1
1
using FinancialModelingPrepApi . Model ;
2
2
using FinancialModelingPrepApi . Model . CompanyValuation ;
3
+ using System . Collections . Generic ;
3
4
using System . Threading . Tasks ;
4
5
5
6
namespace FinancialModelingPrepApi . Abstractions . CompanyValuation
6
7
{
7
8
public interface ICompanyValuation
8
9
{
9
10
public Task < ApiResponse < CompanyProfileResponse > > GetCompanyProfileAsync ( string symbol ) ;
11
+ public Task < ApiResponse < List < SymbolResponse > > > GetSymbolsListAsync ( ) ;
12
+ public Task < ApiResponse < List < SymbolResponse > > > GetTradableSymbolsListAsync ( ) ;
13
+ public Task < ApiResponse < List < SymbolResponse > > > GetETFListAsync ( ) ;
10
14
}
11
15
}
Original file line number Diff line number Diff line change @@ -38,5 +38,41 @@ public async Task<ApiResponse<CompanyProfileResponse>> GetCompanyProfileAsync(st
38
38
39
39
return ApiResponse . FromSucces ( result . Data . First ( ) ) ;
40
40
}
41
+
42
+ public Task < ApiResponse < List < SymbolResponse > > > GetETFListAsync ( )
43
+ {
44
+ const string url = "[version]/etf/list" ;
45
+
46
+ var pathParams = new NameValueCollection ( )
47
+ {
48
+ { "version" , ApiVersion . v3 . ToString ( ) }
49
+ } ;
50
+
51
+ return client . GetAsync < List < SymbolResponse > > ( url , pathParams , null ) ;
52
+ }
53
+
54
+ public Task < ApiResponse < List < SymbolResponse > > > GetSymbolsListAsync ( )
55
+ {
56
+ const string url = "[version]/stock/list" ;
57
+
58
+ var pathParams = new NameValueCollection ( )
59
+ {
60
+ { "version" , ApiVersion . v3 . ToString ( ) }
61
+ } ;
62
+
63
+ return client . GetAsync < List < SymbolResponse > > ( url , pathParams , null ) ;
64
+ }
65
+
66
+ public Task < ApiResponse < List < SymbolResponse > > > GetTradableSymbolsListAsync ( )
67
+ {
68
+ const string url = "[version]/available-traded/list" ;
69
+
70
+ var pathParams = new NameValueCollection ( )
71
+ {
72
+ { "version" , ApiVersion . v3 . ToString ( ) }
73
+ } ;
74
+
75
+ return client . GetAsync < List < SymbolResponse > > ( url , pathParams , null ) ;
76
+ }
41
77
}
42
78
}
Original file line number Diff line number Diff line change
1
+ namespace FinancialModelingPrepApi . Model . CompanyValuation
2
+ {
3
+ public class SymbolResponse
4
+ {
5
+ public string symbol { get ; set ; }
6
+ public string name { get ; set ; }
7
+ public double price { get ; set ; }
8
+ public string exchange { get ; set ; }
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -35,5 +35,41 @@ public async Task GetCompanyProfile_Unknown_Symbol_Returns_HasError_True()
35
35
Assert . NotNull ( result ) ;
36
36
Assert . True ( result . HasError ) ;
37
37
}
38
+
39
+ [ Fact ]
40
+ public async Task GetSymbolsList ( )
41
+ {
42
+ var api = ServiceProvider . GetRequiredService < IFinancialModelingPrepApiClient > ( ) ;
43
+
44
+ var result = await api . CompanyValuation . GetSymbolsListAsync ( ) ;
45
+
46
+ Assert . NotNull ( result ) ;
47
+ Assert . False ( result . HasError ) ;
48
+ Assert . NotEmpty ( result . Data ) ;
49
+ }
50
+
51
+ [ Fact ]
52
+ public async Task GetETFList ( )
53
+ {
54
+ var api = ServiceProvider . GetRequiredService < IFinancialModelingPrepApiClient > ( ) ;
55
+
56
+ var result = await api . CompanyValuation . GetETFListAsync ( ) ;
57
+
58
+ Assert . NotNull ( result ) ;
59
+ Assert . False ( result . HasError ) ;
60
+ Assert . NotEmpty ( result . Data ) ;
61
+ }
62
+
63
+ [ Fact ]
64
+ public async Task GetTradableSymbolsList ( )
65
+ {
66
+ var api = ServiceProvider . GetRequiredService < IFinancialModelingPrepApiClient > ( ) ;
67
+
68
+ var result = await api . CompanyValuation . GetTradableSymbolsListAsync ( ) ;
69
+
70
+ Assert . NotNull ( result ) ;
71
+ Assert . False ( result . HasError ) ;
72
+ Assert . NotEmpty ( result . Data ) ;
73
+ }
38
74
}
39
75
}
You can’t perform that action at this time.
0 commit comments