Transaction-tracking application for Django
Project description
Insider is a transaction-tracking application written in Python using the Django framework.
Install
Download
Insider is published as a Git repository. See insider’s web interface for more information.
Dependencies
Outside of Django and the Python standard libraries, the only required dependency is django-tables2 (docs). For some of the scraping libraries (insider/scrape/*), you’ll also need BeautifulSoup.
Quick-start
If you don’t have a Django project and you just want to run insider as a stand-alone service, you can use the example project written up in example. Set up the project (once):
$ python example/manage.py syncdb
See the Django documentation for more details.
Run
Run the app on your local host (as many times as you like):
$ python example/manage.py runserver
You may need to add the current directory to PYTHONPATH so python can find the insider package. If you’re running bash, that will look like
$ PYTHONPATH=”.:$PYTHONPATH” python example/manage.py runserver
Scraping
Entering transaction data by hand can be tedious and error prone. To automate the task, you should write scrapers to look up and enter transaction data automatically. To get you started, I’ve written insider/scrape/nasdaq.py, which scrapes NASDAQ’s interface to EDGAR's data. Use the scraper with something like:
$ export PYTHONPATH='.' $ export DJANGO_SETTINGS_MODULE='example.settings' $ python insider/scrape/nasdaq.py NYSE:RHT NASDAQ:GOOG
If the scraper doesn’t extract company names (nasdaq.py does not), it’s probably a good idea to add the relevant Company and Ticker to the database before running the scraper. Otherwise you may get tickers from several echanges all pointing to the company UNKNOWN.
Hacking
This project was largely build following the Django tutorial. That’s a good place to start if you’re new to Django.