thirteen_f 0.5.0 → 0.5.1
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/lib/thirteen_f/cusip_securities.rb +2 -7
- data/lib/thirteen_f/entity.rb +0 -21
- data/lib/thirteen_f/search_hit.rb +4 -1
- data/lib/thirteen_f/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3ed7ebb2e2cfea6d18e3d1d2e299bc4f5f78d55e38125e5b89d95c83d3097db
|
|
4
|
+
data.tar.gz: e41f166c32e1c30a6214bd40845a92f7647a9113565ac7293d4b43dd468e1526
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 006aadbbaa7b2aa7df79bedefe4966dc9f5bcc9619a0def79901c6f056bbc74ebcf0a5d76ba58cd9c0d9356ab57a49a8178d2da493e6deb3862379b236ff96cf
|
|
7
|
+
data.tar.gz: 137a09503b646f92170a836febcab9607fdc2aba2c2f82c656e2b772bc1975970479bd3cd46d07707f462b19c823546a681ad7f9fc5da4749f27478f8b040c04
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'http'
|
|
4
3
|
require 'date'
|
|
5
4
|
require 'open-uri'
|
|
6
5
|
require 'pdf-reader'
|
|
@@ -12,9 +11,7 @@ class ThirteenF
|
|
|
12
11
|
|
|
13
12
|
def self.all_file_locations
|
|
14
13
|
index_url = "#{BASE_URL}/divisions/investment/13flists.htm"
|
|
15
|
-
|
|
16
|
-
return false unless response.status == 200
|
|
17
|
-
page = Nokogiri::HTML response.to_s
|
|
14
|
+
page = SecRequest.get index_url, response_type: :html
|
|
18
15
|
a_tags = page.search('a').select do |a_tag|
|
|
19
16
|
href = a_tag.attributes['href']&.value.to_s
|
|
20
17
|
href.include?('13flist') && href.include?('.pdf')
|
|
@@ -24,9 +21,7 @@ class ThirteenF
|
|
|
24
21
|
|
|
25
22
|
def self.most_recent_list
|
|
26
23
|
index_url = "#{BASE_URL}/divisions/investment/13flists.htm"
|
|
27
|
-
|
|
28
|
-
return false unless response.status == 200
|
|
29
|
-
page = Nokogiri::HTML response.to_s
|
|
24
|
+
page = SecRequest.get index_url, response_type: :html
|
|
30
25
|
a_tag = page.search('a').find { |a| a.text.include?('Current List') }
|
|
31
26
|
file_location = "#{BASE_URL + a_tag.attributes['href'].value}"
|
|
32
27
|
new file_location
|
data/lib/thirteen_f/entity.rb
CHANGED
|
@@ -45,27 +45,6 @@ class ThirteenF
|
|
|
45
45
|
filings.select(&:period_of_report).max_by(&:period_of_report)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
def sec_filings_page_url
|
|
49
|
-
"#{BASE_URL}/cgi-bin/browse-edgar?CIK=#{cik}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def thirteen_f_filings_url(count: 10)
|
|
53
|
-
"#{sec_filings_page_url}&type=13f&count=#{count}"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def self.sec_url_from_cik(cik)
|
|
57
|
-
"#{BASE_URL}/cgi-bin/browse-edgar?CIK=#{cik}"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def thirteen_f_urls(count: 10)
|
|
61
|
-
response = HTTP.get thirteen_f_filings_url(count: count)
|
|
62
|
-
page = Nokogiri::HTML response.to_s
|
|
63
|
-
page.search('#documentsbutton').map do |btn|
|
|
64
|
-
next nil unless btn.parent.previous.previous.text.include?('13F-HR')
|
|
65
|
-
"#{BASE_URL + btn.attributes['href'].value}"
|
|
66
|
-
end.compact
|
|
67
|
-
end
|
|
68
|
-
|
|
69
48
|
private
|
|
70
49
|
def cik_from_id(id)
|
|
71
50
|
id.prepend('0') until id.length >= 10
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
class ThirteenF
|
|
4
4
|
class SearchHit
|
|
5
|
-
attr_reader :cik, :name, :entity
|
|
5
|
+
attr_reader :cik, :name, :entity, :sec_page_url
|
|
6
6
|
|
|
7
7
|
def self.from_search_hits(hits)
|
|
8
8
|
hits.map { |hit| new hit }
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
BASE_URL = 'https://www.sec.gov'
|
|
12
|
+
|
|
11
13
|
def initialize(sec_hit)
|
|
12
14
|
@cik = cik_from_id sec_hit[:_id]
|
|
13
15
|
@name = sec_hit[:_source][:entity]
|
|
16
|
+
@sec_page_url = "#{BASE_URL}/edgar/browse/?CIK=#{cik}&owner=exclude"
|
|
14
17
|
true
|
|
15
18
|
end
|
|
16
19
|
|
data/lib/thirteen_f/version.rb
CHANGED