lukerosiak / pysec

Parse XBRL filings from the SEC's EDGAR in Python
344 stars 147 forks source link

PySEC with Django & Sqlite3 #11

Open balexbyrd opened 10 years ago

balexbyrd commented 10 years ago

I'm having issues implementing this with Django and Sqlite3. Your Read Me stipulates change the DATA_DIR in the settings.py module but there is no DATA_DIR to change unless copy and pasted into settings. Is this what we're supposed to do? I also didn't understand the "Put this Django app under manage.py". What exactly do you mean?

Ultimately I'm trying to get the sec_import_index and sec_xbrl_to_csv to work. Maybe a step by step to getting those to work with Django & Sqlite3 will help others. Thanks in advance for any help.

peitalin commented 10 years ago

Try this. Go to the base pysec folder and make an empty database, and rename local-settings-example.py to local-settings.py:

$ cd ~/path/to/pysec && python -c "import sqlite3; sqlite3.connect('edgar.db')"
$ mv ./local-settings-example.py ./local-settings.py
$ mkdir ./pysec/data

Then change these settings in local-settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'edgar.db' 
        ### Django automatically creates a db
        ### Rest not needed
    }
}

SECRET_KEY = 'eddiebravo'
DATA_DIR = "%s/pysec/data" % PROJECT_ROOT

Then rerun:

$ python manage.py syncdb
$ python manage.py sec_import_index

This should populate the database with entries from a zipped SEC index file. Open up an interactive session and test out the commands in example.py with:

$ python manage.py shell
from pysec.models import *
filing = Index.objects.filter(form='10-K',cik=1057758).order_by('-date')[0]
x = filing.xbrl()
x.fields
kumarivin commented 7 years ago

this doesn't seem to be helping.. i am still getting the error Unknown command: 'syncdb' Type 'manage.py help' for usage.

dashstander commented 7 years ago

You've probably figured this out, but for anyone else who finds this: syncdb was deprecated in django. Now the command is python manage.py migrate

joeymizrahi commented 6 years ago

could someone help me understand how to use this package?