SEC
Retrieve XBRL information from the U.S. Securities and Exchange Commission.
Installation
Add this line to your application's Gemfile:
gem 'sec'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sec
Usage
To retrieve an index of all XBRL filings for March 2012:
> response = Sec::Reader.get_monthly_index(2012, 3)
The response is an RSS document, with each filing in response['item']
> response['rss']['channel']['item'].count
=> 4195
From there, you can retrieve an individual file: > response = Sec::Reader.get_xbrl_file("http://www.sec.gov/Archives/edgar/data/840715/000084071512000011/clro-20111231.xml") > puts response.body > > ...
The entries of type "edgar:description"=>"XBRL INSTANCE DOCUMENT" can be parsed by xbrlware-ruby19 for financial facts: > require 'xbrlware-ruby19'
> ins = Xbrlware.ins(<xbrl_instance_file_path>) # Initialize XBRL instance
> items = ins.item("ProfitLoss") # Fetch all "ProfitLoss" financial fact
> items.each do |item|
> puts item.value # Print value of each "ProfitLoss" item
> end
Thanks
Many thanks are owed to the following for me to be able to release my first gem:
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Licensing
The SEC gem is released under the MIT License.