diff --git a/src/Helpers/DayGainersLosersHelper.cs b/src/Helpers/DayGainersLosersHelper.cs deleted file mode 100644 index 92b1b98..0000000 --- a/src/Helpers/DayGainersLosersHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace OoplesFinance.YahooFinanceAPI.Helpers; - -internal class DayGainersLosersHelper : YahooJsonBase -{ - /// - /// Parses the raw json data for the Day Gainers data - /// - /// - /// - /// - internal override IEnumerable ParseYahooJsonData(string jsonData) - { - var dayGainersLosers = JsonConvert.DeserializeObject(jsonData); - - return dayGainersLosers != null ? (IEnumerable)dayGainersLosers.Finance.Results : Enumerable.Empty(); - } -} diff --git a/src/Helpers/ScreenerHelper.cs b/src/Helpers/ScreenerHelper.cs new file mode 100644 index 0000000..3d45df6 --- /dev/null +++ b/src/Helpers/ScreenerHelper.cs @@ -0,0 +1,17 @@ +namespace OoplesFinance.YahooFinanceAPI.Helpers; + +internal class ScreenerHelper : YahooJsonBase +{ + /// + /// Parses the raw json data for the Screener data + /// + /// + /// + /// + internal override IEnumerable ParseYahooJsonData(string jsonData) + { + var screener = JsonConvert.DeserializeObject(jsonData); + + return screener != null ? (IEnumerable)screener.Finance.Results : Enumerable.Empty(); + } +} diff --git a/src/Models/DayGainersLosersData.cs b/src/Models/DayGainersLosersData.cs index 14c6485..d6291bb 100644 --- a/src/Models/DayGainersLosersData.cs +++ b/src/Models/DayGainersLosersData.cs @@ -1,132 +1,153 @@ namespace OoplesFinance.YahooFinanceAPI.Models; public record CriteriaMeta( - [property: JsonProperty("size")] int? Size, - [property: JsonProperty("offset")] int? Offset, - [property: JsonProperty("sortField")] string SortField, - [property: JsonProperty("sortType")] string SortType, - [property: JsonProperty("quoteType")] string QuoteType, - [property: JsonProperty("criteria")] IReadOnlyList Criteria, - [property: JsonProperty("topOperator")] string TopOperator + [property: JsonProperty("size", NullValueHandling = NullValueHandling.Ignore)] int? Size, + [property: JsonProperty("offset", NullValueHandling = NullValueHandling.Ignore)] int? Offset, + [property: JsonProperty("sortField", NullValueHandling = NullValueHandling.Ignore)] string SortField, + [property: JsonProperty("sortType", NullValueHandling = NullValueHandling.Ignore)] string SortType, + [property: JsonProperty("quoteType", NullValueHandling = NullValueHandling.Ignore)] string QuoteType, + [property: JsonProperty("criteria", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList Criteria, + [property: JsonProperty("topOperator", NullValueHandling = NullValueHandling.Ignore)] string TopOperator ); public record Criterion( - [property: JsonProperty("field")] string Field, - [property: JsonProperty("operators")] IReadOnlyList Operators, - [property: JsonProperty("values")] IReadOnlyList Values, - [property: JsonProperty("labelsSelected")] IReadOnlyList LabelsSelected, - [property: JsonProperty("dependentValues")] IReadOnlyList DependentValues + [property: JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)] string Field, + [property: JsonProperty("operators", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList Operators, + [property: JsonProperty("values", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList Values, + [property: JsonProperty("labelsSelected", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList LabelsSelected, + [property: JsonProperty("dependentValues", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList DependentValues ); -public record DayGainersLosersFinance( - [property: JsonProperty("result")] IReadOnlyList Results, - [property: JsonProperty("error")] object Error +public record ScreenerFinance( + [property: JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList Results, + [property: JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] object Error ); -public record DayGainersLosersQuote( - [property: JsonProperty("language")] string Language, - [property: JsonProperty("region")] string Region, - [property: JsonProperty("quoteType")] string QuoteType, - [property: JsonProperty("typeDisp")] string TypeDisp, - [property: JsonProperty("quoteSourceName")] string QuoteSourceName, - [property: JsonProperty("triggerable")] bool? Triggerable, - [property: JsonProperty("customPriceAlertConfidence")] string CustomPriceAlertConfidence, - [property: JsonProperty("forwardPE")] double? ForwardPE, - [property: JsonProperty("priceToBook")] double? PriceToBook, - [property: JsonProperty("sourceInterval")] int? SourceInterval, - [property: JsonProperty("exchangeDataDelayedBy")] int? ExchangeDataDelayedBy, - [property: JsonProperty("exchangeTimezoneName")] string ExchangeTimezoneName, - [property: JsonProperty("exchangeTimezoneShortName")] string ExchangeTimezoneShortName, - [property: JsonProperty("gmtOffSetMilliseconds")] int? GmtOffSetMilliseconds, - [property: JsonProperty("ipoExpectedDate")] string IpoExpectedDate, - [property: JsonProperty("esgPopulated")] bool? EsgPopulated, - [property: JsonProperty("tradeable")] bool? Tradeable, - [property: JsonProperty("cryptoTradeable")] bool? CryptoTradeable, - [property: JsonProperty("regularMarketChangePercent")] double? RegularMarketChangePercent, - [property: JsonProperty("currency")] string Currency, - [property: JsonProperty("fullExchangeName")] string FullExchangeName, - [property: JsonProperty("longName")] string LongName, - [property: JsonProperty("financialCurrency")] string FinancialCurrency, - [property: JsonProperty("regularMarketOpen")] double? RegularMarketOpen, - [property: JsonProperty("averageDailyVolume3Month")] int? AverageDailyVolume3Month, - [property: JsonProperty("averageDailyVolume10Day")] int? AverageDailyVolume10Day, - [property: JsonProperty("fiftyTwoWeekLowChange")] double? FiftyTwoWeekLowChange, - [property: JsonProperty("fiftyTwoWeekLowChangePercent")] double? FiftyTwoWeekLowChangePercent, - [property: JsonProperty("fiftyTwoWeekRange")] string FiftyTwoWeekRange, - [property: JsonProperty("fiftyTwoWeekHighChange")] double? FiftyTwoWeekHighChange, - [property: JsonProperty("fiftyTwoWeekHighChangePercent")] double? FiftyTwoWeekHighChangePercent, - [property: JsonProperty("earningsTimestamp")] int? EarningsTimestamp, - [property: JsonProperty("earningsTimestampStart")] int? EarningsTimestampStart, - [property: JsonProperty("earningsTimestampEnd")] int? EarningsTimestampEnd, - [property: JsonProperty("trailingAnnualDividendRate")] double? TrailingAnnualDividendRate, - [property: JsonProperty("trailingAnnualDividendYield")] double? TrailingAnnualDividendYield, - [property: JsonProperty("marketState")] string MarketState, - [property: JsonProperty("epsTrailingTwelveMonths")] double? EpsTrailingTwelveMonths, - [property: JsonProperty("epsForward")] double? EpsForward, - [property: JsonProperty("epsCurrentYear")] double? EpsCurrentYear, - [property: JsonProperty("priceEpsCurrentYear")] double? PriceEpsCurrentYear, - [property: JsonProperty("sharesOutstanding")] object SharesOutstanding, - [property: JsonProperty("bookValue")] double? BookValue, - [property: JsonProperty("fiftyDayAverage")] double? FiftyDayAverage, - [property: JsonProperty("fiftyDayAverageChange")] double? FiftyDayAverageChange, - [property: JsonProperty("fiftyDayAverageChangePercent")] double? FiftyDayAverageChangePercent, - [property: JsonProperty("twoHundredDayAverage")] double? TwoHundredDayAverage, - [property: JsonProperty("twoHundredDayAverageChange")] double? TwoHundredDayAverageChange, - [property: JsonProperty("twoHundredDayAverageChangePercent")] double? TwoHundredDayAverageChangePercent, - [property: JsonProperty("marketCap")] object MarketCap, - [property: JsonProperty("averageAnalystRating")] string AverageAnalystRating, - [property: JsonProperty("firstTradeDateMilliseconds")] object FirstTradeDateMilliseconds, - [property: JsonProperty("priceHint")] int? PriceHint, - [property: JsonProperty("postMarketChangePercent")] double? PostMarketChangePercent, - [property: JsonProperty("postMarketTime")] int? PostMarketTime, - [property: JsonProperty("postMarketPrice")] double? PostMarketPrice, - [property: JsonProperty("postMarketChange")] double? PostMarketChange, - [property: JsonProperty("regularMarketChange")] double? RegularMarketChange, - [property: JsonProperty("regularMarketTime")] int? RegularMarketTime, - [property: JsonProperty("regularMarketPrice")] double? RegularMarketPrice, - [property: JsonProperty("regularMarketDayHigh")] double? RegularMarketDayHigh, - [property: JsonProperty("regularMarketDayRange")] string RegularMarketDayRange, - [property: JsonProperty("regularMarketDayLow")] double? RegularMarketDayLow, - [property: JsonProperty("regularMarketVolume")] int? RegularMarketVolume, - [property: JsonProperty("regularMarketPreviousClose")] double? RegularMarketPreviousClose, - [property: JsonProperty("bid")] double? Bid, - [property: JsonProperty("ask")] double? Ask, - [property: JsonProperty("bidSize")] int? BidSize, - [property: JsonProperty("askSize")] int? AskSize, - [property: JsonProperty("market")] string Market, - [property: JsonProperty("messageBoardId")] string MessageBoardId, - [property: JsonProperty("exchange")] string Exchange, - [property: JsonProperty("fiftyTwoWeekLow")] double? FiftyTwoWeekLow, - [property: JsonProperty("fiftyTwoWeekHigh")] double? FiftyTwoWeekHigh, - [property: JsonProperty("shortName")] string ShortName, - [property: JsonProperty("displayName")] string DisplayName, - [property: JsonProperty("symbol")] string Symbol, - [property: JsonProperty("prevName")] string PrevName, - [property: JsonProperty("nameChangeDate")] string NameChangeDate, - [property: JsonProperty("dividendDate")] int? DividendDate, - [property: JsonProperty("trailingPE")] double? TrailingPE +public record ScreenerQuote( + [property: JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)] string Language, + [property: JsonProperty("region", NullValueHandling = NullValueHandling.Ignore)] string Region, + [property: JsonProperty("quoteType", NullValueHandling = NullValueHandling.Ignore)] string QuoteType, + [property: JsonProperty("typeDisp", NullValueHandling = NullValueHandling.Ignore)] string TypeDisp, + [property: JsonProperty("quoteSourceName", NullValueHandling = NullValueHandling.Ignore)] string QuoteSourceName, + [property: JsonProperty("triggerable", NullValueHandling = NullValueHandling.Ignore)] bool? Triggerable, + [property: JsonProperty("customPriceAlertConfidence", NullValueHandling = NullValueHandling.Ignore)] string CustomPriceAlertConfidence, + [property: JsonProperty("forwardPE", NullValueHandling = NullValueHandling.Ignore)] double? ForwardPE, + [property: JsonProperty("priceToBook", NullValueHandling = NullValueHandling.Ignore)] double? PriceToBook, + [property: JsonProperty("sourceInterval", NullValueHandling = NullValueHandling.Ignore)] int? SourceInterval, + [property: JsonProperty("exchangeDataDelayedBy", NullValueHandling = NullValueHandling.Ignore)] int? ExchangeDataDelayedBy, + [property: JsonProperty("exchangeTimezoneName", NullValueHandling = NullValueHandling.Ignore)] string ExchangeTimezoneName, + [property: JsonProperty("exchangeTimezoneShortName", NullValueHandling = NullValueHandling.Ignore)] string ExchangeTimezoneShortName, + [property: JsonProperty("gmtOffSetMilliseconds", NullValueHandling = NullValueHandling.Ignore)] int? GmtOffSetMilliseconds, + [property: JsonProperty("ipoExpectedDate", NullValueHandling = NullValueHandling.Ignore)] string? IpoExpectedDate, + [property: JsonProperty("esgPopulated", NullValueHandling = NullValueHandling.Ignore)] bool? EsgPopulated, + [property: JsonProperty("tradeable", NullValueHandling = NullValueHandling.Ignore)] bool? Tradeable, + [property: JsonProperty("cryptoTradeable", NullValueHandling = NullValueHandling.Ignore)] bool? CryptoTradeable, + [property: JsonProperty("regularMarketChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketChangePercent, + [property: JsonProperty("currency", NullValueHandling = NullValueHandling.Ignore)] string Currency, + [property: JsonProperty("fullExchangeName", NullValueHandling = NullValueHandling.Ignore)] string FullExchangeName, + [property: JsonProperty("longName", NullValueHandling = NullValueHandling.Ignore)] string LongName, + [property: JsonProperty("financialCurrency", NullValueHandling = NullValueHandling.Ignore)] string FinancialCurrency, + [property: JsonProperty("regularMarketOpen", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketOpen, + [property: JsonProperty("averageDailyVolume3Month", NullValueHandling = NullValueHandling.Ignore)] int? AverageDailyVolume3Month, + [property: JsonProperty("averageDailyVolume10Day", NullValueHandling = NullValueHandling.Ignore)] int? AverageDailyVolume10Day, + [property: JsonProperty("fiftyTwoWeekLowChange", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekLowChange, + [property: JsonProperty("fiftyTwoWeekLowChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekLowChangePercent, + [property: JsonProperty("fiftyTwoWeekRange", NullValueHandling = NullValueHandling.Ignore)] string FiftyTwoWeekRange, + [property: JsonProperty("fiftyTwoWeekHighChange", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekHighChange, + [property: JsonProperty("fiftyTwoWeekHighChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekHighChangePercent, + [property: JsonProperty("dividendDate", NullValueHandling = NullValueHandling.Ignore)] int? DividendDate, + [property: JsonProperty("earningsTimestamp", NullValueHandling = NullValueHandling.Ignore)] int? EarningsTimestamp, + [property: JsonProperty("earningsTimestampStart", NullValueHandling = NullValueHandling.Ignore)] int? EarningsTimestampStart, + [property: JsonProperty("earningsTimestampEnd", NullValueHandling = NullValueHandling.Ignore)] int? EarningsTimestampEnd, + [property: JsonProperty("trailingAnnualDividendRate", NullValueHandling = NullValueHandling.Ignore)] double? TrailingAnnualDividendRate, + [property: JsonProperty("trailingAnnualDividendYield", NullValueHandling = NullValueHandling.Ignore)] double? TrailingAnnualDividendYield, + [property: JsonProperty("trailingThreeMonthReturns", NullValueHandling = NullValueHandling.Ignore)] double? TrailingThreeMonthReturns, + [property: JsonProperty("trailingPE", NullValueHandling = NullValueHandling.Ignore)] double? TrailingPE, + [property: JsonProperty("marketState", NullValueHandling = NullValueHandling.Ignore)] string MarketState, + [property: JsonProperty("epsTrailingTwelveMonths", NullValueHandling = NullValueHandling.Ignore)] double? EpsTrailingTwelveMonths, + [property: JsonProperty("epsForward", NullValueHandling = NullValueHandling.Ignore)] double? EpsForward, + [property: JsonProperty("epsCurrentYear", NullValueHandling = NullValueHandling.Ignore)] double? EpsCurrentYear, + [property: JsonProperty("priceEpsCurrentYear", NullValueHandling = NullValueHandling.Ignore)] double? PriceEpsCurrentYear, + [property: JsonProperty("sharesOutstanding", NullValueHandling = NullValueHandling.Ignore)] object SharesOutstanding, + [property: JsonProperty("bookValue", NullValueHandling = NullValueHandling.Ignore)] double? BookValue, + [property: JsonProperty("ytdReturn", NullValueHandling = NullValueHandling.Ignore)] double? YtdReturn, + [property: JsonProperty("fiftyDayAverage", NullValueHandling = NullValueHandling.Ignore)] double? FiftyDayAverage, + [property: JsonProperty("fiftyDayAverageChange", NullValueHandling = NullValueHandling.Ignore)] double? FiftyDayAverageChange, + [property: JsonProperty("fiftyDayAverageChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? FiftyDayAverageChangePercent, + [property: JsonProperty("twoHundredDayAverage", NullValueHandling = NullValueHandling.Ignore)] double? TwoHundredDayAverage, + [property: JsonProperty("twoHundredDayAverageChange", NullValueHandling = NullValueHandling.Ignore)] double? TwoHundredDayAverageChange, + [property: JsonProperty("twoHundredDayAverageChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? TwoHundredDayAverageChangePercent, + [property: JsonProperty("marketCap", NullValueHandling = NullValueHandling.Ignore)] object MarketCap, + [property: JsonProperty("averageAnalystRating", NullValueHandling = NullValueHandling.Ignore)] string AverageAnalystRating, + [property: JsonProperty("firstTradeDateMilliseconds", NullValueHandling = NullValueHandling.Ignore)] object FirstTradeDateMilliseconds, + [property: JsonProperty("priceHint", NullValueHandling = NullValueHandling.Ignore)] int? PriceHint, + [property: JsonProperty("preMarketChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? PreMarketChangePercent, + [property: JsonProperty("preMarketTime", NullValueHandling = NullValueHandling.Ignore)] int? PreMarketTime, + [property: JsonProperty("preMarketPrice", NullValueHandling = NullValueHandling.Ignore)] double? PreMarketPrice, + [property: JsonProperty("preMarketChange", NullValueHandling = NullValueHandling.Ignore)] double? PreMarketChange, + [property: JsonProperty("postMarketChangePercent", NullValueHandling = NullValueHandling.Ignore)] double? PostMarketChangePercent, + [property: JsonProperty("postMarketTime", NullValueHandling = NullValueHandling.Ignore)] int? PostMarketTime, + [property: JsonProperty("postMarketPrice", NullValueHandling = NullValueHandling.Ignore)] double? PostMarketPrice, + [property: JsonProperty("postMarketChange", NullValueHandling = NullValueHandling.Ignore)] double? PostMarketChange, + [property: JsonProperty("regularMarketChange", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketChange, + [property: JsonProperty("regularMarketTime", NullValueHandling = NullValueHandling.Ignore)] int? RegularMarketTime, + [property: JsonProperty("regularMarketPrice", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketPrice, + [property: JsonProperty("regularMarketDayHigh", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketDayHigh, + [property: JsonProperty("regularMarketDayRange", NullValueHandling = NullValueHandling.Ignore)] string RegularMarketDayRange, + [property: JsonProperty("regularMarketDayLow", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketDayLow, + [property: JsonProperty("regularMarketVolume", NullValueHandling = NullValueHandling.Ignore)] int? RegularMarketVolume, + [property: JsonProperty("regularMarketPreviousClose", NullValueHandling = NullValueHandling.Ignore)] double? RegularMarketPreviousClose, + [property: JsonProperty("bid", NullValueHandling = NullValueHandling.Ignore)] double? Bid, + [property: JsonProperty("ask", NullValueHandling = NullValueHandling.Ignore)] double? Ask, + [property: JsonProperty("bidSize", NullValueHandling = NullValueHandling.Ignore)] int? BidSize, + [property: JsonProperty("askSize", NullValueHandling = NullValueHandling.Ignore)] int? AskSize, + [property: JsonProperty("market", NullValueHandling = NullValueHandling.Ignore)] string Market, + [property: JsonProperty("messageBoardId", NullValueHandling = NullValueHandling.Ignore)] string MessageBoardId, + [property: JsonProperty("exchange", NullValueHandling = NullValueHandling.Ignore)] string Exchange, + [property: JsonProperty("fiftyTwoWeekLow", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekLow, + [property: JsonProperty("fiftyTwoWeekHigh", NullValueHandling = NullValueHandling.Ignore)] double? FiftyTwoWeekHigh, + [property: JsonProperty("shortName", NullValueHandling = NullValueHandling.Ignore)] string ShortName, + [property: JsonProperty("displayName", NullValueHandling = NullValueHandling.Ignore)] string DisplayName, + [property: JsonProperty("symbol", NullValueHandling = NullValueHandling.Ignore)] string Symbol, + [property: JsonProperty("prevName", NullValueHandling = NullValueHandling.Ignore)] string PrevName, + [property: JsonProperty("nameChangeDate", NullValueHandling = NullValueHandling.Ignore)] string NameChangeDate, + [property: JsonProperty("fairValue", NullValueHandling = NullValueHandling.Ignore)] double? FairValue, + [property: JsonProperty("priceToFairValue", NullValueHandling = NullValueHandling.Ignore)] double? PriceToFairValue, + [property: JsonProperty("estimatedRevenueGrowth", NullValueHandling = NullValueHandling.Ignore)] double? EstimatedRevenueGrowth, + [property: JsonProperty("estimatedEarningsGrowth", NullValueHandling = NullValueHandling.Ignore)] double? EstimatedEarningsGrowth, + [property: JsonProperty("pageViewGrowthWeekly", NullValueHandling = NullValueHandling.Ignore)] double? PageViewGrowthWeekly, + [property: JsonProperty("rorPercent", NullValueHandling = NullValueHandling.Ignore)] double? RorPercent, + [property: JsonProperty("valueDescription", NullValueHandling = NullValueHandling.Ignore)] string ValueDescription, + [property: JsonProperty("morningstarCurrentRating", NullValueHandling = NullValueHandling.Ignore)] int? MorningstarCurrentRating, + [property: JsonProperty("morningstarStewardshipRating", NullValueHandling = NullValueHandling.Ignore)] string MorningstarStewardshipRating, + [property: JsonProperty("morningstarEconomicMoatRating", NullValueHandling = NullValueHandling.Ignore)] string MorningstarEconomicMoatRating, + [property: JsonProperty("morningstarLastClosePriceToFairValue", NullValueHandling = NullValueHandling.Ignore)] double? MorningstarLastClosePriceToFairValue, + [property: JsonProperty("morningstarPreviousRating", NullValueHandling = NullValueHandling.Ignore)] int? MorningstarPreviousRating, + [property: JsonProperty("morningstarRatingChange", NullValueHandling = NullValueHandling.Ignore)] string MorningstarRatingChange, + [property: JsonProperty("morningstarFairValue", NullValueHandling = NullValueHandling.Ignore)] double? MorningstarFairValue, + [property: JsonProperty("morningstarUncertaintyRating", NullValueHandling = NullValueHandling.Ignore)] string MorningstarUncertaintyRating ); -public record DayGainersLosersResult( - [property: JsonProperty("id")] string Id, - [property: JsonProperty("title")] string Title, - [property: JsonProperty("description")] string Description, - [property: JsonProperty("canonicalName")] string CanonicalName, - [property: JsonProperty("criteriaMeta")] CriteriaMeta CriteriaMeta, - [property: JsonProperty("rawCriteria")] string RawCriteria, - [property: JsonProperty("start")] int? Start, - [property: JsonProperty("count")] int? Count, - [property: JsonProperty("total")] int? Total, - [property: JsonProperty("quotes")] IReadOnlyList Quotes, - [property: JsonProperty("useRecords")] bool? UseRecords, - [property: JsonProperty("predefinedScr")] bool? PredefinedScr, - [property: JsonProperty("versionId")] int? VersionId, - [property: JsonProperty("creationDate")] long? CreationDate, - [property: JsonProperty("lastUpdated")] long? LastUpdated, - [property: JsonProperty("isPremium")] bool? IsPremium, - [property: JsonProperty("iconUrl")] string IconUrl +public record ScreenerResult( + [property: JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] string Id, + [property: JsonProperty("title", NullValueHandling = NullValueHandling.Ignore)] string Title, + [property: JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)] string Description, + [property: JsonProperty("canonicalName", NullValueHandling = NullValueHandling.Ignore)] string CanonicalName, + [property: JsonProperty("criteriaMeta", NullValueHandling = NullValueHandling.Ignore)] CriteriaMeta CriteriaMeta, + [property: JsonProperty("rawCriteria", NullValueHandling = NullValueHandling.Ignore)] string RawCriteria, + [property: JsonProperty("start", NullValueHandling = NullValueHandling.Ignore)] int? Start, + [property: JsonProperty("count", NullValueHandling = NullValueHandling.Ignore)] int? Count, + [property: JsonProperty("total", NullValueHandling = NullValueHandling.Ignore)] int? Total, + [property: JsonProperty("quotes", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList Quotes, + [property: JsonProperty("useRecords", NullValueHandling = NullValueHandling.Ignore)] bool? UseRecords, + [property: JsonProperty("predefinedScr", NullValueHandling = NullValueHandling.Ignore)] bool? PredefinedScr, + [property: JsonProperty("versionId", NullValueHandling = NullValueHandling.Ignore)] int? VersionId, + [property: JsonProperty("creationDate", NullValueHandling = NullValueHandling.Ignore)] long? CreationDate, + [property: JsonProperty("lastUpdated", NullValueHandling = NullValueHandling.Ignore)] long? LastUpdated, + [property: JsonProperty("isPremium", NullValueHandling = NullValueHandling.Ignore)] bool? IsPremium, + [property: JsonProperty("iconUrl", NullValueHandling = NullValueHandling.Ignore)] string IconUrl ); -public record DayGainersLosersData( - [property: JsonProperty("finance")] DayGainersLosersFinance Finance +public record ScreenerData( + [property: JsonProperty("finance", NullValueHandling = NullValueHandling.Ignore)] ScreenerFinance Finance ); \ No newline at end of file diff --git a/src/OoplesFinance.YahooFinanceAPI.csproj b/src/OoplesFinance.YahooFinanceAPI.csproj index 719d1ca..fb07c3e 100644 --- a/src/OoplesFinance.YahooFinanceAPI.csproj +++ b/src/OoplesFinance.YahooFinanceAPI.csproj @@ -8,7 +8,7 @@ True True Ooples Finance Yahoo Finance API - 1.3.2 + 1.3.3 ooples Ooples Finance Ooples Finance LLC 2022-2023 diff --git a/src/YahooClient.cs b/src/YahooClient.cs index 65d14db..a6cf1f3 100644 --- a/src/YahooClient.cs +++ b/src/YahooClient.cs @@ -584,7 +584,7 @@ public async Task> GetRealTimeQuotesAsync(IEnum return new RealTimeQuoteHelper().ParseYahooJsonData(await DownloadRealTimeQuoteDataAsync(symbols, Country, Language)); } - /// + /// m,km /// Gets market summary data /// /// @@ -608,9 +608,9 @@ public async Task> GetAutoCompleteInfoAsync(stri /// /// /// - public async Task> GetTopGainersAsync(int count) + public async Task GetTopGainersAsync(int count) { - return new DayGainersLosersHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.DayGainers, count)); + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.DayGainers, count)).First(); } /// @@ -618,9 +618,9 @@ public async Task> GetTopGainersAsync(int co /// /// /// - public async Task> GetTopLosersAsync(int count) + public async Task GetTopLosersAsync(int count) { - return new DayGainersLosersHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.DayLosers, count)); + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.DayLosers, count)).First(); } /// @@ -628,8 +628,158 @@ public async Task> GetTopLosersAsync(int cou /// /// /// - public async Task> GetSmallCapGainersAsync(int count) + public async Task GetSmallCapGainersAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.SmallCapGainers, count)).First(); + } + + /// + /// Gets the most active stocks using the selected parameters + /// + /// + /// + public async Task GetMostActiveStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.MostActives, count)).First(); + } + + /// + /// Gets the aggressive small cap stocks using the selected parameters + /// + /// + /// + public async Task GetAggressiveSmallCapStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.AggressiveSmallCaps, count)).First(); + } + + /// + /// Gets the conservative foreign funds using the selected parameters + /// + /// + /// + public async Task GetConservativeForeignFundsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.ConservativeForeignFunds, count)).First(); + } + + /// + /// Gets the growth technology stocks using the selected parameters + /// + /// + /// + public async Task GetGrowthTechnologyStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.GrowthTechnologyStocks, count)).First(); + } + + /// + /// Gets the high yield bonds using the selected parameters + /// + /// + /// + public async Task GetHighYieldBondsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.HighYieldBond, count)).First(); + } + + /// + /// Gets the most shorted stocks using the selected parameters + /// + /// + /// + public async Task GetMostShortedStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.MostShortedStocks, count)).First(); + } + + /// + /// Gets the portfolio anchors using the selected parameters + /// + /// + /// + public async Task GetPortfolioAnchorsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.PortfolioAnchors, count)).First(); + } + + /// + /// Gets the solid large growth funds using the selected parameters + /// + /// + /// + public async Task GetSolidLargeGrowthFundsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.SolidLargeGrowthFunds, count)).First(); + } + + /// + /// Gets the solid midcap growth funds using the selected parameters + /// + /// + /// + public async Task GetSolidMidcapGrowthFundsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.SolidMidcapGrowthFunds, count)).First(); + } + + /// + /// Gets the top mutual funds using the selected parameters + /// + /// + /// + public async Task GetTopMutualFundsAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.TopMutualFunds, count)).First(); + } + + /// + /// Gets the undervalued growth stocks using the selected parameters + /// + /// + /// + public async Task GetUndervaluedGrowthStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.UndervaluedGrowthStocks, count)).First(); + } + + /// + /// Gets the undervalued large cap stocks using the selected parameters + /// + /// + /// + public async Task GetUndervaluedLargeCapStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.UndervaluedLargeCaps, count)).First(); + } + + /// + /// Gets the undervalued wide moat stocks using the selected parameters + /// + /// + /// + public async Task GetUndervaluedWideMoatStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.UndervaluedWideMoatStocks, count)).First(); + } + + /// + /// Gets the morningstar five star stocks using the selected parameters + /// + /// + /// + public async Task GetMorningstarFiveStarStocksAsync(int count) + { + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.MorningstarFiveStarStocks, count)).First(); + } + + /// + /// Gets the strong undervalued stocks using the selected parameters + /// + /// + /// + public async Task GetStrongUndervaluedStocksAsync(int count) { - return new DayGainersLosersHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.SmallCapGainers, count)); + return new ScreenerHelper().ParseYahooJsonData(await DownloadScreenerDataAsync(ScreenerType.StrongUndervaluedStocks, count)).First(); } } \ No newline at end of file diff --git a/tests/TestConsoleApp/Program.cs b/tests/TestConsoleApp/Program.cs index 1cab79f..bcab54f 100644 --- a/tests/TestConsoleApp/Program.cs +++ b/tests/TestConsoleApp/Program.cs @@ -54,6 +54,21 @@ //var topGainersList = await yahooClient.GetTopGainersAsync(10); //var topLosersList = await yahooClient.GetTopLosersAsync(10); //var smallCapGainersList = await yahooClient.GetSmallCapGainersAsync(10); + var mostActiveStocksList = await yahooClient.GetMostActiveStocksAsync(10); + var aggressiveSmallCapsList = await yahooClient.GetAggressiveSmallCapStocksAsync(10); + var conservativeForeignFundsList = await yahooClient.GetConservativeForeignFundsAsync(10); + var growthTechStocksList = await yahooClient.GetGrowthTechnologyStocksAsync(10); + var highYieldBondsList = await yahooClient.GetHighYieldBondsAsync(10); + var mostShortedStocksList = await yahooClient.GetMostShortedStocksAsync(10); + var portfolioAnchorsList = await yahooClient.GetPortfolioAnchorsAsync(10); + var solidLargeGrowthFundsList = await yahooClient.GetSolidLargeGrowthFundsAsync(10); + var solidMidcapGrowthFundsList = await yahooClient.GetSolidMidcapGrowthFundsAsync(10); + var topMutualFundsList = await yahooClient.GetTopMutualFundsAsync(10); + var undervaluedGrowthStocksList = await yahooClient.GetUndervaluedGrowthStocksAsync(10); + var undervaluedLargeCapsList = await yahooClient.GetUndervaluedLargeCapStocksAsync(10); + var undervaluedWideMoatStocksList = await yahooClient.GetUndervaluedWideMoatStocksAsync(10); + var morningstarFiveStarStocksList = await yahooClient.GetMorningstarFiveStarStocksAsync(10); + var strongUndervaluedStocksList = await yahooClient.GetStrongUndervaluedStocksAsync(10); Console.WriteLine(); }