Get your daily market updates from Bombay stock exchange
git clone https://github.com/nithinkash/MarketInfo.git
This whole project is developed using django, uses jinja html template as a frontend and redis as a datastore.
pip install -r requirements.txt
This installs all the requirements for the project using pip (python package installer)
execute this set of commands to create database tables and run the project
python manage.py migrate
python manage.py makemigrations
python manage.py runserver
If everything is done right this should start the server in localhost on port 8000 (default port) But for this project we need another command which needs to be executed.
python manage.py qcluster
Probably wondering why is this used for!!, I'll get to it after some time.
Main aim of this project is to create a django app to fetch the BhavFile from the BSE( Bombay stock exchnage) everyday at 6:00 PM IST, store it in redis and present it in a user friendly way. Main components of the app that I've used are
- Django
- DjangoQ
- Redis
As many of you may know is the light weight web framework fully written in python which handles and server's the web request.
Python library that can be used for Async tasks handling and scheduling. Very light weight and easy to use library which runs in the background to serve scheduling tasks like triggering a function call at some time of the day. Which exactly is the functionality we want here. python manage.py qcluster was used to start the q_cluster which handles this async task. Good thing about djangoQ is we can schedule the task through admin console with GUI at
/admin/django_q
Used to store the stock data which is in the CSV format as a list values, and can be retrieved very easily.
I've hosted this on aws EC2 instance using WSGI and Apache server. This medium article can give you a good insight on deploying django apps using WSGI + apache.
One thing I've done to run q_cluster on cloud is to configure supervisor Supervisor's are used to run multiple processes and commands it can startup automatically after a reboot. q_cluster.sh shell script can be used to run qcluster using supervisor on cloud.