Skip to content

Commit

Permalink
changed StockFundamentalsService.AdvancedFundamentals return type to …
Browse files Browse the repository at this point in the history
…array

- returns an array instead of single value
- fixes #96
  • Loading branch information
vslee committed Feb 4, 2021
1 parent 545d0da commit 4be2db2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface IStockFundamentalsService
/// <param name="symbol"></param>
/// <param name="period"></param>
/// <returns></returns>
Task<IEXResponse<AdvancedFundamentalsResponse>> AdvancedFundamentalsAsync(string symbol, Period period = Period.Quarter);
Task<IEXResponse<IEnumerable<AdvancedFundamentalsResponse>>> AdvancedFundamentalsAsync(string symbol, Period period = Period.Quarter);

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#balance-sheet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal StockFundamentalsService(ExecutorREST executor)
this.executor = executor;
}

public async Task<IEXResponse<AdvancedFundamentalsResponse>> AdvancedFundamentalsAsync(string symbol, Period period = Period.Quarter)
public async Task<IEXResponse<IEnumerable<AdvancedFundamentalsResponse>>> AdvancedFundamentalsAsync(string symbol, Period period = Period.Quarter)
{
const string urlPattern = "time-series/fundamentals/[symbol]/[period]";

Expand All @@ -30,7 +30,7 @@ public async Task<IEXResponse<AdvancedFundamentalsResponse>> AdvancedFundamental
{"period", period.GetDescriptionFromEnum()}
};

return await executor.ExecuteAsync<AdvancedFundamentalsResponse>(urlPattern, pathNvc, qsb);
return await executor.ExecuteAsync<IEnumerable<AdvancedFundamentalsResponse>>(urlPattern, pathNvc, qsb);
}

public async Task<IEXResponse<BalanceSheetResponse>> BalanceSheetAsync(string symbol, Period period = Period.Quarter,
Expand Down
8 changes: 6 additions & 2 deletions IEXSharpTest/Cloud/CoreData/StockFundamentalsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void Setup()
[Test]
[TestCase("BEDU", Period.Annual)]
[TestCase("BEDU", Period.Quarter)]
[TestCase("F", Period.Annual)]
[TestCase("CCM", Period.Quarter)]
[TestCase("AAPL", Period.Quarter)]
[TestCase("FB", Period.Quarter)]
Expand All @@ -34,8 +35,11 @@ public async Task AdvancedFundamentalsAsyncTest(string symbol, Period period = P
var response = await sandBoxClient.StockFundamentals.AdvancedFundamentalsAsync(symbol, period);

Assert.IsNull(response.ErrorMessage);
Assert.IsNotNull(response.Data);
Assert.IsNotNull(response.Data.accountsPayable);
foreach (var data in response.Data)
{
Assert.IsNotNull(data);
Assert.IsNotNull(data.accountsPayable);
}
}


Expand Down

0 comments on commit 4be2db2

Please sign in to comment.