thirteen_f 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fd0ce8339b871674652421c7027d64d472fc1bc93c04bd4945b098425ad75fa
4
- data.tar.gz: 21e0f9165941af507b4816420bbaf5e12e10acd4079d8dccc5a16664d258f469
3
+ metadata.gz: fb76d3b3211588ccaea9d8bffc0b1c005e36a9ec94a5adb2cae70b831454aa9b
4
+ data.tar.gz: fc9e74b9a1b1076f979424cac44d4940383a9fd0f0770ea0cc9328e4390f3617
5
5
  SHA512:
6
- metadata.gz: 30f99ce92ff3fff27ea54ed8da8d18d1007d6cf19ee016b1ee03ddf7a1b3bd749f40a245bdab4713f96e5aaed92a48b9930aceeb4b402992bf98d11fd1790e9a
7
- data.tar.gz: 188746a7c35359d60e801fb6643cee73f3a7d008289895ca79f2b3fd9495c195820fa693b40eca1582f4a70f98ddfc6753dab599bdb4db8ff601c1f356f67dde
6
+ metadata.gz: 8bda8cbbb0b453ab74830f3171af821302b3f0fc9da42c8264f1fd8334a97e50c58ba5728808ba2a994b5750236842140ee733b9e35e2774c3af8e6bcf6dd3e0
7
+ data.tar.gz: 9c9afe0348f553b050f1df3ae6c980eae375bad7f9f74881146889f5636143ead6d55210fb99d40e31c0e0805c64a6aebe3a9f7e2116f5a1a8070dbcebd5ab3b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thirteen_f (0.2.2)
4
+ thirteen_f (0.2.5)
5
5
  http (>= 4.4)
6
6
  nokogiri
7
7
  pdf-reader
data/README.md CHANGED
@@ -47,7 +47,7 @@ search.companies
47
47
 
48
48
  ```ruby
49
49
  cik_number = '0001061768'
50
- company = Company.from_cik cik_number
50
+ company = ThirteenF::Company.from_cik cik_number
51
51
 
52
52
  company = search.companies.first
53
53
  company.get_filings # grabs 10 13F filings by default which is the minimum
@@ -84,7 +84,7 @@ filing.cover_page_html_url # String or nil
84
84
 
85
85
  ```ruby
86
86
  xml_url = 'https://www.sec.gov/Archives/edgar/data/1061768/000156761920003359/form13fInfoTable.xml'
87
- positions = Position.from_xml_url(xml_url)
87
+ positions = ThirteenF::Position.from_xml_url(xml_url)
88
88
 
89
89
  position = filing.positions.first
90
90
  position.filing
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ThirteenF
4
+ # a net position ignores the "other manager" and "investment discretion"
5
+ # column and rollups positions by CUSIP, see a Berkshire Hathaway Inc 13-F for
6
+ # why this is useful:
7
+ # https://www.sec.gov/Archives/edgar/data/1067983/000095012320002466/xslForm13F_X01/form13fInfoTable.xml
8
+
9
+ class NetPosition
10
+ attr_reader :name_of_issuer, :title_of_class, :cusip, :value_in_thousands,
11
+ :shares_or_principal_amount_type, :shares_or_principal_amount, :put_or_call,
12
+ :investment_discretion, :voting_authority, :filing
13
+
14
+ def self.call(positions)
15
+ cusips = positions.map(&:cusip).uniq
16
+ cusips.map do |cusip|
17
+ subset = positions.select { |position| position.cusip == cusip }
18
+ new(
19
+ name_of_issuer: subset.first.name_of_issuer,
20
+ cusip: cusip, title_of_class: subset.first.title_of_class,
21
+ value_in_thousands: subset.map(&:value_in_thousands).sum,
22
+ shares_or_principal_amount: subset.map(&:shares_or_principal_amount).sum,
23
+ shares_or_principal_amount_type: subset.first.shares_or_principal_amount_type,
24
+ put_or_call: subset.first.put_or_call,
25
+ voting_authority: {
26
+ sole: subset.map { |x| x.voting_authority[:sole] }.sum,
27
+ shared: subset.map { |x| x.voting_authority[:shared] }.sum,
28
+ none: subset.map { |x| x.voting_authority[:none] }.sum
29
+ }
30
+ )
31
+ end
32
+ end
33
+
34
+ def initialize(cusip:, name_of_issuer:, title_of_class:, put_or_call:,
35
+ value_in_thousands:, shares_or_principal_amount:,
36
+ shares_or_principal_amount_type:, voting_authority:)
37
+ @cusip = cusip
38
+ @name_of_issuer = name_of_issuer
39
+ @title_of_class = title_of_class
40
+ @value_in_thousands = value_in_thousands
41
+ @shares_or_principal_amount = shares_or_principal_amount
42
+ @shares_or_principal_amount_type = shares_or_principal_amount_type
43
+ @voting_authority = voting_authority
44
+ true
45
+ end
46
+
47
+ end
48
+ end
49
+
@@ -1,3 +1,3 @@
1
1
  class ThirteenF
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/thirteen_f.rb CHANGED
@@ -4,6 +4,7 @@ require "thirteen_f/company"
4
4
  require "thirteen_f/search"
5
5
  require "thirteen_f/filing"
6
6
  require "thirteen_f/position"
7
+ require "thirteen_f/net_position"
7
8
  require "thirteen_f/cusip_securities"
8
9
  require "thirteen_f/version"
9
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thirteen_f
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - fordfischer
@@ -106,6 +106,7 @@ files:
106
106
  - lib/thirteen_f/company.rb
107
107
  - lib/thirteen_f/cusip_securities.rb
108
108
  - lib/thirteen_f/filing.rb
109
+ - lib/thirteen_f/net_position.rb
109
110
  - lib/thirteen_f/position.rb
110
111
  - lib/thirteen_f/search.rb
111
112
  - lib/thirteen_f/version.rb