-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i get P/E ratio of a stock? #96
Comments
Try using AAPL instead of APPL |
Still null |
class Program
} System.NullReferenceException |
@AlexRajvandary, you appear to be trying to access https://iexcloud.io/docs/api/#advanced-fundamentals, and endpoint that is only available with paid IEX Cloud plans. I think this could be your problem. Failing that, you could log out error messages to help identify the issue by modifying your existing code like so: static async void GetStock(string ticker, IEXCloudClient client)
{
IEXResponse<AdvancedFundamentalsResponse> iexResponse =
await client.StockFundamentals.AdvancedFundamentalsAsync(ticker);
if (iexResponse.ErrorMessage != null)
{
Console.WriteLine(iexResponse.ErrorMessage);
return;
}
Console.WriteLine(iexResponse.Data.symbol);
} |
Looks like there was a bug in our code, where AdvancedFundamentals returns an array and not a single value. var stock = await client.StockFundamentals.AdvancedFundamentalsAsync(ticker, IEXSharp.Model.Shared.Request.Period.Annual); Make sure you use the latest prerelease or wait for the next official NuGet. |
@vslee huh, not the angle I went for, but good catch on that, you're right. |
@JamiePrentice I liked where you were going with teaching people how to help us w/ error messages though. |
I tried this:
string ticker = "appl"// for example
IEXCloudClient client = new new IEXCloudClient(.....);
var stock = await client.StockFundamentals.AdvancedFundamentalsAsync(ticker);
why stock is null?
The text was updated successfully, but these errors were encountered: