django-quant-tick


Namedjango-quant-tick JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/globophobe/django-quant-tick
SummaryDjango Quant Tick downloads and aggregate candlesticks from tick data
upload_time2023-11-06 00:57:42
maintainer
docs_urlNone
authorAlex
requires_python>=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*, !=3.11.*
licenseMIT
keywords django cryptocurrency candlesticks quant trading tick data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # What?

Django Quant Tick downloads and aggregate candlesticks from tick data.

<img src="https://raw.githubusercontent.com/globophobe/django-quant-tick/main/docs/assets/volume-candles.png" />

# 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"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2150876) and ["The Volume Clock: Insights into the High Frequency Paradigm"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2034858). 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](https://github.com/globophobe/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](https://github.com/globophobe/django-quant-tick/blob/main/NOTES.md).

Supported exchanges
-------------------

:white_medium_square: Binance REST API (requires API key, which requires KYC)
* <em style="font-size: 0.9em">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.</em>

:white_check_mark: Bitfinex REST API

:white_check_mark: BitMEX REST API, and [S3](https://public.bitmex.com/) repository

:white_check_mark: Bybit [S3](https://public.bybit.com/) repository. 
* <em style="font-size: 0.9em">The REST API is no longer paginated, so data may be delayed 24 hours or more.</em>

: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](https://github.com/globophobe/django-quant-tick/blob/main/demo/tasks.py).

Environment
-----------

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/globophobe/django-quant-tick",
    "name": "django-quant-tick",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*, !=3.11.*",
    "maintainer_email": "",
    "keywords": "django,cryptocurrency,candlesticks,quant,trading,tick,data",
    "author": "Alex",
    "author_email": "globophobe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d7/48/03ac60159b3f61be274b9db0a85bca5f741b31ca8e35484b8651fdd7aaf7/django_quant_tick-0.1.3.tar.gz",
    "platform": null,
    "description": "# What?\n\nDjango Quant Tick downloads and aggregate candlesticks from tick data.\n\n<img src=\"https://raw.githubusercontent.com/globophobe/django-quant-tick/main/docs/assets/volume-candles.png\" />\n\n# Why?\n\nCandlesticks 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\"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2150876) and [\"The Volume Clock: Insights into the High Frequency Paradigm\"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2034858). Lopez de Prado recommends volume bars, however they are are computationally expensive to generate.\n\nBy aggregating and filtering raw ticks, they can be computed faster, with little loss in precision.\n\nThis optional aggregation is by equal symbol, timestamp, nanoseconds and tick rule. As described in the accompanying project [cryptofeed-werks](https://github.com/globophobe/cryptofeed-werks), aggregating trades in this way can increase information, as they are either orders of size or stop loss cascades.\n\nAs well, the number of rows can be reduced by 30-50%\n\nBy 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.\n\n# How?\n\nWhenever possible, data is downloaded from the exchange's AWS S3 repositories. Otherwise, it is downloaded using their REST APIs. \n\nA database, preferably PostgreSQL, is required. Data is saved to the database after aggregation and filtering. \n\nCandles are aggregated at 1 minute intervals, and validated with the exchange's historical candle API.\n\n[Notes](https://github.com/globophobe/django-quant-tick/blob/main/NOTES.md).\n\nSupported exchanges\n-------------------\n\n:white_medium_square: Binance REST API (requires API key, which requires KYC)\n* <em style=\"font-size: 0.9em\">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.</em>\n\n:white_check_mark: Bitfinex REST API\n\n:white_check_mark: BitMEX REST API, and [S3](https://public.bitmex.com/) repository\n\n:white_check_mark: Bybit [S3](https://public.bybit.com/) repository. \n* <em style=\"font-size: 0.9em\">The REST API is no longer paginated, so data may be delayed 24 hours or more.</em>\n\n:white_check_mark: Coinbase Pro REST API\n\nNote: Exchanges without paginated REST APIs or an S3 repository, will never be supported.\n\nInstallation\n------------\n\nFor convenience, `django-quant-tick` can be installed from PyPI:\n\n```\npip install django-quant-tick\n```\n\nDeployment\n----------\n\nFor 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.\n\nIf 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.\n\n```\ncd demo\ninvoke start-proxy\npython proxy.py trades\n```\n\nThen, configure a Cloud Workflow to collect data in the cloud. There is an example workflow in the [invoke tasks](https://github.com/globophobe/django-quant-tick/blob/main/demo/tasks.py).\n\nEnvironment\n-----------\n\nTo use the scripts or deploy to GCP, rename `.env.sample` to `.env`, and add the required settings.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django Quant Tick downloads and aggregate candlesticks from tick data",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/globophobe/django-quant-tick",
        "Repository": "https://github.com/globophobe/django-quant-tick"
    },
    "split_keywords": [
        "django",
        "cryptocurrency",
        "candlesticks",
        "quant",
        "trading",
        "tick",
        "data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "398e5034dd55a83a8872660d458a95d4d9b23ecc8005cb5da06fecd808c547b5",
                "md5": "0adafa918e7061830c645408dc50ba4f",
                "sha256": "4df306745926fbfcfa8765329e2e03a3948ea2aad90dd19237dc44c9c213e1e3"
            },
            "downloads": -1,
            "filename": "django_quant_tick-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0adafa918e7061830c645408dc50ba4f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*, !=3.11.*",
            "size": 108429,
            "upload_time": "2023-11-06T00:57:39",
            "upload_time_iso_8601": "2023-11-06T00:57:39.776370Z",
            "url": "https://files.pythonhosted.org/packages/39/8e/5034dd55a83a8872660d458a95d4d9b23ecc8005cb5da06fecd808c547b5/django_quant_tick-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d74803ac60159b3f61be274b9db0a85bca5f741b31ca8e35484b8651fdd7aaf7",
                "md5": "f26186bc43361ab4056b2e2827091600",
                "sha256": "66911e68544a45f0feae8ce5aa9a15b4924fa5ec8557c5c13de463130cfdb2fc"
            },
            "downloads": -1,
            "filename": "django_quant_tick-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f26186bc43361ab4056b2e2827091600",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*, !=3.11.*",
            "size": 62466,
            "upload_time": "2023-11-06T00:57:42",
            "upload_time_iso_8601": "2023-11-06T00:57:42.133948Z",
            "url": "https://files.pythonhosted.org/packages/d7/48/03ac60159b3f61be274b9db0a85bca5f741b31ca8e35484b8651fdd7aaf7/django_quant_tick-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-06 00:57:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "globophobe",
    "github_project": "django-quant-tick",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-quant-tick"
}
        
Elapsed time: 0.14317s