Description
Calling client.CompanyValuation.GetIncomeStatementAsync("TEST.V", Period.Annual, 10);
is classed as an error when there is no data available. I find this behaviour odd as the request is successful and Financial Modelling Prep has returned the empty array.
The behaviour is clearly intentional as it is done with this code snippet:
if (response.Data.Equals(EmptyArrayResponse, StringComparison.OrdinalIgnoreCase) ||
response.Data.Equals(EmptyArrayResponse2, StringComparison.OrdinalIgnoreCase))
{
return ApiResponse.FromError<string>("Invalid parameters");
}
My question is whether this package should be classing this as an error as FinancialModellingPrep doesn't seem to? An empty array is a perfectly valid response if there is no data.
If you want this behaviour to remain, then what would be the best way to work around it? We can't check on the error string as "Invalid Parameters" is very generic and doesn't help us determine if the error is a FMP error or this specific handling of empty arrays.
Maybe we could have a variable when configuring the ApiClient? Something like "TreatEmptyArrayAsError"? If we set the default to true then we won't introduce breaking changes.
Interested to know your thoughts!
Cheers
Scott