https://github.com/samirelanduk/django-candlestick
Price data in Django
https://github.com/samirelanduk/django-candlestick
forex stock-market stock-prices
Last synced: 8 months ago
JSON representation
Price data in Django
- Host: GitHub
- URL: https://github.com/samirelanduk/django-candlestick
- Owner: samirelanduk
- License: gpl-3.0
- Created: 2021-06-20T23:09:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-29T00:32:05.000Z (over 4 years ago)
- Last Synced: 2025-02-12T11:58:17.098Z (8 months ago)
- Topics: forex, stock-market, stock-prices
- Language: Python
- Homepage:
- Size: 213 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-candlestick


[](https://www.python.org/)
[](https://www.djangoproject.com/)
[](https://github.com/samirelanduk/django-candlestick/blob/master/LICENSE)django-candlestick is a django library for storing price data for stocks, assets,
currencies, and other tradeable instruments.## Setup
Install:
```bash
$ pip install django-candlestick
```Add to installed apps:
```python
INSTALLED_APPS = [
...
"candlestick"
...
]
```Migrate:
```bash
$ python manage.py migrate
```You now have a database of tradeable instruments and their prices.
## Use
### Manual
```python
from candlestick.models import Instrument, Barapple = 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
```python
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:
```bash
$ python manage.py fetch AAPL D
```To update bars for an instrument:
```bash
$ python manage.py update AAPL D
```To update bars for multiple instruments:
```bash
$ python manage.py update AAPL,AMZN D
```To update bars for all instruments:
```bash
$ python manage.py update all D
```