yf_as_dataframe 0.4.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb178f1a6feb462ac539fccad4d2440f2754b55b4ec0742a965b48bf4aa72fb1
4
- data.tar.gz: 189dd9688dd80eeb85f8d2154f3a1d9f260f8fcb30ad7c3f086afb1485d0303a
3
+ metadata.gz: 703c1d1e490e752f4a1ff1fd153c025cc455253d0e870008587050b22b1bbbc7
4
+ data.tar.gz: 0e15eaeac7ec1cb09662e7a7007e6d4d9b4957a3f2786e5a8fdcb5501925ab48
5
5
  SHA512:
6
- metadata.gz: 042f92be7a2842fb89210a84415ab810cb3d9f96d902f2ba1aa4c10da646012f35dda9e257b02cb0dd2486a432817e489b4d041a054ca291d5a4f8a13f824544
7
- data.tar.gz: 023f06de418a640ab2ae3b01997a0f1e8865d519cf0082d6bf48349350958437f40aa0087773800d9edd386ea9e907ae7949d00cb569ca0abc3801bd979c2bdf
6
+ metadata.gz: 98d8941ef4d9fa1e58ae97a7398b001c1ae129e30b0f9dbdfc91d2c97d6aefb3268f8c559d8de10cab8571bd4b3dfce1b1708afd6e084bc57ef8879705a26800
7
+ data.tar.gz: 92c25eedb4161b04edaaacdd026480292bb467a06bf76769241104abb6123d7ca7c31dfa4d6b750e6f19d81a16cd02b9df6cb3c29c3e42b2fe4e50ae15795ac8
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.rspec_status ADDED
@@ -0,0 +1,41 @@
1
+ example_id | status | run_time |
2
+ ----------------------------------------------------- | ------- | --------------- |
3
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:1:1] | passed | 0.00235 seconds |
4
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:1:2] | passed | 0.0002 seconds |
5
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:1:3] | passed | 0.00012 seconds |
6
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:2:1] | passed | 0.00018 seconds |
7
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:2:2] | passed | 0.00013 seconds |
8
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:3:1] | passed | 0.00012 seconds |
9
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:3:2] | passed | 0.00038 seconds |
10
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:4:1] | passed | 0.00044 seconds |
11
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:4:2] | passed | 0.00028 seconds |
12
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:5:1] | passed | 0.0007 seconds |
13
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:5:2] | passed | 0.0001 seconds |
14
+ ./spec/yf_as_dataframe/price_technical_spec.rb[1:6:1] | passed | 0.00015 seconds |
15
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:1:1] | passed | 0.00514 seconds |
16
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:1:2] | passed | 0.0001 seconds |
17
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:1:3] | passed | 0.00005 seconds |
18
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:2:1] | pending | 0.00001 seconds |
19
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:2:2] | pending | 0 seconds |
20
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:2:3] | pending | 0 seconds |
21
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:2:4] | pending | 0 seconds |
22
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:2:5] | pending | 0 seconds |
23
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:3:1:1] | pending | 0 seconds |
24
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:3:1:2] | pending | 0 seconds |
25
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:4:1] | passed | 0.00009 seconds |
26
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:4:2] | passed | 0.00006 seconds |
27
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:4:3] | passed | 0.00005 seconds |
28
+ ./spec/yf_as_dataframe/ticker_spec.rb[1:4:4] | passed | 0.00005 seconds |
29
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:1] | passed | 0.00053 seconds |
30
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:2] | passed | 0.00006 seconds |
31
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:3] | passed | 0.00008 seconds |
32
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:4] | passed | 0.00005 seconds |
33
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:5] | passed | 0.00004 seconds |
34
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:1:6] | passed | 0.00004 seconds |
35
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:2:1] | passed | 0.02723 seconds |
36
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:2:2] | passed | 0.00173 seconds |
37
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:2:3] | passed | 0.00137 seconds |
38
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:3:1] | passed | 0.00158 seconds |
39
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:4:1] | passed | 0.00071 seconds |
40
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:5:1] | passed | 0.00006 seconds |
41
+ ./spec/yf_as_dataframe/yf_connection_spec.rb[1:6:1] | passed | 0.00084 seconds |
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.6
data/CHANGELOG.rst CHANGED
@@ -0,0 +1,6 @@
1
+ 0.5.1
2
+ =====
3
+
4
+ * Document the Homebrew dependency ``curl-impersonate``. ``brew install curl-impersonate`` installs the Homebrew core formula, which builds lexiforest/curl-impersonate v2.3.2.
5
+ * Look for that formula's wrappers in the Homebrew prefix (``brew --prefix``/bin, ``/opt/homebrew/bin``, ``/usr/local/bin``, and ``/home/linuxbrew/.linuxbrew/bin``).
6
+ * Use the newest desktop Chrome wrapper from that install. ``CURL_IMPERSONATE_DIR`` still selects a different directory.
data/Gemfile CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ ruby "3.3.6"
6
+
5
7
  # Specify your gem's dependencies in yf_as_dataframe.gemspec
6
8
  gemspec
7
9
 
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yf_as_dataframe (0.4.0)
4
+ yf_as_dataframe (0.4.1)
5
5
  activesupport
6
6
  httparty
7
7
  nokogiri
8
- polars-df (~> 0.12.0)
8
+ polars-df (= 0.27.1)
9
9
  tulirb
10
10
  tzinfo
11
11
  tzinfo-data
@@ -14,86 +14,203 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (7.2.2.1)
17
+ activesupport (8.1.3.1)
18
18
  base64
19
- benchmark (>= 0.3)
20
19
  bigdecimal
21
20
  concurrent-ruby (~> 1.0, >= 1.3.1)
22
21
  connection_pool (>= 2.2.5)
23
22
  drb
24
23
  i18n (>= 1.6, < 2)
24
+ json
25
25
  logger (>= 1.4.2)
26
26
  minitest (>= 5.1)
27
27
  securerandom (>= 0.3)
28
28
  tzinfo (~> 2.0, >= 2.0.5)
29
+ uri (>= 0.13.1)
30
+ addressable (2.9.0)
31
+ public_suffix (>= 2.0.2, < 8.0)
29
32
  ast (2.4.3)
30
33
  base64 (0.3.0)
31
- benchmark (0.4.1)
32
- bigdecimal (3.2.2)
33
- concurrent-ruby (1.3.5)
34
- connection_pool (2.5.3)
35
- csv (3.3.5)
34
+ bigdecimal (4.1.2)
35
+ concurrent-ruby (1.3.8)
36
+ connection_pool (3.0.2)
37
+ crack (1.0.1)
38
+ bigdecimal
39
+ rexml
40
+ csv (3.3.6)
41
+ diff-lcs (1.6.2)
36
42
  drb (2.2.3)
37
- httparty (0.23.1)
43
+ hashdiff (1.2.1)
44
+ httparty (0.24.2)
38
45
  csv
39
46
  mini_mime (>= 1.0.0)
40
47
  multi_xml (>= 0.5.2)
41
- i18n (1.14.7)
48
+ i18n (1.15.2)
42
49
  concurrent-ruby (~> 1.0)
43
- json (2.12.2)
44
- language_server-protocol (3.17.0.5)
50
+ json (2.21.2)
51
+ language_server-protocol (3.17.0.6)
45
52
  lint_roller (1.1.0)
46
53
  logger (1.7.0)
47
54
  mini_mime (1.1.5)
48
- minitest (5.25.5)
49
- multi_xml (0.7.1)
50
- bigdecimal (~> 3.1)
51
- nokogiri (1.18.8-arm64-darwin)
55
+ minitest (6.0.6)
56
+ drb (~> 2.0)
57
+ prism (~> 1.5)
58
+ multi_xml (0.9.1)
59
+ bigdecimal (>= 3.1, < 5)
60
+ nokogiri (1.19.4-aarch64-linux-gnu)
61
+ racc (~> 1.4)
62
+ nokogiri (1.19.4-aarch64-linux-musl)
63
+ racc (~> 1.4)
64
+ nokogiri (1.19.4-arm64-darwin)
65
+ racc (~> 1.4)
66
+ nokogiri (1.19.4-x86_64-darwin)
52
67
  racc (~> 1.4)
53
- parallel (1.27.0)
54
- parser (3.3.8.0)
68
+ nokogiri (1.19.4-x86_64-linux-gnu)
69
+ racc (~> 1.4)
70
+ nokogiri (1.19.4-x86_64-linux-musl)
71
+ racc (~> 1.4)
72
+ parallel (2.1.0)
73
+ parser (3.3.12.0)
55
74
  ast (~> 2.4.1)
56
75
  racc
57
- polars-df (0.12.0-arm64-darwin)
58
- bigdecimal
59
- prism (1.4.0)
76
+ polars-df (0.27.1-aarch64-linux)
77
+ polars-df (0.27.1-aarch64-linux-musl)
78
+ polars-df (0.27.1-arm64-darwin)
79
+ polars-df (0.27.1-x86_64-darwin)
80
+ polars-df (0.27.1-x86_64-linux)
81
+ polars-df (0.27.1-x86_64-linux-musl)
82
+ prism (1.9.0)
83
+ public_suffix (7.0.5)
60
84
  racc (1.8.1)
61
85
  rainbow (3.1.1)
62
- rake (13.3.0)
63
- regexp_parser (2.10.0)
64
- rubocop (1.77.0)
65
- json (~> 2.3)
86
+ rake (13.4.2)
87
+ regexp_parser (2.12.0)
88
+ rexml (3.4.4)
89
+ rspec (3.13.2)
90
+ rspec-core (~> 3.13.0)
91
+ rspec-expectations (~> 3.13.0)
92
+ rspec-mocks (~> 3.13.0)
93
+ rspec-core (3.13.6)
94
+ rspec-support (~> 3.13.0)
95
+ rspec-expectations (3.13.5)
96
+ diff-lcs (>= 1.2.0, < 2.0)
97
+ rspec-support (~> 3.13.0)
98
+ rspec-mocks (3.13.8)
99
+ diff-lcs (>= 1.2.0, < 2.0)
100
+ rspec-support (~> 3.13.0)
101
+ rspec-support (3.13.7)
102
+ rubocop (1.90.0)
103
+ json (>= 2.3)
66
104
  language_server-protocol (~> 3.17.0.2)
67
105
  lint_roller (~> 1.1.0)
68
- parallel (~> 1.10)
106
+ parallel (>= 1.10)
69
107
  parser (>= 3.3.0.2)
70
108
  rainbow (>= 2.2.2, < 4.0)
71
109
  regexp_parser (>= 2.9.3, < 3.0)
72
- rubocop-ast (>= 1.45.1, < 2.0)
110
+ rubocop-ast (>= 1.49.0, < 2.0)
73
111
  ruby-progressbar (~> 1.7)
74
112
  unicode-display_width (>= 2.4.0, < 4.0)
75
- rubocop-ast (1.45.1)
113
+ rubocop-ast (1.50.0)
76
114
  parser (>= 3.3.7.2)
77
- prism (~> 1.4)
115
+ prism (~> 1.7)
78
116
  ruby-progressbar (1.13.0)
79
117
  securerandom (0.4.1)
80
118
  tulirb (1.0.0)
81
119
  tzinfo (2.0.6)
82
120
  concurrent-ruby (~> 1.0)
83
- tzinfo-data (1.2025.2)
121
+ tzinfo-data (1.2026.3)
84
122
  tzinfo (>= 1.0.0)
85
- unicode-display_width (3.1.4)
86
- unicode-emoji (~> 4.0, >= 4.0.4)
87
- unicode-emoji (4.0.4)
88
- zache (0.15.0)
123
+ unicode-display_width (3.2.0)
124
+ unicode-emoji (~> 4.1)
125
+ unicode-emoji (4.2.0)
126
+ uri (1.1.1)
127
+ vcr (6.4.0)
128
+ webmock (3.26.3)
129
+ addressable (>= 2.8.0)
130
+ crack (>= 0.3.2)
131
+ hashdiff (>= 0.4.0, < 2.0.0)
132
+ zache (0.15.2)
89
133
 
90
134
  PLATFORMS
91
- arm64-darwin-23
135
+ aarch64-linux
136
+ aarch64-linux-gnu
137
+ aarch64-linux-musl
138
+ arm64-darwin
139
+ x86_64-darwin
140
+ x86_64-linux-gnu
141
+ x86_64-linux-musl
92
142
 
93
143
  DEPENDENCIES
94
144
  rake (~> 13.0)
145
+ rspec (~> 3.13)
95
146
  rubocop (~> 1.21)
147
+ vcr (~> 6.2)
148
+ webmock (~> 3.23)
96
149
  yf_as_dataframe!
97
150
 
151
+ CHECKSUMS
152
+ activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
153
+ addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
154
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
155
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
156
+ bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
157
+ bundler (4.0.19) sha256=b48056e4c77fb3853cc47775b5447ede44aaa4f53c32f168014ab4fe86587d47
158
+ concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
159
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
160
+ crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
161
+ csv (3.3.6) sha256=aba61e7e507a66f03d45cb1f3c4b6359861c3504038b422962875dce099e4456
162
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
163
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
164
+ hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1
165
+ httparty (0.24.2) sha256=8fca6a54aa0c4aa4303a0fd33e5e2156175d6a5334f714263b458abd7fda9c38
166
+ i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
167
+ json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
168
+ language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
169
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
170
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
171
+ mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
172
+ minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
173
+ multi_xml (0.9.1) sha256=7ce766b59c17241ed62976caeae1fae9b2431b263398c35396239a68c4a64e57
174
+ nokogiri (1.19.4-aarch64-linux-gnu) sha256=1269fb644a6de405057a53dd5c762b1209b43ca7424f839454d3dbc677c31a8f
175
+ nokogiri (1.19.4-aarch64-linux-musl) sha256=35c65b9ce72b3bb03207bdbe7067915019dc18c1b9b59139684bd6690fdd01af
176
+ nokogiri (1.19.4-arm64-darwin) sha256=a46db9853286e6597b36ebc6953817d15acf3a299583eb3f89fdc6f91dd63527
177
+ nokogiri (1.19.4-x86_64-darwin) sha256=7fd17057d3e1f00e9954a74b3cd76595d3d4a5ef233b7ed9599047c204f70551
178
+ nokogiri (1.19.4-x86_64-linux-gnu) sha256=379fae440b28915e3f19d752ce2dcf8465ed2b2fbefd2a7ca0dd497bc981a06a
179
+ nokogiri (1.19.4-x86_64-linux-musl) sha256=17dfb7c1fa194ae02fbf7c51a7afc8d278045ab3fdacfd86f91d02d7b274470b
180
+ parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
181
+ parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828
182
+ polars-df (0.27.1-aarch64-linux) sha256=d85cedc6574fc66b1084a72380243ee73e7f8e6cdcf098c08c929dfafb429c83
183
+ polars-df (0.27.1-aarch64-linux-musl) sha256=e70f9b19453707be8e951b87b6a119e50e4cb8461e550f13568e655a52ae0c81
184
+ polars-df (0.27.1-arm64-darwin) sha256=e059d3a0f53e9d3a3484396c58ef42801d463becc4af632adf78a606d1117f97
185
+ polars-df (0.27.1-x86_64-darwin) sha256=cf8389bd81ec0e3ed7bbf8aa7078de88bcb72ebae445cbc52d4619ade6dfb181
186
+ polars-df (0.27.1-x86_64-linux) sha256=3cb35fe50bfd783845976e6bc567a560d547dbded8a96887a2d5a658d01396e2
187
+ polars-df (0.27.1-x86_64-linux-musl) sha256=6ad62495e0385df6305368bdd45d61b1baea2193f269737fbe03ed4fe4236595
188
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
189
+ public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
190
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
191
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
192
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
193
+ regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
194
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
195
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
196
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
197
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
198
+ rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
199
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
200
+ rubocop (1.90.0) sha256=9eb4c065b5c5154e4ef554c547972f3905a9eb6b53e657e580b6796b54bf8242
201
+ rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
202
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
203
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
204
+ tulirb (1.0.0) sha256=5f2f9889976014581801106f3ef21ff63ab94a9c1d291557e7dfdf8871c73379
205
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
206
+ tzinfo-data (1.2026.3) sha256=478fbc5356f13c1004cf8372b1336f3dad4055c96340fc4c881a3738da8cf7f9
207
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
208
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
209
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
210
+ vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6
211
+ webmock (3.26.3) sha256=77c612816bdcb2fc43db0e42fd98b19be7d4770fd708816fdde65a006664ddec
212
+ yf_as_dataframe (0.4.1)
213
+ zache (0.15.2) sha256=0192d9fe0081e6c83ec051630f3347d8692a7309094066b9aadaa481175707bd
214
+
98
215
  BUNDLED WITH
99
- 2.6.9
216
+ 4.0.19
@@ -6,15 +6,23 @@ This is a minimal integration that makes curl-impersonate the **default behavior
6
6
 
7
7
  ## Installation
8
8
 
9
- ### 1. Install curl-impersonate
9
+ ### 1. Install curl-impersonate from Homebrew
10
+
11
+ Homebrew core packages [lexiforest/curl-impersonate](https://github.com/lexiforest/curl-impersonate) v2.3.2. The formula is [Homebrew/homebrew-core Formula/c/curl-impersonate.rb](https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/curl-impersonate.rb).
10
12
 
11
13
  ```bash
12
- # macOS
13
- brew tap shakacode/brew
14
14
  brew install curl-impersonate
15
15
 
16
- # Verify installation
17
- ls -la /usr/local/bin/curl_*
16
+ # Apple Silicon wrappers are in /opt/homebrew/bin.
17
+ # Intel Homebrew uses /usr/local/bin.
18
+ # Linux Homebrew uses /home/linuxbrew/.linuxbrew/bin.
19
+ ls "$(brew --prefix)/bin"/curl_chrome*
20
+ ```
21
+
22
+ Bottles are published for Apple Silicon and Linux. An Intel Mac builds the formula from source. Lexiforest's own tap installs its v2.3.1 release archives instead of building current core:
23
+
24
+ ```bash
25
+ brew install lexiforest/tap/curl-impersonate
18
26
  ```
19
27
 
20
28
  ### 2. Custom Installation Directory (Optional)
@@ -29,7 +37,7 @@ export CURL_IMPERSONATE_DIR="/opt/curl-impersonate/bin"
29
37
  CURL_IMPERSONATE_DIR="/opt/curl-impersonate/bin" ruby your_script.rb
30
38
  ```
31
39
 
32
- The default directory is `/usr/local/bin` if the environment variable is not set.
40
+ When `CURL_IMPERSONATE_DIR` is unset, the gem searches `brew --prefix`/bin, `/opt/homebrew/bin`, `/usr/local/bin`, and `/home/linuxbrew/.linuxbrew/bin`. It uses the newest desktop Chrome wrapper in those directories.
33
41
 
34
42
  ### 3. Add Integration Files
35
43
 
@@ -100,10 +108,10 @@ puts "Using directory: #{YfAsDataframe::CurlImpersonateIntegration.executable_di
100
108
  - No new method names to learn
101
109
  - No changes to method signatures
102
110
 
103
- ### ✅ **Automatic Browser Rotation**
104
- - Randomly selects from available curl-impersonate executables
105
- - Supports Chrome, Firefox, Edge, and Safari configurations
106
- - Automatically adapts to new browser versions
111
+ ### ✅ **Current browser wrapper**
112
+ - Uses the newest desktop Chrome wrapper installed by Homebrew
113
+ - Supports Chrome, Firefox, Edge, and Safari wrapper names from lexiforest
114
+ - Follows newer browser wrappers as the Homebrew formula updates
107
115
 
108
116
  ### ✅ **Robust Fallback**
109
117
  - Falls back to HTTParty if curl-impersonate fails
@@ -117,7 +125,7 @@ puts "Using directory: #{YfAsDataframe::CurlImpersonateIntegration.executable_di
117
125
 
118
126
  ### ✅ **Environment Variable Support**
119
127
  - Set `CURL_IMPERSONATE_DIR` to customize installation directory
120
- - Defaults to `/usr/local/bin` if not set
128
+ - Otherwise searches the Homebrew prefix (`brew --prefix`/bin, `/opt/homebrew/bin`, `/usr/local/bin`, `/home/linuxbrew/.linuxbrew/bin`)
121
129
  - Supports both persistent and per-command configuration
122
130
 
123
131
  ## Example
@@ -156,21 +164,21 @@ end
156
164
 
157
165
  ### "No curl-impersonate executables found"
158
166
  ```bash
159
- # Check if executables exist in default location
160
- ls -la /usr/local/bin/curl_*
167
+ # Wrappers installed by Homebrew core
168
+ ls -la "$(brew --prefix)/bin"/curl_*
161
169
 
162
- # Check if executables exist in custom location
170
+ # Custom directory
163
171
  ls -la $CURL_IMPERSONATE_DIR/curl_*
164
172
 
165
- # If not found, reinstall curl-impersonate
166
- brew reinstall curl-impersonate
173
+ # Install the Homebrew core formula
174
+ brew install curl-impersonate
167
175
  ```
168
176
 
169
177
  ### Permission errors
170
178
  ```bash
171
- sudo chmod +x /usr/local/bin/curl_*
179
+ chmod +x "$(brew --prefix)/bin"/curl_*
172
180
  # or
173
- sudo chmod +x $CURL_IMPERSONATE_DIR/curl_*
181
+ chmod +x $CURL_IMPERSONATE_DIR/curl_*
174
182
  ```
175
183
 
176
184
  ### Still getting blocked
@@ -193,7 +201,7 @@ puts "Directory: #{YfAsDataframe::CurlImpersonateIntegration.executable_director
193
201
  | `curl_impersonate_enabled` | `true` | Use curl-impersonate for requests |
194
202
  | `curl_impersonate_fallback` | `true` | Fall back to HTTParty if curl-impersonate fails |
195
203
  | `curl_impersonate_timeout` | `30` | Timeout in seconds for curl-impersonate requests |
196
- | `CURL_IMPERSONATE_DIR` | `/usr/local/bin` | Directory containing curl-impersonate executables |
204
+ | `CURL_IMPERSONATE_DIR` | Homebrew prefix, then `/opt/homebrew/bin`, `/usr/local/bin`, `/home/linuxbrew/.linuxbrew/bin` | Directory containing curl-impersonate wrappers |
197
205
 
198
206
  ## Benefits
199
207
 
@@ -224,4 +232,4 @@ puts "Directory: #{YfAsDataframe::CurlImpersonateIntegration.executable_director
224
232
  4. **Add the require statements** to your code
225
233
  5. **Test with your existing code** - it should work immediately
226
234
 
227
- That's it! Your existing Yahoo Finance scraping code will now automatically use curl-impersonate to bypass TLS fingerprinting.
235
+ That's it! Your existing Yahoo Finance scraping code will now automatically use curl-impersonate to bypass TLS fingerprinting.
data/README.md CHANGED
@@ -30,6 +30,28 @@ Yahoo! finance API is intended for personal use only.**
30
30
 
31
31
  This package provides for pulling data from Yahoo!'s unofficial API, and providing that data using using [Polars](https://github.com/ankane/ruby-polars?tab=readme-ov-file) dataframes in ruby. Data in those dataframes can then be easily post-processed using technical indicators provided by [Tulip](https://tulipindicators.org/) via [Tulirb's](https://www.rubydoc.info/github/ozone4real/tulirb/main/Tulirb) ruby bindings, and visualized using [Vega](https://github.com/ankane/vega-ruby).
32
32
 
33
+ ## Requirements
34
+
35
+ - **Ruby**: >= 3.3
36
+ - **polars-df**: 0.27.1
37
+ - **curl-impersonate**, from Homebrew:
38
+
39
+ ```bash
40
+ brew install curl-impersonate
41
+ ```
42
+
43
+ That is the [Homebrew core formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/curl-impersonate.rb). It builds [lexiforest/curl-impersonate](https://github.com/lexiforest/curl-impersonate) v2.3.2 (curl 8.23.0, with current Chrome, Firefox, Safari, and Edge wrappers). Bottles are published for Apple Silicon and Linux. An Intel Mac builds the formula from source.
44
+
45
+ Homebrew puts `curl-impersonate` and the `curl_chrome*`, `curl_firefox*`, `curl_safari*`, and `curl_edge*` wrappers on the prefix `bin` directory:
46
+
47
+ | Install | Wrapper directory |
48
+ | --- | --- |
49
+ | Apple Silicon | `/opt/homebrew/bin` |
50
+ | Intel Homebrew | `/usr/local/bin` |
51
+ | Linux Homebrew | `/home/linuxbrew/.linuxbrew/bin` |
52
+
53
+ The gem asks `brew --prefix` for that directory and also checks the three paths above. `CURL_IMPERSONATE_DIR` replaces that search when the binaries live somewhere else. Requests use the newest desktop Chrome wrapper in the directory (for example `curl_chrome152`). When no wrapper is installed, requests fall back to HTTParty.
54
+
33
55
  ### Quick Start: The Ticker module
34
56
 
35
57
  The `Ticker` class, which allows you to access ticker data from Yahoo!'s unofficial API:
@@ -199,33 +221,25 @@ YfAsDataframe.zlema(df, column: 'Adj Close', window: 5)
199
221
 
200
222
  ## TLS Fingerprinting Protection
201
223
 
202
- **New in v0.4.0**: This gem now includes built-in support for [curl-impersonate](https://github.com/lwthiker/curl-impersonate). The curl-impersonate integration is **enabled by default** in v0.4.0+. Existing code will automatically use curl-impersonate to bypass TLS fingerprinting:
224
+ Yahoo requests use the Homebrew `curl-impersonate` dependency described above. The integration is loaded with the gem. The selected wrapper supplies the browser TLS fingerprint and the `User-Agent`, `Accept`, `Accept-Language`, and `Accept-Encoding` headers. The gem adds the Yahoo cookie and any other request headers.
203
225
 
204
- ### Installation Requirements
205
-
206
- To use the TLS fingerprinting protection, you need to install curl-impersonate:
226
+ Confirm the install:
207
227
 
208
228
  ```bash
209
- # macOS
210
- brew tap shakacode/brew
211
- brew install curl-impersonate
212
-
213
- # Verify installation
214
- ls -la /usr/local/bin/curl_*
229
+ brew --prefix curl-impersonate
230
+ ls "$(brew --prefix)/bin"/curl_chrome*
215
231
  ```
216
232
 
217
- ### Custom Installation Directory
218
-
219
- The codebase will look for the location of the curl-impersonate binaries per the `CURL_IMPERSONATE_DIR` environment variable;
220
- if it is not assigned, the default location of the binaries is `/usr/local/bin`.
221
- The code will randomly select one of the binaries (expected to be named "curl_chrome*", "curl_ff*", "curl_edge*", etc.) for its communications with the servers.
233
+ ### Custom installation directory
222
234
 
223
235
  ```bash
224
- # Set custom directory
225
236
  export CURL_IMPERSONATE_DIR="/opt/curl-impersonate/bin"
237
+ ```
226
238
 
227
- # Or set it for a single command
228
- CURL_IMPERSONATE_DIR="/opt/curl-impersonate/bin" ruby your_script.rb
239
+ Lexiforest also publishes release archives through its own tap, one version behind Homebrew core:
240
+
241
+ ```bash
242
+ brew install lexiforest/tap/curl-impersonate
229
243
  ```
230
244
 
231
245
  ### Configuration (Optional)
@@ -329,6 +343,65 @@ Or install it yourself as:
329
343
 
330
344
  ---
331
345
 
346
+ ## Testing
347
+
348
+ This gem includes a comprehensive test suite using RSpec. Tests use WebMock and VCR to mock HTTP requests, ensuring tests run without hitting the live Yahoo Finance API.
349
+
350
+ ### Running Tests Locally
351
+
352
+ To run the full test suite:
353
+
354
+ ```bash
355
+ bundle install
356
+ bundle exec rspec
357
+ ```
358
+
359
+ To run tests with documentation format:
360
+
361
+ ```bash
362
+ bundle exec rspec --format documentation
363
+ ```
364
+
365
+ To run specific test files:
366
+
367
+ ```bash
368
+ bundle exec rspec spec/yf_as_dataframe/ticker_spec.rb
369
+ bundle exec rspec spec/yf_as_dataframe/yf_connection_spec.rb
370
+ ```
371
+
372
+ ### Running Rake Tasks
373
+
374
+ The default rake task runs both tests and RuboCop:
375
+
376
+ ```bash
377
+ bundle exec rake
378
+ ```
379
+
380
+ Run only tests:
381
+
382
+ ```bash
383
+ bundle exec rake spec
384
+ ```
385
+
386
+ Run only RuboCop:
387
+
388
+ ```bash
389
+ bundle exec rake rubocop
390
+ ```
391
+
392
+ ### Test Coverage
393
+
394
+ The test suite covers:
395
+
396
+ - **Ticker#history**: Historical price data retrieval with mocked HTTP responses
397
+ - **YfConnection**: User-Agent headers, cookie management, circuit breaker, and request throttling
398
+ - **Technical Indicators**: SMA, EMA, RSI, OBV, and other price technical indicators
399
+ - **Error Handling**: Invalid symbols, network failures, and malformed responses
400
+
401
+ Tests are designed to run offline using fixtures, avoiding live network requests and ensuring consistent, fast test execution.
402
+
403
+ ---
404
+
332
405
  ## Development
333
406
 
334
407
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -353,4 +426,4 @@ intended for research and educational purposes. You should refer to Yahoo!'s ter
353
426
  [here](https://policies.yahoo.com/us/en/yahoo/terms/index.htm)) for
354
427
  details on your rights to use the actual data downloaded.
355
428
 
356
- ---
429
+ ---
data/Rakefile CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rubocop/rake_task"
5
+ require "rspec/core/rake_task"
5
6
 
6
7
  RuboCop::RakeTask.new
8
+ RSpec::Core::RakeTask.new(:spec)
7
9
 
8
- task default: :rubocop
10
+ task default: %i[spec rubocop]
@@ -5,6 +5,26 @@ require 'timeout'
5
5
 
6
6
  class YfAsDataframe
7
7
  module CurlImpersonateIntegration
8
+ # Homebrew core formula: https://github.com/Homebrew/homebrew-core/blob/master/Formula/c/curl-impersonate.rb
9
+ # That formula builds lexiforest/curl-impersonate (v2.3.2).
10
+ HOMEBREW_FORMULA = "curl-impersonate"
11
+ HOMEBREW_UPSTREAM = "https://github.com/lexiforest/curl-impersonate"
12
+
13
+ # Prefixes used when `brew --prefix` is unavailable.
14
+ DEFAULT_BIN_DIRECTORIES = [
15
+ "/opt/homebrew/bin",
16
+ "/usr/local/bin",
17
+ "/home/linuxbrew/.linuxbrew/bin"
18
+ ].freeze
19
+
20
+ # Headers owned by the curl_* wrapper. Passing another User-Agent would
21
+ # disagree with the TLS fingerprint of the selected browser.
22
+ FINGERPRINT_HEADERS = %w[user-agent accept accept-language accept-encoding].freeze
23
+
24
+ WRAPPER_PATTERN = /\Acurl_(chrome|firefox|ff|edge|safari)(\d+)[a-z]?(?:_([a-z0-9]+))?\z/
25
+ BROWSER_RANK = { chrome: 0, edge: 1, safari: 2, firefox: 3 }.freeze
26
+ VARIANT_RANK = { nil => 0, "macos" => 1, "ios" => 2, "android" => 3 }.freeze
27
+
8
28
  # Configuration
9
29
  @curl_impersonate_enabled = true
10
30
  @curl_impersonate_fallback = true
@@ -15,48 +35,56 @@ class YfAsDataframe
15
35
  @curl_impersonate_process_timeout = 60 # New: process timeout protection
16
36
 
17
37
  class << self
18
- attr_accessor :curl_impersonate_enabled, :curl_impersonate_fallback,
38
+ attr_accessor :curl_impersonate_enabled, :curl_impersonate_fallback,
19
39
  :curl_impersonate_timeout, :curl_impersonate_connect_timeout,
20
40
  :curl_impersonate_retries, :curl_impersonate_retry_delay,
21
41
  :curl_impersonate_process_timeout
22
42
  end
23
43
 
24
- # Get the curl-impersonate executable directory from environment variable or default
44
+ # Directory of the wrapper that will be used, or the first directory searched.
25
45
  def self.executable_directory
26
- ENV['CURL_IMPERSONATE_DIR'] || '/usr/local/bin'
46
+ selected = selected_executable
47
+ return File.dirname(selected[:path]) if selected
48
+
49
+ executable_directories.first || "/usr/local/bin"
50
+ end
51
+
52
+ # CURL_IMPERSONATE_DIR when set, otherwise the Homebrew prefix and the usual prefixes.
53
+ def self.executable_directories
54
+ configured = ENV["CURL_IMPERSONATE_DIR"].to_s
55
+ return [configured] unless configured.empty?
56
+
57
+ directories = []
58
+ prefix = _homebrew_prefix
59
+ directories << File.join(prefix, "bin") if prefix && !prefix.empty?
60
+ directories.concat(DEFAULT_BIN_DIRECTORIES)
61
+ directories.uniq
27
62
  end
28
63
 
29
- # Find available curl-impersonate executables
64
+ # Browser wrappers found in executable_directories.
30
65
  def self.available_executables
31
- @available_executables ||= begin
32
- executables = []
33
- Dir.glob(File.join(executable_directory, "curl_*")).each do |path|
34
- executable = File.basename(path)
35
- if executable.start_with?('curl_')
36
- browser_type = case executable
37
- when /^curl_chrome/ then :chrome
38
- when /^curl_ff/ then :firefox
39
- when /^curl_edge/ then :edge
40
- when /^curl_safari/ then :safari
41
- else :unknown
42
- end
43
- executables << { path: path, executable: executable, browser: browser_type }
44
- end
45
- end
46
- executables
66
+ @available_executables ||= executable_directories.flat_map { |dir| _wrappers_in(dir) }
67
+ end
68
+
69
+ # Newest desktop Chrome wrapper. Edge, Safari, then Firefox are used when no Chrome wrapper is installed.
70
+ def self.selected_executable
71
+ available_executables.min_by do |executable|
72
+ [
73
+ BROWSER_RANK.fetch(executable[:browser], 9),
74
+ -executable[:version].to_i,
75
+ VARIANT_RANK.fetch(executable[:variant], 4),
76
+ executable[:executable]
77
+ ]
47
78
  end
48
79
  end
49
80
 
50
- # Get a random executable
51
- def self.get_random_executable
52
- available = available_executables
53
- return nil if available.empty?
54
- available.sample
81
+ def self.reset_executable_cache!
82
+ @available_executables = nil
55
83
  end
56
84
 
57
85
  # Make a curl-impersonate request with improved timeout handling
58
86
  def self.make_request(url, headers: {}, params: {}, timeout: nil, retries: nil)
59
- executable_info = get_random_executable
87
+ executable_info = selected_executable
60
88
  return nil unless executable_info
61
89
 
62
90
  timeout ||= @curl_impersonate_timeout
@@ -73,20 +101,17 @@ class YfAsDataframe
73
101
  "--silent",
74
102
  "--show-error"
75
103
  ]
76
- headers.each { |key, value| cmd.concat(["-H", "#{key}: #{value}"]) }
104
+ _request_headers(headers).each { |key, value| cmd.concat(["-H", "#{key}: #{value}"]) }
77
105
  unless params.empty?
78
- query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
79
- separator = url.include?('?') ? '&' : '?'
106
+ query_string = params.map { |k, v| "#{k}=#{v}" }.join("&")
107
+ separator = url.include?("?") ? "&" : "?"
80
108
  url = "#{url}#{separator}#{query_string}"
81
109
  end
82
110
  cmd << url
83
111
 
84
- # puts "DEBUG: curl-impersonate command: #{cmd.join(' ')}"
85
- # puts "DEBUG: curl-impersonate timeout: #{timeout} seconds"
86
-
87
112
  begin
88
- stdout_str = ''
89
- stderr_str = ''
113
+ stdout_str = ""
114
+ stderr_str = ""
90
115
  status = nil
91
116
  Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr|
92
117
  stdin.close
@@ -95,10 +120,9 @@ class YfAsDataframe
95
120
  monitor = Thread.new do
96
121
  sleep(timeout + 10)
97
122
  unless done
98
- # puts "DEBUG: Killing curl-impersonate PID \\#{pid} after timeout"
99
- Process.kill('TERM', pid) rescue nil
123
+ Process.kill("TERM", pid) rescue nil
100
124
  sleep(1)
101
- Process.kill('KILL', pid) rescue nil if wait_thr.alive?
125
+ Process.kill("KILL", pid) rescue nil if wait_thr.alive?
102
126
  end
103
127
  end
104
128
  stdout_str = stdout.read
@@ -107,33 +131,82 @@ class YfAsDataframe
107
131
  done = true
108
132
  monitor.kill
109
133
  end
110
- # puts "DEBUG: curl-impersonate stdout: #{stdout_str[0..200]}..." if stdout_str && !stdout_str.empty?
111
- # puts "DEBUG: curl-impersonate stderr: #{stderr_str}" if stderr_str && !stderr_str.empty?
112
- # puts "DEBUG: curl-impersonate status: #{status.exitstatus}"
113
134
  if status.success?
114
135
  response = OpenStruct.new
115
- response.body = stdout_str
136
+ response.body = stdout_str
116
137
  response.code = 200
117
138
  response.define_singleton_method(:success?) { true }
118
- response.parsed_response = parse_json_if_possible(stdout_str)
139
+ response.parsed_response = _parse_json_if_possible(stdout_str)
119
140
  response
120
141
  else
121
- # puts "DEBUG: curl-impersonate failed with error: \\#{error_message}"
122
- error_message = "curl failed with code \\#{status.exitstatus}: \\#{stderr_str}"
123
142
  nil
124
143
  end
125
- rescue => e
126
- # puts "DEBUG: curl-impersonate exception: \\#{e.message}"
144
+ rescue StandardError
127
145
  nil
128
146
  end
129
147
  end
130
148
 
131
- private
149
+ def self._wrappers_in(directory)
150
+ return [] unless File.directory?(directory)
151
+
152
+ Dir.glob(File.join(directory, "curl_*")).filter_map do |path|
153
+ next unless File.file?(path) && File.executable?(path)
154
+
155
+ _describe_wrapper(path)
156
+ end
157
+ end
158
+ private_class_method :_wrappers_in
159
+
160
+ def self._describe_wrapper(path)
161
+ match = File.basename(path).match(WRAPPER_PATTERN)
162
+ return nil unless match
163
+
164
+ family = match[1] == "ff" ? "firefox" : match[1]
165
+ {
166
+ path: path,
167
+ executable: File.basename(path),
168
+ browser: family.to_sym,
169
+ version: match[2].to_i,
170
+ variant: match[3]
171
+ }
172
+ end
173
+ private_class_method :_describe_wrapper
174
+
175
+ def self._request_headers(headers)
176
+ headers.each_with_object({}) do |(key, value), kept|
177
+ next if FINGERPRINT_HEADERS.include?(key.to_s.downcase)
178
+
179
+ kept[key] = value
180
+ end
181
+ end
182
+ private_class_method :_request_headers
183
+
184
+ def self._homebrew_prefix
185
+ return @homebrew_prefix if defined?(@homebrew_prefix)
186
+
187
+ brew = _which("brew")
188
+ @homebrew_prefix =
189
+ if brew
190
+ out, status = Open3.capture2(brew, "--prefix")
191
+ status.success? ? out.strip : nil
192
+ end
193
+ end
194
+ private_class_method :_homebrew_prefix
195
+
196
+ def self._which(command)
197
+ ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |dir|
198
+ candidate = File.join(dir, command)
199
+ return candidate if File.executable?(candidate) && !File.directory?(candidate)
200
+ end
201
+ nil
202
+ end
203
+ private_class_method :_which
132
204
 
133
- def self.parse_json_if_possible(response_body)
205
+ def self._parse_json_if_possible(response_body)
134
206
  JSON.parse(response_body)
135
207
  rescue JSON::ParserError
136
208
  response_body
137
209
  end
210
+ private_class_method :_parse_json_if_possible
138
211
  end
139
- end
212
+ end
@@ -395,7 +395,7 @@ class YfAsDataframe
395
395
  end
396
396
 
397
397
  def rsi(df, window: 20)
398
- return nil if w == 1
398
+ return nil if window == 1
399
399
  inputs = ['Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
400
400
  output = Tulirb.rsi(inputs, period: window).first
401
401
  Polars::Series.new("#{window}-day RSI", [nil]*(df.rows.length - output.length)+output) #)
@@ -1,3 +1,3 @@
1
1
  class YfAsDataframe
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -55,7 +55,7 @@ class YfAsDataframe
55
55
  retries: CurlImpersonateIntegration.curl_impersonate_retries
56
56
  )
57
57
 
58
- if response && !response.empty?
58
+ if response&.success?
59
59
  # puts "DEBUG: curl-impersonate succeeded"
60
60
  return response
61
61
  else
@@ -69,14 +69,9 @@ class YfAsDataframe
69
69
  # puts "DEBUG: curl-impersonate is disabled, skipping to fallback"
70
70
  end
71
71
 
72
- # Fallback to original HTTParty method
73
- if CurlImpersonateIntegration.curl_impersonate_fallback
74
- # puts "DEBUG: Using HTTParty fallback"
75
- return HTTParty.get(url, headers: headers).body
76
- else
77
- # puts "DEBUG: Fallback is disabled, but forcing fallback anyway"
78
- return HTTParty.get(url, headers: headers).body
79
- end
72
+ # Fallback to the original HTTParty method. A missing Homebrew install
73
+ # takes this path so requests still run.
74
+ get_original(url, headers, params)
80
75
  end
81
76
 
82
77
  # get_raw_json uses get, so it automatically gets curl-impersonate behavior
@@ -125,4 +120,4 @@ class YfAsDataframe
125
120
  end
126
121
  end
127
122
  end
128
- end
123
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yf_as_dataframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill McKinnon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-07 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: polars-df
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.12.0
47
+ version: 0.27.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.12.0
54
+ version: 0.27.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: zache
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,76 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.13'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.13'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.23'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.23'
153
+ - !ruby/object:Gem::Dependency
154
+ name: vcr
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '6.2'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '6.2'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rake
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '13.0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '13.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.21'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.21'
125
195
  description: Download market data from Yahoo! Finance's API
126
196
  email:
127
197
  - bill@bmck.org
@@ -129,7 +199,10 @@ executables: []
129
199
  extensions: []
130
200
  extra_rdoc_files: []
131
201
  files:
202
+ - ".rspec"
203
+ - ".rspec_status"
132
204
  - ".rubocop.yml"
205
+ - ".ruby-version"
133
206
  - CHANGELOG.rst
134
207
  - CODE_OF_CONDUCT.md
135
208
  - Gemfile
@@ -171,14 +244,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
244
  requirements:
172
245
  - - ">="
173
246
  - !ruby/object:Gem::Version
174
- version: 3.0.0
247
+ version: '3.3'
175
248
  required_rubygems_version: !ruby/object:Gem::Requirement
176
249
  requirements:
177
250
  - - ">="
178
251
  - !ruby/object:Gem::Version
179
252
  version: '0'
180
- requirements: []
181
- rubygems_version: 3.1.6
253
+ requirements:
254
+ - 'curl-impersonate (Homebrew): brew install curl-impersonate'
255
+ rubygems_version: 3.5.22
182
256
  signing_key:
183
257
  specification_version: 4
184
258
  summary: A shameless port of python's yfinance module to ruby