Skip to content

API returns empty array for invalid ticker symbols #142

Description

@scott-david-walker

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededquestionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions