FintelVentures / fintel-issues

Public repository to track bugs, issues, and feature requests for Fintel
1 stars 0 forks source link

Feature Request: SetSize and Rank functions #37

Open JCD44 opened 4 years ago

JCD44 commented 4 years ago

There currently is no way I see to evaluate the ranking of a particular stock within the entire set. For example, I might want to only evaluate the bottom 50% of stocks by pe ratio. I would like to be able to do something like this:

Rank(pe) < SetSize(pe)/2

I suggest SetSize not be a variable because different screener terms (fields) seem to have or not have different data. Null, N/A, 0 or whatever attribute you use for no data would simply be skipped and not part of the set.

The Rank function would return the position within the set that a particular item is. Given a tie, I think all tied members should return the same rank. Lets look at how the data would come out:

Given a query of: pe; Rank(pe); SetSize(pe);

Name, pe, Rank(pe), SetSize(pe) AAPL, 10, 1, 4 F, 10, 1, 4 GM, 12, 3, 4 RIO, 0,, 4 MSFT, 20, 4, 4

With that dataset, my first query would...

Rank(pe) < SetSize(pe)/2 //Calculation of SetSize = 4 / 2 = 2

Name, pe, Rank(pe), SetSize(pe) AAPL, 10, 1, 4 F, 10, 1, 4