Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fred_as_dataframe

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fred_as_dataframe

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

EconDataReader

Up to date remote economic data access for ruby, using Polars dataframes.

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 .

Installation

Add this line to your application's Gemfile:

gem 'fred_as_dataframe'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install fred_as_dataframe

Configuration

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

FredAsDataframe::Client.configure do |config|
  config.fred_api_key = '1234567890ABCDEF'
    OR
  config.fred_api_key = File.read(File.join('','home', 'user', '.fred_api_key.txt'))
end

Usage

Consider the following transcript.

3.1.2 :001 > a = FredAsDataframe::Client.new('UNRATE')
 => #<FredAsDataframe::Client:0x0000000105f1dbb8 @api_key="1234567890ABCDEF", @tag="UNRATE"> 
3.1.2 :002 > b = a.fetch
 => 
shape: (919, 2)                                                    
...                                                                
3.1.2 :003 > b
 => 
shape: (919, 2)                                                    
┌────────────┬────────┐                                            
│ TimestampsUNRATE │                                            
│ ---        ┆ ---    │                                            
│ date       ┆ f64    │                                            
╞════════════╪════════╡                                            
│ 1948-01-013.4    │                                            
│ 1948-02-013.8    │                                            
│ 1948-03-014.0    │                            
│ 1948-04-013.9    │                            
│ 1948-05-013.5    │
│ …          ┆ …      │
│ 2024-03-013.8    │
│ 2024-04-013.9    │
│ 2024-05-014.0    │
│ 2024-06-014.1    │
│ 2024-07-014.3    │
└────────────┴────────┘ 
3.1.2 :004 > a = FredAsDataframe::Client.new('AAA')
 => #<FredAsDataframe::Client:0x0000000106077d38 @api_key="1234567890ABCDEF", @tag="AAA"> 
3.1.2 :005 > b = a.fetch
 => 
shape: (1_267, 2)        
...                      
3.1.2 :006 > b
 => 
shape: (1_267, 2)        
┌────────────┬──────┐    
│ TimestampsAAA  │    
│ ---        ┆ ---  │    
│ date       ┆ f64  │    
╞════════════╪══════╡    
│ 1919-01-015.35 │    
│ 1919-02-015.35 │
│ 1919-03-015.39 │
│ 1919-04-015.44 │
│ 1919-05-015.39 │
│ …          ┆ …    │
│ 2024-03-015.01 │
│ 2024-04-015.28 │
│ 2024-05-015.25 │
│ 2024-06-015.13 │
│ 2024-07-015.12 │
└────────────┴──────┘ 

Documentation

TBD

Contributing

Others are welcome to contribute to the project.

The following conventions are intended for this project.

  • Different sources are intended to reside in different classes.
  • API keys (if needed) should be able to be set in the single configuration file.
  • Series should be able to be identified via a single unique string, provided in the constructor.
  • When fetched, the dataset may be filtered based on optional (hash) arguments.
  • Output should be provided in a consistent DataFrame format (currently Polars::DataFrame).

Bug reports and pull requests are welcome on GitHub at https://github.com/bmck/fred_as_dataframe.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 05 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc