Class: SecEdgar::OwnershipDocument
- Inherits:
-
Struct
- Object
- Struct
- SecEdgar::OwnershipDocument
- Defined in:
- lib/sec_edgar/ownership_document.rb
Instance Attribute Summary collapse
-
#derivative_transactions ⇒ Object
Returns the value of attribute derivative_transactions.
-
#document_type ⇒ Object
Returns the value of attribute document_type.
-
#footnotes ⇒ Object
Returns the value of attribute footnotes.
-
#is_director ⇒ Object
Returns the value of attribute is_director.
-
#is_officer ⇒ Object
Returns the value of attribute is_officer.
-
#is_other ⇒ Object
Returns the value of attribute is_other.
-
#is_ten_percent_owner ⇒ Object
Returns the value of attribute is_ten_percent_owner.
-
#issuer_cik ⇒ Object
Returns the value of attribute issuer_cik.
-
#issuer_name ⇒ Object
Returns the value of attribute issuer_name.
-
#issuer_trading_symbol ⇒ Object
Returns the value of attribute issuer_trading_symbol.
-
#not_subject_to_section_16 ⇒ Object
Returns the value of attribute not_subject_to_section_16.
-
#officer_title ⇒ Object
Returns the value of attribute officer_title.
-
#owner_address ⇒ Object
Returns the value of attribute owner_address.
-
#owner_cik ⇒ Object
Returns the value of attribute owner_cik.
-
#owner_name ⇒ Object
Returns the value of attribute owner_name.
-
#period_of_report ⇒ Object
Returns the value of attribute period_of_report.
-
#schema_version ⇒ Object
Returns the value of attribute schema_version.
-
#transactions ⇒ Object
Returns the value of attribute transactions.
Instance Method Summary collapse
- #all_trans ⇒ Object
- #as_json ⇒ Object
- #derivative_trans ⇒ Object
- #dollar_volume ⇒ Object
- #sum_shares ⇒ Object
- #sum_shares_after ⇒ Object
- #total_shares ⇒ Object
- #trans ⇒ Object
Instance Attribute Details
#derivative_transactions ⇒ Object
Returns the value of attribute derivative_transactions
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def derivative_transactions @derivative_transactions end |
#document_type ⇒ Object
Returns the value of attribute document_type
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def document_type @document_type end |
#footnotes ⇒ Object
Returns the value of attribute footnotes
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def footnotes @footnotes end |
#is_director ⇒ Object
Returns the value of attribute is_director
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def is_director @is_director end |
#is_officer ⇒ Object
Returns the value of attribute is_officer
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def is_officer @is_officer end |
#is_other ⇒ Object
Returns the value of attribute is_other
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def is_other @is_other end |
#is_ten_percent_owner ⇒ Object
Returns the value of attribute is_ten_percent_owner
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def is_ten_percent_owner @is_ten_percent_owner end |
#issuer_cik ⇒ Object
Returns the value of attribute issuer_cik
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def issuer_cik @issuer_cik end |
#issuer_name ⇒ Object
Returns the value of attribute issuer_name
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def issuer_name @issuer_name end |
#issuer_trading_symbol ⇒ Object
Returns the value of attribute issuer_trading_symbol
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def issuer_trading_symbol @issuer_trading_symbol end |
#not_subject_to_section_16 ⇒ Object
Returns the value of attribute not_subject_to_section_16
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def not_subject_to_section_16 @not_subject_to_section_16 end |
#officer_title ⇒ Object
Returns the value of attribute officer_title
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def officer_title @officer_title end |
#owner_address ⇒ Object
Returns the value of attribute owner_address
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def owner_address @owner_address end |
#owner_cik ⇒ Object
Returns the value of attribute owner_cik
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def owner_cik @owner_cik end |
#owner_name ⇒ Object
Returns the value of attribute owner_name
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def owner_name @owner_name end |
#period_of_report ⇒ Object
Returns the value of attribute period_of_report
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def period_of_report @period_of_report end |
#schema_version ⇒ Object
Returns the value of attribute schema_version
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def schema_version @schema_version end |
#transactions ⇒ Object
Returns the value of attribute transactions
25 26 27 |
# File 'lib/sec_edgar/ownership_document.rb', line 25 def transactions @transactions end |
Instance Method Details
#all_trans ⇒ Object
78 79 80 |
# File 'lib/sec_edgar/ownership_document.rb', line 78 def all_trans trans + derivative_trans end |
#as_json ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/sec_edgar/ownership_document.rb', line 108 def as_json(*) tran_codes = {} SecEdgar::TRANSACTION_CODES.keys.each do |code| name = "per_code_#{ code.downcase }".to_sym tran_codes[name] = send(name) end super .merge(sum_shares: sum_shares, sum_shares_after: sum_shares_after) .merge(tran_codes) end |
#derivative_trans ⇒ Object
86 87 88 |
# File 'lib/sec_edgar/ownership_document.rb', line 86 def derivative_trans derivative_transactions || [] end |
#dollar_volume ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/sec_edgar/ownership_document.rb', line 60 def dollar_volume @dollar_volume ||= begin sum = 0 all_trans.each do |t| if t.acquired_or_disposed_code == 'A' sum += t.shares * t.price_per_share else sum -= t.shares * t.price_per_share end end sum end end |
#sum_shares ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sec_edgar/ownership_document.rb', line 46 def sum_shares @sum ||= begin sum = 0 all_trans.each do |t| if t.acquired_or_disposed_code == 'A' sum += t.shares else sum -= t.shares end end sum end end |
#sum_shares_after ⇒ Object
103 104 105 106 |
# File 'lib/sec_edgar/ownership_document.rb', line 103 def sum_shares_after return all_trans.map(&:shares_after).max if sum_shares > 0 trans.map(&:shares_after).min || 0 end |
#total_shares ⇒ Object
74 75 76 |
# File 'lib/sec_edgar/ownership_document.rb', line 74 def total_shares @total ||= all_trans.map(&:shares).inject(:+) end |
#trans ⇒ Object
82 83 84 |
# File 'lib/sec_edgar/ownership_document.rb', line 82 def trans transactions || [] end |