Skip to content

Commit

Permalink
Added a method to get the most institutionally sold large cap stocks
Browse files Browse the repository at this point in the history
Added a method to get stocks with most institutional buyers
Added a method to get stocks with most institutional sellers
Added a method to get stocks most bought by hedge funds
Added a method to get stocks most bought by pension funds
Added a method to get stocks most bought by private equity
Added a method to get stocks most bought by sovereign wealth funds
Added a method to get top stocks owned by cathie wood
Added a method to get top stocks owned by warren buffet
Added a method to get top stocks owned by ray dalio
Added a method to get top stocks owned by goldman sachs
Added a method to get top bearish stocks right now
Added a method to get top bullish stocks right now
Added a method to get top upside breakout stocks
  • Loading branch information
ooples committed Feb 17, 2023
1 parent 691807f commit a7d7308
Show file tree
Hide file tree
Showing 7 changed files with 392 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/Helpers/StocksOwnedHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace OoplesFinance.YahooFinanceAPI.Helpers;

internal class StocksOwnedHelper : YahooJsonBase
{
/// <summary>
/// Parses the raw json data for the Stocks Owned data
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="jsonData"></param>
/// <returns></returns>
internal override IEnumerable<T> ParseYahooJsonData<T>(string jsonData)
{
var stocksOwned = JsonConvert.DeserializeObject<StocksOwnedData>(jsonData);

return stocksOwned != null ? (IEnumerable<T>)stocksOwned.Finance.Results : Enumerable.Empty<T>();
}
}
17 changes: 17 additions & 0 deletions src/Helpers/TrendingStocksHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace OoplesFinance.YahooFinanceAPI.Helpers;

internal class TrendingStocksHelper : YahooJsonBase
{
/// <summary>
/// Parses the raw json data for the Trending Stocks data
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="jsonData"></param>
/// <returns></returns>
internal override IEnumerable<T> ParseYahooJsonData<T>(string jsonData)
{
var trendingStocks = JsonConvert.DeserializeObject<TrendingStocksData>(jsonData);

return trendingStocks != null ? (IEnumerable<T>)trendingStocks.Finance.Results : Enumerable.Empty<T>();
}
}
3 changes: 2 additions & 1 deletion src/Models/InstitutionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public record InstitutionRecord(
[property: JsonProperty("percentOfSharesOutHeldByInstitutions", NullValueHandling = NullValueHandling.Ignore)] double? PercentOfSharesOutHeldByInstitutions,
[property: JsonProperty("lastReportDate", NullValueHandling = NullValueHandling.Ignore)] string LastReportDate,
[property: JsonProperty("averageRating", NullValueHandling = NullValueHandling.Ignore)] string AverageRating,
[property: JsonProperty("fiftyTwoWeekRange", NullValueHandling = NullValueHandling.Ignore)] string FiftyTwoWeekRange
[property: JsonProperty("fiftyTwoWeekRange", NullValueHandling = NullValueHandling.Ignore)] string FiftyTwoWeekRange,
[property: JsonProperty("logoUrl", NullValueHandling = NullValueHandling.Ignore)] string LogoUrl
);

public record InstitutionResult(
Expand Down
64 changes: 64 additions & 0 deletions src/Models/StocksOwnedData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
namespace OoplesFinance.YahooFinanceAPI.Models;

public record StocksOwnedCriteriaMeta(
[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("entityIdType", NullValueHandling = NullValueHandling.Ignore)] string EntityIdType,
[property: JsonProperty("criteria", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<StocksOwnedCriterion> Criteria,
[property: JsonProperty("topOperator", NullValueHandling = NullValueHandling.Ignore)] string TopOperator
);

public record StocksOwnedCriterion(
[property: JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)] string Field,
[property: JsonProperty("operators", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<string> Operators,
[property: JsonProperty("values", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<string> Values,
[property: JsonProperty("labelsSelected", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<int?> LabelsSelected,
[property: JsonProperty("dependentValues", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<object> DependentValues
);

public record StocksOwnedFinance(
[property: JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<StocksOwnedResult> Results,
[property: JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] object Error
);

public record StocksOwnedRecord(
[property: JsonProperty("formType", NullValueHandling = NullValueHandling.Ignore)] string FormType,
[property: JsonProperty("ticker", NullValueHandling = NullValueHandling.Ignore)] string Ticker,
[property: JsonProperty("companyName", NullValueHandling = NullValueHandling.Ignore)] string CompanyName,
[property: JsonProperty("fileDate", NullValueHandling = NullValueHandling.Ignore)] object FileDate,
[property: JsonProperty("fundName", NullValueHandling = NullValueHandling.Ignore)] string FundName,
[property: JsonProperty("fundType", NullValueHandling = NullValueHandling.Ignore)] string FundType,
[property: JsonProperty("prevShares", NullValueHandling = NullValueHandling.Ignore)] int? PrevShares,
[property: JsonProperty("currentShares", NullValueHandling = NullValueHandling.Ignore)] int? CurrentShares,
[property: JsonProperty("percentChangeInShares", NullValueHandling = NullValueHandling.Ignore)] double? PercentChangeInShares,
[property: JsonProperty("ownershipPercent", NullValueHandling = NullValueHandling.Ignore)] double? OwnershipPercent,
[property: JsonProperty("percentChangeInOwnership", NullValueHandling = NullValueHandling.Ignore)] double? PercentChangeInOwnership,
[property: JsonProperty("percentOfSharesOutstanding", NullValueHandling = NullValueHandling.Ignore)] double? PercentOfSharesOutstanding,
[property: JsonProperty("fundAum", NullValueHandling = NullValueHandling.Ignore)] object FundAum,
[property: JsonProperty("logoUrl", NullValueHandling = NullValueHandling.Ignore)] string LogoUrl
);

public record StocksOwnedResult(
[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)] StocksOwnedCriteriaMeta 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("records", NullValueHandling = NullValueHandling.Ignore)] IReadOnlyList<StocksOwnedRecord> Records,
[property: JsonProperty("userHasReadRecord", NullValueHandling = NullValueHandling.Ignore)] bool? UserHasReadRecord,
[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("isPremium", NullValueHandling = NullValueHandling.Ignore)] bool? IsPremium,
[property: JsonProperty("iconUrl", NullValueHandling = NullValueHandling.Ignore)] string IconUrl
);

public record StocksOwnedData(
[property: JsonProperty("finance", NullValueHandling = NullValueHandling.Ignore)] StocksOwnedFinance Finance
);
Loading

0 comments on commit a7d7308

Please sign in to comment.