Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some code styling to README #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,33 @@ The XBRL parsing is translated from VB script written by Charles Hoffman, an acc

To set up the index of all SEC filings:

Put this django app under manage.py and do your settings.py
Put this django app under <code>manage.py</code> and do your <code>settings.py</code>

In settings.py, modify DATA_DIR = '/you/directory/to/download/files/to' and set your database
In <code>settings.py</code>, modify <code>DATA_DIR = '/you/directory/to/download/files/to'</code> and set your database, then run:

python manage.py syncdb
<code>python manage.py syncdb</code>

python manage.py sec_import_index
<code>python manage.py sec_import_index</code>

This creates the Index() model. To download any filing, call .download() on that model instance. To get its XBRL attributes if it's an XBRL filing, call .xbrl() on it and look at the .fields attribute of the returned model.


Or if you just want to use the Python XBRL parser on a .xml file:

```
import xbrl

x = xbrl.XBRL(PATH TO LOCAL XML 10-K FILING)

print x.fields #a dict of the most important values
```

To get any XBRL term:

x.GetFactValue(XMBL TAG, "Duration" or "Instant" (depending on if it's a year-long or snapshot value))

<code>x.GetFactValue(XMBL TAG, "Duration" or "Instant" (depending on if it's a year-long or snapshot value))</code>

For more basic usage, see example.py
For more basic usage, see <code>example.py</code>

For an example of generating a CSV of a list of companies, see management/commands/xbrl_to_csv.py
For an example of generating a CSV of a list of companies, see <code>management/commands/xbrl_to_csv.py</code>

By Luke Rosiak
Released under the GNU