Skip to main content

A django library for tracking and storing the prices of assets over time.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_candlestick-0.2.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file django_candlestick-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_candlestick-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_candlestick-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6881ed1c2e41ce91575d113272e9cf15c69b8b697882c41fdb823ec3ec56047
MD5 b640a0ff644fb5ef173b97f19c5df262
BLAKE2b-256 6964667d09ce06c374db80c41c0ed4db9825d2f484789411acf41d8e2d15ebb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page