thirteen_f 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/thirteen_f/net_position.rb +49 -0
- data/lib/thirteen_f/version.rb +1 -1
- data/lib/thirteen_f.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb76d3b3211588ccaea9d8bffc0b1c005e36a9ec94a5adb2cae70b831454aa9b
|
4
|
+
data.tar.gz: fc9e74b9a1b1076f979424cac44d4940383a9fd0f0770ea0cc9328e4390f3617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bda8cbbb0b453ab74830f3171af821302b3f0fc9da42c8264f1fd8334a97e50c58ba5728808ba2a994b5750236842140ee733b9e35e2774c3af8e6bcf6dd3e0
|
7
|
+
data.tar.gz: 9c9afe0348f553b050f1df3ae6c980eae375bad7f9f74881146889f5636143ead6d55210fb99d40e31c0e0805c64a6aebe3a9f7e2116f5a1a8070dbcebd5ab3b
|
data/Gemfile.lock
CHANGED
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
|
+
|
data/lib/thirteen_f/version.rb
CHANGED
data/lib/thirteen_f.rb
CHANGED
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
|
+
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
|