Sec::Firms Build Status

Firms XML parser for the U. S. Securities and Exchange Commission

Installation

Add this line to your application's Gemfile:

gem 'sec-firms'

And then execute:

$ bundle

Usage

SEC maintains a list of the firms with the CIK ID that is updated every month. We have an API to access that list as csv with the following:

Sec::Firms::Lists.new.latest_as_csv

To fetch all the data avaliable from a firm, you can use the following:

Sec::Firms::FirmParser.new(cik_id).to_hash

Here's an exaple using both classes:

firms = CSV.read(Sec::Firms::Lists.new.latest_as_csv)[3..-1]

firms.each_with_index do |row, index|
  cik_id = row[2].strip
  firm = Sec::Firms::FirmParser.new(cik_id).to_hash

  json = JSON.pretty_generate(firm.as_json)
  file_name = Rails.root.join("data/#{cik_id}-#{firm['slug']}.json")
  File.write(file_name, json)

  puts "#{index + 1} out of #{firms.count}"
end

Configuration

Sec::Firms.configure do |config|
  config.root_path = "#{Rails.root}/data"
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

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 to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/sec-firms/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Licensed under the MIT license.

About Neighborly

Neighborly

Neighborly is the nation's first Community Investment Marketplace.™

By providing better ways for people to invest directly in the places and civic projects they care about, we create new options for communities to approach civic capital formation. Neighborly is democratizing the $3.8T municipal securities market, fostering a healthier relationship between global banks and our nation's places.