Skip to content

Commit bdad9f5

Browse files
authored
Add symbol change API endpoint. (#41)
Fixes #38
1 parent a67585f commit bdad9f5

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

FinancialModelingPrepApi/Abstractions/CompanyValuation/ICompanyValuationProvider.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ namespace MatthiWare.FinancialModelingPrep.Abstractions.CompanyValuation
77
{
88
public interface ICompanyValuationProvider
99
{
10+
/// <summary>
11+
/// Public comapnies sometimes change their symbol and thanks to this endpoint you will be able to know if there is any symbol change happened.
12+
/// Data for new symbol is getting transferred from the old symbol the same day
13+
/// </summary>
14+
/// <returns></returns>
15+
public Task<ApiResponse<List<SymbolChangeResponse>>> GetSymbolChangesAsync();
16+
1017
public Task<ApiResponse<QuoteResponse>> GetQuoteAsync(string symbol);
1118
public Task<ApiResponse<List<QuoteResponse>>> GetQuotesAsync(IEnumerable<string> symbols);
1219
public Task<ApiResponse<List<QuoteResponse>>> GetQuotesAsync(Exchange exchange);

FinancialModelingPrepApi/Core/CompanyValuation/CompanyValuationProvider.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,5 +552,19 @@ public Task<ApiResponse<List<PressReleasesResponse>>> GetPressReleasesAsync(stri
552552

553553
return client.GetJsonAsync<List<PressReleasesResponse>>(url, pathParams, queryString);
554554
}
555+
556+
/// <inheritdoc />
557+
public Task<ApiResponse<List<SymbolChangeResponse>>> GetSymbolChangesAsync()
558+
{
559+
const string url = "[version]/symbol_change";
560+
561+
var pathParams = new NameValueCollection()
562+
{
563+
{ "version", ApiVersion.v4.ToString() }
564+
};
565+
566+
return client.GetJsonAsync<List<SymbolChangeResponse>>(url, pathParams, null);
567+
568+
}
555569
}
556570
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace MatthiWare.FinancialModelingPrep.Model.CompanyValuation
4+
{
5+
public class SymbolChangeResponse
6+
{
7+
[JsonPropertyName("date")]
8+
public string Date { get; set; }
9+
10+
[JsonPropertyName("name")]
11+
public string Name { get; set; }
12+
13+
[JsonPropertyName("oldSymbol")]
14+
public string OldSymbol { get; set; }
15+
16+
[JsonPropertyName("newSymbol")]
17+
public string NewSymbol { get; set; }
18+
}
19+
}

Tests/CompanyValuation/CompanyValuationTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ public CompanyValuationTests(ITestOutputHelper testOutput) : base(testOutput)
2121
api = ServiceProvider.GetRequiredService<ICompanyValuationProvider>();
2222
}
2323

24+
25+
[Fact]
26+
public async Task GetSymbolChangesAsyncTests()
27+
{
28+
var result = await api.GetSymbolChangesAsync();
29+
30+
result.AssertNoErrors();
31+
Assert.NotEmpty(result.Data);
32+
}
33+
2434
[Theory]
2535
[InlineData("AAPL")]
2636
[InlineData("SPY")]

0 commit comments

Comments
 (0)