thirteen_f 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +19 -6
- data/lib/thirteen_f/company.rb +8 -1
- data/lib/thirteen_f/position.rb +47 -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: c49261f579858881f09bf7f929b5e26ab270a3212f04d873ced78c8ff2cca5a7
|
4
|
+
data.tar.gz: 7357540f69f1cd5e3dd754463d362e1f8efccebf23d2a1add14d9c8a26226049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990cfd15c836e9337df3d364feb813a47e2fd20b7a1269cf622b564c52e296a2fbef56d91b84f7e530237ca3594290ad05c8dbd748abb30df4ab1164e5379858
|
7
|
+
data.tar.gz: 2f120c6e8afc60a95b8be94358e8aa3f03ee5f19e7e87a37451a44408618146d75ffff8684986b22dcbe0ab2b040c863c2e9d73b557b89f8d1d1fafdd82770d2
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Reports. What is a 13F Report? Please visit
|
|
10
10
|
for a full description.
|
11
11
|
|
12
12
|
This library is meant to serve a lightweight API which developers can enhance
|
13
|
-
via a persistence layer in their own applications.
|
13
|
+
via a persistence layer and/or UI in their own applications.
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -34,19 +34,32 @@ TODO: Write usage instructions here
|
|
34
34
|
|
35
35
|
## Development
|
36
36
|
|
37
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
38
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
39
|
+
prompt that will allow you to experiment.
|
38
40
|
|
39
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
41
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
42
|
+
release a new version, update the version number in `version.rb`, and then run
|
43
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
44
|
+
git commits and tags, and push the `.gem` file to
|
45
|
+
[rubygems.org](https://rubygems.org).
|
40
46
|
|
41
47
|
## Contributing
|
42
48
|
|
43
|
-
Bug reports and pull requests are welcome on GitHub at
|
49
|
+
Bug reports and pull requests are welcome on GitHub at
|
50
|
+
https://github.com/fordfischer/thirteen_f. This project is intended to be a safe,
|
51
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
52
|
+
the [code of
|
53
|
+
conduct](https://github.com/fordfischer/thirteen_f/blob/master/CODE_OF_CONDUCT.md).
|
44
54
|
|
45
55
|
|
46
56
|
## License
|
47
57
|
|
48
|
-
The gem is available as open source under the terms of the [MIT
|
58
|
+
The gem is available as open source under the terms of the [MIT
|
59
|
+
License](https://opensource.org/licenses/MIT).
|
49
60
|
|
50
61
|
## Code of Conduct
|
51
62
|
|
52
|
-
Everyone interacting in the ThirteenF project's codebases, issue trackers, chat
|
63
|
+
Everyone interacting in the ThirteenF project's codebases, issue trackers, chat
|
64
|
+
rooms and mailing lists is expected to follow the [code of
|
65
|
+
conduct](https://github.com/fordfischer/thirteen_f/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/thirteen_f/company.rb
CHANGED
@@ -4,7 +4,7 @@ require 'http'
|
|
4
4
|
|
5
5
|
class ThirteenF
|
6
6
|
class Company
|
7
|
-
attr_reader :cik, :name, :state_or_country, :filings
|
7
|
+
attr_reader :cik, :name, :state_or_country, :filings, :most_recent_holdings
|
8
8
|
|
9
9
|
BASE_URL = 'https://www.sec.gov'
|
10
10
|
|
@@ -34,6 +34,13 @@ class ThirteenF
|
|
34
34
|
true
|
35
35
|
end
|
36
36
|
|
37
|
+
def get_most_recent_holdings
|
38
|
+
get_filings unless filings
|
39
|
+
most_recent_filing = filings.select(&:period_of_report).max_by(&:period_of_report)
|
40
|
+
@most_recent_holdings = Position.from_xml_filing most_recent_filing
|
41
|
+
true
|
42
|
+
end
|
43
|
+
|
37
44
|
def sec_filings_page_url
|
38
45
|
"#{BASE_URL}/cgi-bin/browse-edgar?CIK=#{cik}"
|
39
46
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'http'
|
4
|
+
|
5
|
+
class ThirteenF
|
6
|
+
class Position
|
7
|
+
attr_reader :name_of_issuer, :title_of_class, :cusip, :value_in_thousands,
|
8
|
+
:shares_or_principal_amount_type, :shares_or_principal_amount, :put_or_call,
|
9
|
+
:investment_discretion, :other_managers, :voting_authority, :filing
|
10
|
+
|
11
|
+
def self.from_xml_filing(filing)
|
12
|
+
return unless filing.table_xml_url
|
13
|
+
response = HTTP.get filing.table_xml_url
|
14
|
+
xml_doc = Nokogiri::XML response.to_s
|
15
|
+
xml_doc.search('infoTable').map do |info_table|
|
16
|
+
position = new filing
|
17
|
+
position.attributes_from_info_table(info_table)
|
18
|
+
position
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(filing)
|
23
|
+
@filing = filing
|
24
|
+
end
|
25
|
+
|
26
|
+
def attributes_from_info_table(info_table)
|
27
|
+
@name_of_issuer = info_table.search('nameOfIssuer').text
|
28
|
+
@title_of_class = info_table.search('titleOfClass').text
|
29
|
+
@cusip = info_table.search('cusip').text
|
30
|
+
@value_in_thousands = info_table.search('value').text
|
31
|
+
@shares_or_principal_amount_type = info_table.search('sshPrnamtType').text
|
32
|
+
@shares_or_principal_amount = info_table.search('sshPrnamt').text
|
33
|
+
|
34
|
+
not_found = info_table.search('putCall').count == 0
|
35
|
+
@put_or_call = info_table.search('putCall').text unless not_found
|
36
|
+
|
37
|
+
@investment_discretion = info_table.search('investmentDiscretion').text
|
38
|
+
@other_managers = info_table.search('otherManager').text
|
39
|
+
@voting_authority = {
|
40
|
+
sole: info_table.search('Sole').text,
|
41
|
+
shared: info_table.search('Shared').text,
|
42
|
+
none: info_table.search('None').text
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fordfischer
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/thirteen_f.rb
|
92
92
|
- lib/thirteen_f/company.rb
|
93
93
|
- lib/thirteen_f/filing.rb
|
94
|
+
- lib/thirteen_f/position.rb
|
94
95
|
- lib/thirteen_f/search.rb
|
95
96
|
- lib/thirteen_f/version.rb
|
96
97
|
- thirteen_f.gemspec
|