Class: ThirteenF::NetPosition
- Inherits:
-
Object
- Object
- ThirteenF::NetPosition
- Defined in:
- lib/thirteen_f/net_position.rb
Overview
a net position ignores the “other manager” and “investment discretion” column and rollups positions by CUSIP, see a Berkshire Hathaway Inc 13-F for why this is useful: www.sec.gov/Archives/edgar/data/1067983/000095012320002466/xslForm13F_X01/form13fInfoTable.xml
Instance Attribute Summary collapse
-
#cusip ⇒ Object
readonly
Returns the value of attribute cusip.
-
#filing ⇒ Object
readonly
Returns the value of attribute filing.
-
#investment_discretion ⇒ Object
readonly
Returns the value of attribute investment_discretion.
-
#name_of_issuer ⇒ Object
readonly
Returns the value of attribute name_of_issuer.
-
#put_or_call ⇒ Object
readonly
Returns the value of attribute put_or_call.
-
#shares_or_principal_amount ⇒ Object
readonly
Returns the value of attribute shares_or_principal_amount.
-
#shares_or_principal_amount_type ⇒ Object
readonly
Returns the value of attribute shares_or_principal_amount_type.
-
#title_of_class ⇒ Object
readonly
Returns the value of attribute title_of_class.
-
#value_in_thousands ⇒ Object
readonly
Returns the value of attribute value_in_thousands.
-
#voting_authority ⇒ Object
readonly
Returns the value of attribute voting_authority.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cusip:, name_of_issuer:, title_of_class:, put_or_call:, value_in_thousands:, shares_or_principal_amount:, shares_or_principal_amount_type:, voting_authority:) ⇒ NetPosition
constructor
A new instance of NetPosition.
Constructor Details
#initialize(cusip:, name_of_issuer:, title_of_class:, put_or_call:, value_in_thousands:, shares_or_principal_amount:, shares_or_principal_amount_type:, voting_authority:) ⇒ NetPosition
Returns a new instance of NetPosition.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/thirteen_f/net_position.rb', line 34 def initialize(cusip:, name_of_issuer:, title_of_class:, put_or_call:, value_in_thousands:, shares_or_principal_amount:, shares_or_principal_amount_type:, voting_authority:) @cusip = cusip @name_of_issuer = name_of_issuer @title_of_class = title_of_class @value_in_thousands = value_in_thousands @put_or_call = put_or_call @shares_or_principal_amount = shares_or_principal_amount @shares_or_principal_amount_type = shares_or_principal_amount_type @voting_authority = true end |
Instance Attribute Details
#cusip ⇒ Object (readonly)
Returns the value of attribute cusip.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def cusip @cusip end |
#filing ⇒ Object (readonly)
Returns the value of attribute filing.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def filing @filing end |
#investment_discretion ⇒ Object (readonly)
Returns the value of attribute investment_discretion.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def investment_discretion @investment_discretion end |
#name_of_issuer ⇒ Object (readonly)
Returns the value of attribute name_of_issuer.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def name_of_issuer @name_of_issuer end |
#put_or_call ⇒ Object (readonly)
Returns the value of attribute put_or_call.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def put_or_call @put_or_call end |
#shares_or_principal_amount ⇒ Object (readonly)
Returns the value of attribute shares_or_principal_amount.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def shares_or_principal_amount @shares_or_principal_amount end |
#shares_or_principal_amount_type ⇒ Object (readonly)
Returns the value of attribute shares_or_principal_amount_type.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def shares_or_principal_amount_type @shares_or_principal_amount_type end |
#title_of_class ⇒ Object (readonly)
Returns the value of attribute title_of_class.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def title_of_class @title_of_class end |
#value_in_thousands ⇒ Object (readonly)
Returns the value of attribute value_in_thousands.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def value_in_thousands @value_in_thousands end |
#voting_authority ⇒ Object (readonly)
Returns the value of attribute voting_authority.
10 11 12 |
# File 'lib/thirteen_f/net_position.rb', line 10 def @voting_authority end |
Class Method Details
.call(positions) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/thirteen_f/net_position.rb', line 14 def self.call(positions) cusips = positions.map(&:cusip).uniq cusips.map do |cusip| subset = positions.select { |position| position.cusip == cusip } new( name_of_issuer: subset.first.name_of_issuer, cusip: cusip, title_of_class: subset.first.title_of_class, value_in_thousands: subset.map(&:value_in_thousands).sum, shares_or_principal_amount: subset.map(&:shares_or_principal_amount).sum, shares_or_principal_amount_type: subset.first.shares_or_principal_amount_type, put_or_call: subset.first.put_or_call, voting_authority: { sole: subset.map { |x| x.[:sole] }.sum, shared: subset.map { |x| x.[:shared] }.sum, none: subset.map { |x| x.[:none] }.sum } ) end end |