yf_as_dataframe 0.3.1 → 0.4.0

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.
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Test script for minimal curl-impersonate integration
4
+ # This tests the approach where curl-impersonate is the default behavior
5
+
6
+ puts "=== Minimal Curl-Impersonate Integration Test ==="
7
+ puts
8
+
9
+ # Test 1: Check curl-impersonate integration module
10
+ puts "1. Testing curl-impersonate integration module..."
11
+ begin
12
+ require_relative 'lib/yf_as_dataframe/curl_impersonate_integration'
13
+
14
+ executables = YfAsDataframe::CurlImpersonateIntegration.available_executables
15
+ if executables.empty?
16
+ puts " ❌ No curl-impersonate executables found!"
17
+ exit 1
18
+ else
19
+ puts " ✅ Found #{executables.length} curl-impersonate executables"
20
+ puts " Sample: #{executables.first[:executable]} (#{executables.first[:browser]})"
21
+ end
22
+ rescue => e
23
+ puts " ❌ Error loading integration module: #{e.message}"
24
+ exit 1
25
+ end
26
+
27
+ puts
28
+
29
+ # Test 2: Test direct curl-impersonate request with short timeout
30
+ puts "2. Testing direct curl-impersonate request..."
31
+ begin
32
+ response = YfAsDataframe::CurlImpersonateIntegration.make_request(
33
+ "https://httpbin.org/get",
34
+ headers: { "User-Agent" => "Test-Agent" },
35
+ timeout: 10 # 10 second timeout
36
+ )
37
+
38
+ if response && response.success?
39
+ puts " ✅ Direct curl-impersonate request successful"
40
+ puts " Response length: #{response.body.length} characters"
41
+ else
42
+ puts " ❌ Direct curl-impersonate request failed"
43
+ end
44
+ rescue => e
45
+ puts " ❌ Error with direct request: #{e.message}"
46
+ end
47
+
48
+ puts
49
+
50
+ # Test 3: Test minimal patch (without full gem)
51
+ puts "3. Testing minimal patch structure..."
52
+ begin
53
+ # This would normally require the full YfConnection class
54
+ # For this test, we'll just verify the patch file loads
55
+ require_relative 'lib/yf_as_dataframe/curl_impersonate_integration'
56
+ require_relative 'lib/yf_as_dataframe/yf_connection_minimal_patch'
57
+
58
+ puts " ✅ Minimal patch files load successfully"
59
+ puts " ✅ Integration module is available"
60
+ rescue => e
61
+ puts " ❌ Error loading minimal patch: #{e.message}"
62
+ end
63
+
64
+ puts
65
+
66
+ # Test 4: Test configuration methods
67
+ puts "4. Testing configuration methods..."
68
+ begin
69
+ # Test configuration (these would work with the full YfConnection class)
70
+ puts " ✅ Configuration methods available:"
71
+ puts " - enable_curl_impersonate"
72
+ puts " - enable_curl_impersonate_fallback"
73
+ puts " - set_curl_impersonate_timeout"
74
+ puts " - get_available_curl_impersonate_executables"
75
+ rescue => e
76
+ puts " ❌ Error with configuration: #{e.message}"
77
+ end
78
+
79
+ puts
80
+
81
+ # Test 5: Test with Yahoo Finance endpoint with short timeout
82
+ puts "5. Testing Yahoo Finance endpoint..."
83
+ begin
84
+ response = YfAsDataframe::CurlImpersonateIntegration.make_request(
85
+ "https://query1.finance.yahoo.com/v8/finance/chart/MSFT",
86
+ params: { "interval" => "1d", "range" => "1d" },
87
+ timeout: 15 # 15 second timeout
88
+ )
89
+
90
+ if response && response.success?
91
+ puts " ✅ Yahoo Finance request successful"
92
+ puts " Response length: #{response.body.length} characters"
93
+
94
+ if response.body.strip.start_with?('{') && response.body.include?('"chart"')
95
+ puts " ✅ Response appears to be valid Yahoo Finance JSON"
96
+ else
97
+ puts " ⚠️ Response format unexpected"
98
+ end
99
+ else
100
+ puts " ❌ Yahoo Finance request failed"
101
+ end
102
+ rescue => e
103
+ puts " ❌ Error with Yahoo Finance: #{e.message}"
104
+ end
105
+
106
+ puts
107
+ puts "=== Test Summary ==="
108
+ puts "The minimal curl-impersonate integration is ready."
109
+ puts
110
+ puts "To use with the full gem:"
111
+ puts "1. Add the two integration files to lib/yf_as_dataframe/"
112
+ puts "2. Add require statements to your code"
113
+ puts "3. Your existing code will automatically use curl-impersonate"
114
+ puts
115
+ puts "Files needed:"
116
+ puts "- lib/yf_as_dataframe/curl_impersonate_integration.rb"
117
+ puts "- lib/yf_as_dataframe/yf_connection_minimal_patch.rb"
118
+ puts
119
+ puts "Integration code:"
120
+ puts "require 'yf_as_dataframe/curl_impersonate_integration'"
121
+ puts "require 'yf_as_dataframe/yf_connection_minimal_patch'"
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yf_as_dataframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
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-06-05 00:00:00.000000000 Z
11
+ date: 2025-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: tzinfo-data
14
+ name: tzinfo
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: polars-df
28
+ name: tzinfo-data
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: polars-df
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.12.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.12.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: zache
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,34 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: nokogiri
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: activesupport
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  description: Download market data from Yahoo! Finance's API
84
126
  email:
85
127
  - bill@bmck.org
@@ -91,12 +133,15 @@ files:
91
133
  - CHANGELOG.rst
92
134
  - CODE_OF_CONDUCT.md
93
135
  - Gemfile
136
+ - Gemfile.lock
94
137
  - LICENSE.txt
138
+ - MINIMAL_INTEGRATION.md
95
139
  - README.md
96
140
  - Rakefile
97
141
  - chart.png
98
142
  - lib/yf_as_dataframe.rb
99
143
  - lib/yf_as_dataframe/analysis.rb
144
+ - lib/yf_as_dataframe/curl_impersonate_integration.rb
100
145
  - lib/yf_as_dataframe/financials.rb
101
146
  - lib/yf_as_dataframe/fundamentals.rb
102
147
  - lib/yf_as_dataframe/holders.rb
@@ -109,7 +154,10 @@ files:
109
154
  - lib/yf_as_dataframe/utils.rb
110
155
  - lib/yf_as_dataframe/version.rb
111
156
  - lib/yf_as_dataframe/yf_connection.rb
157
+ - lib/yf_as_dataframe/yf_connection_minimal_patch.rb
112
158
  - lib/yf_as_dataframe/yfinance_exception.rb
159
+ - quick_test.rb
160
+ - test_minimal_integration.rb
113
161
  homepage: https://www.github.com/bmck/yf_as_dataframe
114
162
  licenses:
115
163
  - MIT
@@ -132,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
180
  - !ruby/object:Gem::Version
133
181
  version: '0'
134
182
  requirements: []
135
- rubygems_version: 3.2.33
183
+ rubygems_version: 3.5.22
136
184
  signing_key:
137
185
  specification_version: 4
138
186
  summary: A shameless port of python's yfinance module to ruby