fred_as_dataframe 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9249bd750a05aabf1592a1a2ec0158c9d4fc6d9d5410fce04862c1f617060d14
4
- data.tar.gz: a42874982e4c834068e82b718883e0c13097f5e3ba50e7f0b5bd82518d64ac4b
3
+ metadata.gz: 71c5e1e6483f35362a41afcabab7bc5fab1b5f90ceb5e9a8df9b497ca7c31bb3
4
+ data.tar.gz: 8edf3ed442f2110b73d0ce275ad846eb28a0cecafb883f4c4ed78db103b30bdf
5
5
  SHA512:
6
- metadata.gz: b83fb7b667fc5e9cbe33fa20f63fafde7d8a47d7a5b7c786e47f949167720aaacdfe79245c8e390ef943e6b9261b14a2d8cda1fdd0cd949f719831fc460c2398
7
- data.tar.gz: 91d49edce966235788f47d33bf9300139e0bb624869520ca941425cab5f5a2cdb9bb939523e21078bfba0eae6ab2a8317edaf08a3ac870c2f3157d49fe329456
6
+ metadata.gz: 8d3b99ccecf9c7255a4457d786c576f42352f45bd56343eddd3affb11e9d0955c10db41d3a0abfcb542592f5ee0fe0edd362852df2035cca07753b19509fd772
7
+ data.tar.gz: 96ff1798bb8e1549600a9877152e1aa1ea1b5f0cde288dc2047602f17b9b155cc9aee1ec34c0932ad36505409a42f4f33ce6158ee395005611613fc387b7ec8f
data/.gitignore CHANGED
@@ -5,4 +5,6 @@
5
5
  /doc/
6
6
  /pkg/
7
7
  /spec/reports/
8
+ /spec/examples.txt
8
9
  /tmp/
10
+ /vendor/bundle/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-08-28
9
+
10
+ ### Changed
11
+ - **BREAKING**: Raised minimum required Ruby version from >= 2.3.0 to >= 3.3
12
+ - Pinned Ruby version to 3.3.0 in Gemfile and .ruby-version
13
+ - Pinned polars-df dependency to exactly 0.27.1 (requires Ruby >= 3.3)
14
+ - Updated README Ruby version examples from 3.1.2 to 3.3.0
15
+
16
+ ## [0.1.2] - 2026-08-28
17
+
18
+ ### Added
19
+ - Comprehensive test suite using RSpec, VCR, and WebMock
20
+ - Tests for Client class including initialization, configuration, and fetch operations
21
+ - Tests for date filtering (start and fin parameters)
22
+ - Tests for API key configuration from class variable and options
23
+ - Testing documentation in README
24
+
25
+ ### Fixed
26
+ - Fixed undefined variable `nm` in error message (now correctly uses `@tag`)
27
+ - Fixed README title from "EconDataReader" to "FredAsDataframe"
28
+ - Fixed configuration documentation to use `config.api_key` instead of `config.fred_api_key`
29
+ - Fixed Rakefile to properly define `:spec` task so `rake` command works
30
+
31
+ ### Changed
32
+ - Updated gemspec to include test dependencies (rspec, vcr, webmock, rake)
33
+ - Improved README configuration section with clearer examples
34
+
35
+ ## [0.1.1] - Previous Release
36
+
37
+ ### Added
38
+ - Initial release with FRED data fetching functionality
39
+ - Support for Polars DataFrame output
40
+ - Date range filtering with start and fin parameters
41
+ - Hardcoded SP500 data for monthly frequency
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ ruby '3.3.0'
4
+
3
5
  # Specify your gem's dependencies in fred_as_dataframe.gemspec
4
6
  gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "none", "~> "
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # FredAsDataframe
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fred_as_dataframe`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Up to date remote economic data access for ruby, using Polars dataframes.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ This package will fetch economic and financial information from the Federal Reserve Economic Database, and return the results as a Polars Dataframe. You will need an API key that can be fetched from the FRED website at https://fredaccount.stlouisfed.org/apikeys .
6
+
7
+ ## Requirements
8
+
9
+ - Ruby >= 3.3
10
+ - polars-df ~> 0.27.1
6
11
 
7
12
  ## Installation
8
13
 
@@ -20,19 +25,142 @@ Or install it yourself as:
20
25
 
21
26
  $ gem install fred_as_dataframe
22
27
 
28
+
29
+ ### Configuration
30
+
31
+ Some data sources will require the specification of an API key. These keys should be provided as part of a configuration file, e.g., config/fred_as_dataframe.rb
32
+
33
+ ```ruby
34
+ FredAsDataframe::Client.configure do |config|
35
+ config.api_key = '1234567890ABCDEF'
36
+ end
37
+ ```
38
+
39
+ Alternatively, you can read the API key from a file:
40
+
41
+ ```ruby
42
+ FredAsDataframe::Client.configure do |config|
43
+ config.api_key = File.read(File.join('', 'home', 'user', '.fred_api_key.txt')).strip
44
+ end
45
+ ```
46
+
47
+ You can also pass the API key directly when creating a client instance:
48
+
49
+ ```ruby
50
+ client = FredAsDataframe::Client.new('UNRATE', api_key: '1234567890ABCDEF')
51
+ ```
52
+
23
53
  ## Usage
24
54
 
25
- TODO: Write usage instructions here
55
+ Consider the following transcript.
56
+
57
+ ``` ruby
58
+ 3.3.0 :001 > a = FredAsDataframe::Client.new('UNRATE')
59
+ => #<FredAsDataframe::Client:0x0000000105f1dbb8 @api_key="1234567890ABCDEF", @tag="UNRATE">
60
+ 3.3.0 :002 > b = a.fetch
61
+ =>
62
+ shape: (919, 2)
63
+ ...
64
+ 3.3.0 :003 > b
65
+ =>
66
+ shape: (919, 2)
67
+ ┌────────────┬────────┐
68
+ │ Timestamps ┆ UNRATE │
69
+ │ --- ┆ --- │
70
+ │ date ┆ f64 │
71
+ ╞════════════╪════════╡
72
+ │ 1948-01-01 ┆ 3.4 │
73
+ │ 1948-02-01 ┆ 3.8 │
74
+ │ 1948-03-01 ┆ 4.0 │
75
+ │ 1948-04-01 ┆ 3.9 │
76
+ │ 1948-05-01 ┆ 3.5 │
77
+ │ … ┆ … │
78
+ │ 2024-03-01 ┆ 3.8 │
79
+ │ 2024-04-01 ┆ 3.9 │
80
+ │ 2024-05-01 ┆ 4.0 │
81
+ │ 2024-06-01 ┆ 4.1 │
82
+ │ 2024-07-01 ┆ 4.3 │
83
+ └────────────┴────────┘
84
+ 3.3.0 :004 > a = FredAsDataframe::Client.new('AAA')
85
+ => #<FredAsDataframe::Client:0x0000000106077d38 @api_key="1234567890ABCDEF", @tag="AAA">
86
+ 3.3.0 :005 > b = a.fetch
87
+ =>
88
+ shape: (1_267, 2)
89
+ ...
90
+ 3.3.0 :006 > b
91
+ =>
92
+ shape: (1_267, 2)
93
+ ┌────────────┬──────┐
94
+ │ Timestamps ┆ AAA │
95
+ │ --- ┆ --- │
96
+ │ date ┆ f64 │
97
+ ╞════════════╪══════╡
98
+ │ 1919-01-01 ┆ 5.35 │
99
+ │ 1919-02-01 ┆ 5.35 │
100
+ │ 1919-03-01 ┆ 5.39 │
101
+ │ 1919-04-01 ┆ 5.44 │
102
+ │ 1919-05-01 ┆ 5.39 │
103
+ │ … ┆ … │
104
+ │ 2024-03-01 ┆ 5.01 │
105
+ │ 2024-04-01 ┆ 5.28 │
106
+ │ 2024-05-01 ┆ 5.25 │
107
+ │ 2024-06-01 ┆ 5.13 │
108
+ │ 2024-07-01 ┆ 5.12 │
109
+ └────────────┴──────┘
110
+
111
+ ```
112
+
113
+ ## Testing
114
+
115
+ This gem uses RSpec for testing. To run the test suite:
116
+
117
+ ```bash
118
+ bundle install
119
+ bundle exec rake
120
+ ```
121
+
122
+ Or run RSpec directly:
123
+
124
+ ```bash
125
+ bundle exec rspec
126
+ ```
127
+
128
+ The test suite uses VCR and WebMock to record and replay HTTP interactions with the FRED API, ensuring tests run quickly and don't require a live API connection or API key.
129
+
130
+ ### Running Tests with Coverage
26
131
 
27
- ## Development
132
+ Tests are configured with fixtures that mock FRED API responses, so you don't need a FRED API key to run the test suite.
28
133
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake none` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
134
+ ## API Documentation
30
135
 
31
- 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
136
+ ### Client#new(series_id, options = {})
137
+
138
+ Creates a new FRED data client for the specified series.
139
+
140
+ - `series_id` - FRED series identifier (e.g., 'UNRATE', 'AAA', 'SP500')
141
+ - `options` - Optional hash with `:api_key` to override configured API key
142
+
143
+ ### Client#fetch(start: nil, fin: nil)
144
+
145
+ Fetches data from FRED and returns a Polars DataFrame.
146
+
147
+ - `start` - Optional start date (String or Date) to filter data from this date forward
148
+ - `fin` - Optional end date (String or Date) to filter data up to this date
149
+
150
+ Returns a Polars DataFrame with timestamp and value columns.
32
151
 
33
152
  ## Contributing
34
153
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fred_as_dataframe.
154
+ Others are welcome to contribute to the project.
155
+
156
+ The following conventions are intended for this project.
157
+ * Different sources are intended to reside in different classes.
158
+ * API keys (if needed) should be able to be set in the single configuration file.
159
+ * Series should be able to be identified via a single unique string, provided in the constructor.
160
+ * When fetched, the dataset may be filtered based on optional (hash) arguments.
161
+ * Output should be provided in a consistent DataFrame format (currently Polars::DataFrame).
162
+
163
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bmck/fred_as_dataframe.
36
164
 
37
165
 
38
166
  ## License
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
2
6
  task :default => :spec
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = "Integrated economic and financial data from FRED"
11
11
  spec.homepage = "https://github.com/bmck/fred_as_dataframe"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3")
14
14
 
15
15
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
16
 
@@ -29,6 +29,12 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
31
  # spec.add_dependency "typhoeus-gem", "~> 0.6.9"
32
- spec.add_dependency 'polars-df'
32
+ spec.add_dependency 'polars-df', '0.27.1'
33
33
  spec.add_dependency 'httparty'
34
+
35
+ spec.add_development_dependency 'rspec', '~> 3.12'
36
+ spec.add_development_dependency 'vcr', '~> 6.1'
37
+ spec.add_development_dependency 'webmock', '~> 3.18'
38
+ spec.add_development_dependency 'rake', '~> 13.0'
39
+ spec.add_development_dependency 'rack', '~> 3.0'
34
40
  end
@@ -0,0 +1,149 @@
1
+ require 'polars-df'
2
+ require 'httparty'
3
+ require 'csv'
4
+ require 'date'
5
+
6
+ module FredAsDataframe
7
+ class Client
8
+ include ::HTTParty
9
+ attr_reader :tag
10
+
11
+ def self.configure
12
+ yield self
13
+ true
14
+ end
15
+
16
+ class << self
17
+ attr_accessor :api_key
18
+ end
19
+
20
+ def initialize(series, options={})
21
+ @api_key = options[:api_key] || FredAsDataframe::Client.api_key
22
+ @tag = series
23
+ end
24
+
25
+ def fetch(start: nil, fin: nil, interval: '1d')
26
+ data = _fetch_data(interval)
27
+ i = interval[0..-2].to_i
28
+
29
+ begin
30
+ data = data.select{ |date, _| (start.nil? || date >= Date.parse(start.to_s)) } unless start.nil?
31
+ data = data.select{ |date, _| (fin.nil? || date <= Date.parse(fin.to_s)) } unless fin.nil?
32
+ data = data.each_slice(i).map(&:first)
33
+ rescue KeyError => e
34
+ if data.keys[3].to_s[7, 5] == "Error"
35
+ raise IOError, "Failed to get the data. Check that '#{@tag}' is a valid FRED series."
36
+ else
37
+ raise e
38
+ end
39
+ end
40
+
41
+ Polars::DataFrame.new({Timestamps: data.map(&:first), tag.to_sym => data.map(&:last)})
42
+ end
43
+
44
+ private
45
+
46
+ def _url(n, i = 'm');
47
+ "https://api.stlouisfed.org/fred/series/observations?series_id=#{n}&api_key=#{@api_key}#{i != 'd' ? "&frequency=#{i}" : ''}"
48
+ end
49
+
50
+
51
+ def _fetch_data(interval)
52
+ # Utility to fetch data
53
+ i = interval.strip[-1]
54
+ nm = tag
55
+ resp = nil
56
+
57
+ if nm == 'SP500' && i == 'm'
58
+ resp = sp500
59
+ else
60
+ http_resp = self.class.get(_url(nm, interval[-1]))
61
+ parsed = http_resp.parsed_response
62
+
63
+ # Handle API errors
64
+ if parsed.is_a?(Hash) && parsed['error_message']
65
+ raise IOError, "Failed to get the data. Check that '#{nm}' is a valid FRED series. Error: #{parsed['error_message']}"
66
+ end
67
+
68
+ resp = parsed['observations']['observation']
69
+ resp = "date, #{nm}\n" + resp.map{|r| "#{r['date']},#{r['value']}" }.join("\n")
70
+ end
71
+ data = CSV.parse(resp, headers: true, header_converters: :symbol, converters: [:date, :float])
72
+ data = data.map { |row| [Date.parse(row[:date].to_s), row[data.headers.last].to_f] }.to_h
73
+
74
+ data
75
+ end
76
+
77
+ def sp500
78
+ "date,SP500\n1959-01-01,55.62\n1959-02-01,54.77\n1959-03-01,56.16\n1959-04-01,57.1\n1959-05-01,57.96\n1959-06-01,57.46\n1959-07-01,59.74\n1959-08-01,59.4\n1959-09-01,57.05\n1959-10-01,57\n1959-11-01,57.23\n1959-12-01,59.06\n" \
79
+ "1960-01-01,58.03\n1960-02-01,55.78\n1960-03-01,55.02\n1960-04-01,55.73\n1960-05-01,55.22\n1960-06-01,57.26\n1960-07-01,55.84\n1960-08-01,56.51\n1960-09-01,54.81\n1960-10-01,53.73\n1960-11-01,55.47\n1960-12-01,56.8\n" \
80
+ "1961-01-01,59.72\n1961-02-01,62.17\n1961-03-01,64.12\n1961-04-01,65.83\n1961-05-01,66.5\n1961-06-01,65.62\n1961-07-01,65.44\n1961-08-01,67.79\n1961-09-01,67.26\n1961-10-01,68\n1961-11-01,71.08\n1961-12-01,71.74\n" \
81
+ "1962-01-01,69.07\n1962-02-01,70.22\n1962-03-01,70.29\n1962-04-01,68.05\n1962-05-01,62.99\n1962-06-01,55.63\n1962-07-01,56.97\n1962-08-01,58.52\n1962-09-01,58\n1962-10-01,56.17\n1962-11-01,60.04\n1962-12-01,62.64\n" \
82
+ "1963-01-01,65.06\n1963-02-01,65.92\n1963-03-01,65.67\n1963-04-01,68.76\n1963-05-01,70.14\n1963-06-01,70.11\n1963-07-01,69.07\n1963-08-01,70.98\n1963-09-01,72.85\n1963-10-01,73.03\n1963-11-01,72.62\n1963-12-01,74.17\n" \
83
+ "1964-01-01,76.45\n1964-02-01,77.39\n1964-03-01,78.8\n1964-04-01,79.94\n1964-05-01,80.72\n1964-06-01,80.24\n1964-07-01,83.22\n1964-08-01,82\n1964-09-01,83.41\n1964-10-01,84.85\n1964-11-01,85.44\n1964-12-01,83.96\n" \
84
+ "1965-01-01,86.12\n1965-02-01,86.75\n1965-03-01,86.83\n1965-04-01,87.97\n1965-05-01,89.28\n1965-06-01,85.04\n1965-07-01,84.91\n1965-08-01,86.49\n1965-09-01,89.38\n1965-10-01,91.39\n1965-11-01,92.15\n1965-12-01,91.73\n" \
85
+ "1966-01-01,93.32\n1966-02-01,92.69\n1966-03-01,88.88\n1966-04-01,91.6\n1966-05-01,86.78\n1966-06-01,86.06\n1966-07-01,85.84\n1966-08-01,80.65\n1966-09-01,77.81\n1966-10-01,77.13\n1966-11-01,80.99\n1966-12-01,81.33\n" \
86
+ "1967-01-01,84.45\n1967-02-01,87.36\n1967-03-01,89.42\n1967-04-01,90.96\n1967-05-01,92.59\n1967-06-01,91.43\n1967-07-01,93.01\n1967-08-01,94.49\n1967-09-01,95.81\n1967-10-01,95.66\n1967-11-01,92.66\n1967-12-01,95.3\n" \
87
+ "1968-01-01,95.04\n1968-02-01,90.75\n1968-03-01,89.09\n1968-04-01,95.67\n1968-05-01,97.87\n1968-06-01,100.5\n1968-07-01,100.3\n1968-08-01,98.11\n1968-09-01,101.3\n1968-10-01,103.8\n1968-11-01,105.4\n1968-12-01,106.5\n" \
88
+ "1969-01-01,102\n1969-02-01,101.5\n1969-03-01,99.3\n1969-04-01,101.3\n1969-05-01,104.6\n1969-06-01,99.14\n1969-07-01,94.71\n1969-08-01,94.18\n1969-09-01,94.51\n1969-10-01,95.52\n1969-11-01,96.21\n1969-12-01,91.11\n" \
89
+ "1970-01-01,90.31\n1970-02-01,87.16\n1970-03-01,88.65\n1970-04-01,85.95\n1970-05-01,76.06\n1970-06-01,75.59\n1970-07-01,75.72\n1970-08-01,77.92\n1970-09-01,82.58\n1970-10-01,84.37\n1970-11-01,84.28\n1970-12-01,90.05\n" \
90
+ "1971-01-01,93.49\n1971-02-01,97.11\n1971-03-01,99.6\n1971-04-01,103\n1971-05-01,101.6\n1971-06-01,99.72\n1971-07-01,99\n1971-08-01,97.24\n1971-09-01,99.4\n1971-10-01,97.29\n1971-11-01,92.78\n1971-12-01,99.17\n" \
91
+ "1972-01-01,103.3\n1972-02-01,105.2\n1972-03-01,107.7\n1972-04-01,108.8\n1972-05-01,107.7\n1972-06-01,108\n1972-07-01,107.2\n1972-08-01,111\n1972-09-01,109.4\n1972-10-01,109.6\n1972-11-01,115.1\n1972-12-01,117.5\n" \
92
+ "1973-01-01,118.4\n1973-02-01,114.2\n1973-03-01,112.4\n1973-04-01,110.3\n1973-05-01,107.2\n1973-06-01,104.8\n1973-07-01,105.8\n1973-08-01,103.8\n1973-09-01,105.6\n1973-10-01,109.8\n1973-11-01,102\n1973-12-01,94.78\n" \
93
+ "1974-01-01,96.11\n1974-02-01,93.45\n1974-03-01,97.44\n1974-04-01,92.46\n1974-05-01,89.67\n1974-06-01,89.79\n1974-07-01,79.31\n1974-08-01,76.03\n1974-09-01,68.12\n1974-10-01,69.44\n1974-11-01,71.74\n1974-12-01,67.07\n" \
94
+ "1975-01-01,72.56\n1975-02-01,80.1\n1975-03-01,83.78\n1975-04-01,84.72\n1975-05-01,90.1\n1975-06-01,92.4\n1975-07-01,92.49\n1975-08-01,85.71\n1975-09-01,84.67\n1975-10-01,88.57\n1975-11-01,90.07\n1975-12-01,88.7\n" \
95
+ "1976-01-01,96.86\n1976-02-01,100.6\n1976-03-01,101.1\n1976-04-01,101.9\n1976-05-01,101.2\n1976-06-01,101.8\n1976-07-01,104.2\n1976-08-01,103.3\n1976-09-01,105.5\n1976-10-01,101.9\n1976-11-01,101.2\n1976-12-01,104.7\n" \
96
+ "1977-01-01,103.8\n1977-02-01,101\n1977-03-01,100.6\n1977-04-01,99.05\n1977-05-01,98.76\n1977-06-01,99.29\n1977-07-01,100.2\n1977-08-01,97.75\n1977-09-01,96.23\n1977-10-01,93.74\n1977-11-01,94.28\n1977-12-01,93.82\n" \
97
+ "1978-01-01,90.25\n1978-02-01,88.98\n1978-03-01,88.82\n1978-04-01,92.71\n1978-05-01,97.41\n1978-06-01,97.66\n1978-07-01,97.19\n1978-08-01,103.9\n1978-09-01,103.9\n1978-10-01,100.6\n1978-11-01,94.71\n1978-12-01,96.11\n" \
98
+ "1979-01-01,99.71\n1979-02-01,98.23\n1979-03-01,100.1\n1979-04-01,102.1\n1979-05-01,99.73\n1979-06-01,101.7\n1979-07-01,102.7\n1979-08-01,107.4\n1979-09-01,108.6\n1979-10-01,104.5\n1979-11-01,103.7\n1979-12-01,107.8\n" \
99
+ "1980-01-01,110.9\n1980-02-01,115.3\n1980-03-01,104.7\n1980-04-01,103\n1980-05-01,107.7\n1980-06-01,114.6\n1980-07-01,119.8\n1980-08-01,123.5\n1980-09-01,126.5\n1980-10-01,130.2\n1980-11-01,135.7\n1980-12-01,133.5\n" \
100
+ "1981-01-01,133\n1981-02-01,128.4\n1981-03-01,133.2\n1981-04-01,134.4\n1981-05-01,131.7\n1981-06-01,132.3\n1981-07-01,129.1\n1981-08-01,129.6\n1981-09-01,118.3\n1981-10-01,119.8\n1981-11-01,122.9\n1981-12-01,123.8\n" \
101
+ "1982-01-01,117.3\n1982-02-01,114.5\n1982-03-01,110.8\n1982-04-01,116.3\n1982-05-01,116.4\n1982-06-01,109.7\n1982-07-01,109.4\n1982-08-01,109.7\n1982-09-01,122.4\n1982-10-01,132.7\n1982-11-01,138.1\n1982-12-01,139.4\n" \
102
+ "1983-01-01,144.3\n1983-02-01,146.8\n1983-03-01,151.9\n1983-04-01,157.7\n1983-05-01,164.1\n1983-06-01,166.4\n1983-07-01,167\n1983-08-01,162.4\n1983-09-01,167.2\n1983-10-01,167.7\n1983-11-01,165.2\n1983-12-01,164.4\n" \
103
+ "1984-01-01,166.4\n1984-02-01,157.3\n1984-03-01,157.4\n1984-04-01,157.6\n1984-05-01,156.6\n1984-06-01,153.1\n1984-07-01,151.1\n1984-08-01,164.4\n1984-09-01,166.1\n1984-10-01,164.8\n1984-11-01,166.3\n1984-12-01,164.5\n" \
104
+ "1985-01-01,171.6\n1985-02-01,180.9\n1985-03-01,179.4\n1985-04-01,180.6\n1985-05-01,184.9\n1985-06-01,188.9\n1985-07-01,192.5\n1985-08-01,188.3\n1985-09-01,184.1\n1985-10-01,186.2\n1985-11-01,197.5\n1985-12-01,207.3\n" \
105
+ "1986-01-01,208.2\n1986-02-01,219.4\n1986-03-01,232.3\n1986-04-01,238\n1986-05-01,238.5\n1986-06-01,245.3\n1986-07-01,240.2\n1986-08-01,245\n1986-09-01,238.3\n1986-10-01,237.4\n1986-11-01,245.1\n1986-12-01,248.6\n" \
106
+ "1987-01-01,264.5\n1987-02-01,280.9\n1987-03-01,292.5\n1987-04-01,289.3\n1987-05-01,289.1\n1987-06-01,301.4\n1987-07-01,310.1\n1987-08-01,329.4\n1987-09-01,318.7\n1987-10-01,280.2\n1987-11-01,245\n1987-12-01,241\n" \
107
+ "1988-01-01,250.5\n1988-02-01,258.1\n1988-03-01,265.7\n1988-04-01,262.6\n1988-05-01,256.1\n1988-06-01,270.7\n1988-07-01,269.1\n1988-08-01,263.7\n1988-09-01,268\n1988-10-01,277.4\n1988-11-01,271\n1988-12-01,276.5\n" \
108
+ "1989-01-01,285.4\n1989-02-01,294\n1989-03-01,292.7\n1989-04-01,302.3\n1989-05-01,313.9\n1989-06-01,323.7\n1989-07-01,331.9\n1989-08-01,346.6\n1989-09-01,347.3\n1989-10-01,347.4\n1989-11-01,340.2\n1989-12-01,348.6\n" \
109
+ "1990-01-01,339.97\n1990-02-01,330.45\n1990-03-01,338.46\n1990-04-01,338.18\n1990-05-01,350.25\n1990-06-01,360.39\n1990-07-01,360.03\n1990-08-01,330.75\n1990-09-01,315.41\n1990-10-01,307.12\n1990-11-01,315.29\n" \
110
+ "1990-12-01,328.75\n1991-01-01,325.49\n1991-02-01,362.26\n1991-03-01,372.28\n1991-04-01,379.68\n1991-05-01,377.99\n1991-06-01,378.29\n1991-07-01,380.23\n1991-08-01,389.4\n1991-09-01,387.2\n1991-10-01,386.88\n1991-11-01,385.92" \
111
+ "\n1991-12-01,388.51\n1992-01-01,416.08\n1992-02-01,412.56\n1992-03-01,407.36\n1992-04-01,407.41\n1992-05-01,414.81\n1992-06-01,408.27\n1992-07-01,415.05\n1992-08-01,417.93\n1992-09-01,418.48\n1992-10-01,412.5\n" \
112
+ "1992-11-01,422.84\n1992-12-01,435.64\n1993-01-01,435.23\n1993-02-01,441.7\n1993-03-01,450.16\n1993-04-01,443.08\n1993-05-01,445.25\n1993-06-01,448.06\n1993-07-01,447.29\n1993-08-01,454.13\n1993-09-01,459.24\n" \
113
+ "1993-10-01,463.9\n1993-11-01,462.89\n1993-12-01,465.95\n1994-01-01,472.99\n1994-02-01,471.58\n1994-03-01,463.81\n1994-04-01,447.23\n1994-05-01,450.9\n1994-06-01,454.83\n1994-07-01,451.4\n1994-08-01,464.24\n1994-09-01,466.96\n" \
114
+ "1994-10-01,463.81\n1994-11-01,461.01\n1994-12-01,455.19\n1995-01-01,465.25\n1995-02-01,481.92\n1995-03-01,493.15\n1995-04-01,507.91\n1995-05-01,523.81\n1995-06-01,539.35\n1995-07-01,557.37\n1995-08-01,559.11\n" \
115
+ "1995-09-01,578.77\n1995-10-01,582.92\n1995-11-01,595.53\n1995-12-01,614.57\n1996-01-01,614.42\n1996-02-01,649.54\n1996-03-01,647.07\n1996-04-01,647.17\n1996-05-01,661.23\n1996-06-01,668.5\n1996-07-01,644.07\n" \
116
+ "1996-08-01,662.68\n1996-09-01,674.88\n1996-10-01,701.46\n1996-11-01,735.67\n1996-12-01,743.25\n1997-01-01,766.22\n1997-02-01,798.39\n1997-03-01,792.16\n1997-04-01,763.93\n1997-05-01,833.09\n1997-06-01,876.29\n" \
117
+ "1997-07-01,925.29\n1997-08-01,927.24\n1997-09-01,937.02\n1997-10-01,951.16\n1997-11-01,938.92\n1997-12-01,962.37\n1998-01-01,963.36\n1998-02-01,1023.74\n1998-03-01,1076.83\n1998-04-01,1112.2\n1998-05-01,1108.42\n" \
118
+ "1998-06-01,1108.39\n1998-07-01,1156.58\n1998-08-01,1074.62\n1998-09-01,1020.64\n1998-10-01,1032.47\n1998-11-01,1144.43\n1998-12-01,1190.05\n1999-01-01,1248.77\n1999-02-01,1246.58\n1999-03-01,1281.66\n1999-04-01,1334.76\n" \
119
+ "1999-05-01,1332.07\n1999-06-01,1322.55\n1999-07-01,1380.99\n1999-08-01,1327.49\n1999-09-01,1318.17\n1999-10-01,1300.01\n1999-11-01,1391\n1999-12-01,1428.68\n2000-01-01,1425.59\n2000-02-01,1388.87\n2000-03-01,1442.21\n" \
120
+ "2000-04-01,1461.36\n2000-05-01,1418.48\n2000-06-01,1461.96\n2000-07-01,1473\n2000-08-01,1485.46\n2000-09-01,1468.05\n2000-10-01,1390.14\n2000-11-01,1378.04\n2000-12-01,1330.93\n2001-01-01,1335.63\n2001-02-01,1305.75\n" \
121
+ "2001-03-01,1185.85\n2001-04-01,1189.84\n2001-05-01,1270.37\n2001-06-01,1238.71\n2001-07-01,1204.45\n2001-08-01,1178.5\n2001-09-01,1044.64\n2001-10-01,1076.59\n2001-11-01,1129.68\n2001-12-01,1144.93\n2002-01-01,1140.21\n" \
122
+ "2002-02-01,1100.67\n2002-03-01,1153.79\n2002-04-01,1111.93\n2002-05-01,1079.25\n2002-06-01,1014.02\n2002-07-01,903.59\n2002-08-01,912.55\n2002-09-01,867.81\n2002-10-01,854.63\n2002-11-01,909.93\n2002-12-01,899.18\n" \
123
+ "2003-01-01,895.84\n2003-02-01,837.03\n2003-03-01,846.63\n2003-04-01,890.03\n2003-05-01,935.96\n2003-06-01,988\n2003-07-01,992.54\n2003-08-01,989.53\n2003-09-01,1019.44\n2003-10-01,1038.73\n2003-11-01,1049.9\n" \
124
+ "2003-12-01,1080.64\n2004-01-01,1132.52\n2004-02-01,1143.36\n2004-03-01,1123.98\n2004-04-01,1133.36\n2004-05-01,1102.78\n2004-06-01,1132.76\n2004-07-01,1105.85\n2004-08-01,1088.94\n2004-09-01,1117.66\n2004-10-01,1117.21\n" \
125
+ "2004-11-01,1168.94\n2004-12-01,1199.21\n2005-01-01,1181.41\n2005-02-01,1199.63\n2005-03-01,1194.9\n2005-04-01,1164.43\n2005-05-01,1178.28\n2005-06-01,1202.25\n2005-07-01,1222.24\n2005-08-01,1224.27\n2005-09-01,1225.92\n" \
126
+ "2005-10-01,1191.96\n2005-11-01,1237.37\n2005-12-01,1262.07\n2006-01-01,1278.73\n2006-02-01,1276.65\n2006-03-01,1293.74\n2006-04-01,1302.17\n2006-05-01,1290.01\n2006-06-01,1253.17\n2006-07-01,1260.24\n2006-08-01,1287.15\n" \
127
+ "2006-09-01,1317.74\n2006-10-01,1363.38\n2006-11-01,1388.64\n2006-12-01,1416.42\n2007-01-01,1424.16\n2007-02-01,1444.8\n2007-03-01,1406.95\n2007-04-01,1463.64\n2007-05-01,1511.14\n2007-06-01,1514.19\n2007-07-01,1520.71\n" \
128
+ "2007-08-01,1454.62\n2007-09-01,1497.12\n2007-10-01,1539.66\n2007-11-01,1463.39\n2007-12-01,1479.22\n2008-01-01,1378.76\n2008-02-01,1354.87\n2008-03-01,1316.94\n2008-04-01,1370.47\n2008-05-01,1403.22\n2008-06-01,1341.25\n" \
129
+ "2008-07-01,1257.33\n2008-08-01,1281.47\n2008-09-01,1216.95\n2008-10-01,968.8\n2008-11-01,883.04\n2008-12-01,877.56\n2009-01-01,865.58\n2009-02-01,805.23\n2009-03-01,757.13\n2009-04-01,848.15\n2009-05-01,902.41\n" \
130
+ "2009-06-01,926.12\n2009-07-01,935.82\n2009-08-01,1009.73\n2009-09-01,1044.55\n2009-10-01,1067.66\n2009-11-01,1088.07\n2009-12-01,1110.38\n2010-01-01,1123.58\n2010-02-01,1089.16\n2010-03-01,1152.05\n2010-04-01,1197.32\n" \
131
+ "2010-05-01,1125.06\n2010-06-01,1083.36\n2010-07-01,1079.8\n2010-08-01,1087.28\n2010-09-01,1122.08\n2010-10-01,1171.58\n2010-11-01,1198.89\n2010-12-01,1241.53\n2011-01-01,1282.62\n2011-02-01,1321.12\n2011-03-01,1304.49\n" \
132
+ "2011-04-01,1331.51\n2011-05-01,1338.31\n2011-06-01,1287.29\n2011-07-01,1325.19\n2011-08-01,1185.31\n2011-09-01,1173.88\n2011-10-01,1207.22\n2011-11-01,1226.42\n2011-12-01,1243.32\n2012-01-01,1300.58\n2012-02-01,1352.49\n" \
133
+ "2012-03-01,1389.24\n2012-04-01,1386.43\n2012-05-01,1341.27\n2012-06-01,1323.48\n2012-07-01,1359.78\n2012-08-01,1403.45\n2012-09-01,1443.42\n2012-10-01,1437.82\n2012-11-01,1394.51\n2012-12-01,1422.29\n2013-01-01,1480.4\n" \
134
+ "2013-02-01,1512.31\n2013-03-01,1550.83\n2013-04-01,1570.7\n2013-05-01,1639.84\n2013-06-01,1618.77\n2013-07-01,1668.68\n2013-08-01,1670.09\n2013-09-01,1687.17\n2013-10-01,1720.03\n2013-11-01,1783.54\n2013-12-01,1807.78\n" \
135
+ "2014-01-01,1822.36\n2014-02-01,1817.04\n2014-03-01,1863.52\n2014-04-01,1864.26\n2014-05-01,1889.77\n2014-06-01,1947.09\n2014-07-01,1973.1\n2014-08-01,1961.53\n2014-09-01,1993.23\n2014-10-01,1937.27\n2014-11-01,2044.57\n" \
136
+ "2014-12-01,2054.27\n2015-01-01,2028.18\n2015-02-01,2082.2\n2015-03-01,2079.99\n2015-04-01,2094.86\n2015-05-01,2111.94\n2015-06-01,2099.29\n2015-07-01,2094.14\n2015-08-01,2039.87\n2015-09-01,1945.41\n2015-10-01,2071.18\n" \
137
+ "2015-11-01,2080.62\n2015-12-01,2054.08\n2016-01-01,1918.6\n2016-02-01,1903.03\n2016-03-01,2021.95\n2016-04-01,2075.54\n2016-05-01,2065.55\n2016-06-01,2083.89\n2016-07-01,2148.9\n2016-08-01,2177.48\n2016-09-01,2157.69\n" \
138
+ "2016-10-01,2143.02\n2016-11-01,2164.99\n2016-12-01,2246.63\n2017-01-01,2275.12\n2017-02-01,2329.91\n2017-03-01,2345.96\n2017-04-01,2359.31\n2017-05-01,2395.35\n2017-06-01,2433.99\n2017-07-01,2454.1\n2017-08-01,2456.22\n" \
139
+ "2017-09-01,2492.84\n2017-10-01,2557\n2017-11-01,2593.61\n2017-12-01,2664.34\n2018-01-01,2789.8\n2018-02-01,2705.16\n2018-03-01,2702.77\n2018-04-01,2653.63\n2018-05-01,2701.49\n2018-06-01,2754.35\n2018-07-01,2793.64\n" \
140
+ "2018-08-01,2857.82\n2018-09-01,2901.5\n2018-10-01,2785.46\n2018-11-01,2723.23\n2018-12-01,2567.31\n2019-01-01,2607.39\n2019-02-01,2754.86\n2019-03-01,2803.98\n2019-04-01,2903.8\n2019-05-01,2854.71\n2019-06-01,2890.17\n" \
141
+ "2019-07-01,2996.11\n2019-08-01,2897.5\n2019-09-01,2982.16\n2019-10-01,2977.68\n2019-11-01,3104.9\n2019-12-01,3176.75\n2020-01-01,3278.2\n2020-02-01,3277.31\n2020-03-01,2652.39\n2020-04-01,2761.98\n2020-05-01,2919.62\n" \
142
+ "2020-06-01,3104.66\n2020-07-01,3207.62\n2020-08-01,3391.71\n2020-09-01,3365.52\n2020-10-01,3418.7\n2020-11-01,3548.99\n2020-12-01,3695.31\n2021-01-01,3793.75\n2021-02-01,3883.43\n2021-03-01,3910.51\n2021-04-01,4141.18\n" \
143
+ "2021-05-01,4167.85\n2021-06-01,4238.49\n2021-07-01,4363.71\n2021-08-01,4454.21\n2021-09-01,4445.54\n2021-10-01,4460.71\n2021-11-01,4667.39\n2021-12-01,4674.77\n2022-01-01,4573.82\n2022-02-01,4435.98\n2022-03-01,4391.27\n" \
144
+ "2022-04-01,4391.3\n2022-05-01,4040.36\n2022-06-01,3898.95\n2022-07-01,3911.73\n2022-08-01,4158.56\n2022-09-01,3850.52\n2022-10-01,3726.05\n2022-11-01,3917.49\n2022-12-01,3912.38\n2023-01-01,3960.66\n2023-02-01,4079.68\n" \
145
+ "2023-03-01,3968.56\n2023-04-01,4121.47\n2023-05-01,4146.17\n2023-06-01,4345.37\n2023-07-01,4508.08\n2023-08-01,4457.36\n2023-09-01,4409.1\n2023-10-01,4269.4\n2023-11-01,4460.06\n2023-12-01,4685.05\n2024-01-01,4815.61\n" \
146
+ "2024-02-01,5011.96\n2024-03-01,5170.57\n2024-04-01,5112.49\n2024-05-01,5235.23"
147
+ end
148
+ end
149
+ end
@@ -1,3 +1,3 @@
1
1
  module FredAsDataframe
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  require "fred_as_dataframe/version"
2
- require "fred_as_dataframe/fred_data"
2
+ require "fred_as_dataframe/client"
3
3
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fred_as_dataframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill McKinnon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-05 00:00:00.000000000 Z
11
+ date: 2026-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: polars-df
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.27.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.27.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,76 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '6.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '6.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.18'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rack
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
41
111
  description: Integrated economic and financial data from FRED
42
112
  email:
43
113
  - bill.mckinnon@bmck.org
@@ -46,7 +116,9 @@ extensions: []
46
116
  extra_rdoc_files: []
47
117
  files:
48
118
  - ".gitignore"
119
+ - ".ruby-version"
49
120
  - ".travis.yml"
121
+ - CHANGELOG.md
50
122
  - Gemfile
51
123
  - LICENSE.txt
52
124
  - README.md
@@ -55,6 +127,7 @@ files:
55
127
  - bin/setup
56
128
  - fred_as_dataframe.gemspec
57
129
  - lib/fred_as_dataframe.rb
130
+ - lib/fred_as_dataframe/client.rb
58
131
  - lib/fred_as_dataframe/version.rb
59
132
  homepage: https://github.com/bmck/fred_as_dataframe
60
133
  licenses:
@@ -71,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
144
  requirements:
72
145
  - - ">="
73
146
  - !ruby/object:Gem::Version
74
- version: 2.3.0
147
+ version: '3.3'
75
148
  required_rubygems_version: !ruby/object:Gem::Requirement
76
149
  requirements:
77
150
  - - ">="
78
151
  - !ruby/object:Gem::Version
79
152
  version: '0'
80
153
  requirements: []
81
- rubygems_version: 3.1.6
154
+ rubygems_version: 3.5.22
82
155
  signing_key:
83
156
  specification_version: 4
84
157
  summary: Integrated economic and financial data from FRED