django-candlestick
django-candlestick is a django library for storing price data for stocks, assets, currencies, and other tradeable instruments.
Setup
Install:
$ pip install django-candlestick
Add to installed apps:
INSTALLED_APPS = [
...
"candlestick"
...
]
Migrate:
$ python manage.py migrate
You now have a database of tradeable instruments and their prices.
Use
Manual
from candlestick.models import Instrument, Bar
apple = Instrument.objects.create(
symbol="AAPL", name="Apple, Inc.", currency="USD", timezone="US/Eastern"
)
bar = Bar.objects.create(
open="320.13", low="319.88", high="321.4", close="320.17", volume=3115337,
timestamp=1579887000, resolution="H", instrument=apple
)
print(bar.datetime) # 2020-01-24 12:30:00-05:00
From YAHOO
apple.fetch(resolution="M") # Gets all bars for the month resolution
apple.update(resolution="H") # Gets new bars for the H resolution
At command line
To fetch bars for an instrument:
$ python manage.py fetch AAPL D
To update bars for an instrument:
$ python manage.py update AAPL D
To update bars for multiple instruments:
$ python manage.py update AAPL,AMZN D
To update bars for all instruments:
$ python manage.py update all D
Metadata
Release files for django-candlestick 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_candlestick-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / django_candlestick-0.2.0-py3-none-any.whl
| Download URL | django_candlestick-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6881ed1c2e41ce91575d113272e9cf15c69b8b697882c41fdb823ec3ec56047
|
|
BLAKE2b-256 checksum How to use checksums |
6964667d09ce06c374db80c41c0ed4db9825d2f484789411acf41d8e2d15ebb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|