Skip to main content

Django Quant Tick downloads and aggregate candlesticks from tick data

Project description

What?

Django Quant Tick downloads and aggregate candlesticks from tick data.

Why?

Candlesticks aggregated by django-quant-tick are informationally dense. Such data can be useful for analyzing financial markets. As an example, refer to "Low-Frequency Traders in a High-Frequency World: A Survival Guide" and "The Volume Clock: Insights into the High Frequency Paradigm". Lopez de Prado recommends volume bars, however they are are computationally expensive to generate.

By aggregating and filtering raw ticks, they can be computed faster, with little loss in precision.

This optional aggregation is by equal symbol, timestamp, nanoseconds and tick rule. As described in the accompanying project cryptofeed-werks, aggregating trades in this way can increase information, as they are either orders of size or stop loss cascades.

As well, the number of rows can be reduced by 30-50%

By filtering aggregated rows, for example only writing a row when an aggregated trade is greater than significant_trade_filter >= 1000, the number of rows can be reduced more.

How?

Whenever possible, data is downloaded from the exchange's AWS S3 repositories. Otherwise, it is downloaded using their REST APIs.

A database, preferably PostgreSQL, is required. Data is saved to the database after aggregation and filtering.

Candles are aggregated at 1 minute intervals, and validated with the exchange's historical candle API.

Notes.

Supported exchanges

:white_medium_square: Binance REST API (requires API key, which requires KYC)

  • Other exchanges validate trade data downloaded from exchanges using candle data provided by exchanges. However, I did not complete KYC, and as a resident of Japan am not currently able to do so. Support is incomplete. Pull requests are welcome.

:white_check_mark: Bitfinex REST API

:white_check_mark: BitMEX REST API, and S3 repository

:white_check_mark: Bybit S3 repository.

  • The REST API is no longer paginated, so data may be delayed 24 hours or more.

:white_check_mark: Coinbase Pro REST API

Note: Exchanges without paginated REST APIs or an S3 repository, will never be supported.

Installation

For convenience, django-quant-tick can be installed from PyPI:

pip install django-quant-tick

Deployment

For deployment, there are Dockerfiles. As well, there are invoke tasks for deployment to Google Cloud Run. Just as easily, the demo could be deployed to a VPS or AWS.

If using GCP, it is recommended to use the Cloud SQL Auth proxy, and run the management commands to collect data from your local machine. Django Quant Tick will upload the trade data to the cloud.

cd demo
invoke start-proxy
python proxy.py trades

Then, configure a Cloud Workflow to collect data in the cloud. There is an example workflow in the invoke tasks.

Environment

To use the scripts or deploy to GCP, rename .env.sample to .env, and add the required settings.

Project details


Download files

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

Source Distribution

django_quant_tick-0.1.3.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

django_quant_tick-0.1.3-py3-none-any.whl (108.4 kB view details)

Uploaded Python 3

File details

Details for the file django_quant_tick-0.1.3.tar.gz.

File metadata

  • Download URL: django_quant_tick-0.1.3.tar.gz
  • Upload date:
  • Size: 62.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/5.15.0-87-generic

File hashes

Hashes for django_quant_tick-0.1.3.tar.gz
Algorithm Hash digest
SHA256 66911e68544a45f0feae8ce5aa9a15b4924fa5ec8557c5c13de463130cfdb2fc
MD5 f26186bc43361ab4056b2e2827091600
BLAKE2b-256 d74803ac60159b3f61be274b9db0a85bca5f741b31ca8e35484b8651fdd7aaf7

See more details on using hashes here.

File details

Details for the file django_quant_tick-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: django_quant_tick-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/5.15.0-87-generic

File hashes

Hashes for django_quant_tick-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4df306745926fbfcfa8765329e2e03a3948ea2aad90dd19237dc44c9c213e1e3
MD5 0adafa918e7061830c645408dc50ba4f
BLAKE2b-256 398e5034dd55a83a8872660d458a95d4d9b23ecc8005cb5da06fecd808c547b5

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