cryptofeed-werks


Namecryptofeed-werks JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/globophobe/cryptofeed-werks
SummaryWebSocket subclasses, and experiments, for data from cryptocurrency exchanges
upload_time2023-10-15 02:20:18
maintainer
docs_urlNone
authorAlex
requires_python>=3.8,<4.0
licenseMIT
keywords cryptocurrency trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # What?

This is the basis of a pipeline for live data from cryptocurrency exchanges. It normalizes [cryptofeed](https://github.com/bmoscon/cryptofeed) WebSocket messages, aggregates, and optionally publishes them to GCP Pub/Sub.

# How?

Sequences of trades that have equal symbol, timestamp, and tick rule are aggregated. Aggregating trades in this way can increase information, as they are either orders of size or stop loss cascades.

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

By filtering aggregated messages, for example only emitting a mesage when an aggregated trade is greater than or equal to a `significant_trade_filter`, the number of messages can be reduced more.

Example
-------
The following are two sequential aggregated trades by timestamp, nanoseconds, and tick rule.

As it was aggregated from 4 raw trades, the second trade has ticks 4.

```python
[
    {
        "timestamp": 1620000915.31424,
        "price": "57064.01",
        "volume": "566.6479018604",
        "notional": "0.00993004",
        "tickRule": -1,
        "ticks": 1
    },
    {
        "timestamp": 1620000915.885381,
        "price": "57071.2",
        "volume": "9376.6869202914",
        "notional": "0.16429813",
        "tickRule": 1,
        "ticks": 4
    }
]
```

An example filtered message, emitted because the second aggregated trade exceeds `significant_trade_filter >= 1000`

Information related to the first trade is aggregated with the second.

```python
[
    {
        "timestamp": 1620000915.885381,
        "price": "57071.2",
        "volume": "9376.6869202914",
        "notional": "0.16429813",
        "tickRule": 1,
        "ticks": 4,
        "high": '57071.2',
        "low": '57064.01',
        "totalBuyVolume": "9376.6869202914",
        "totalVolume": "9943.3348221518",
        "totalBuyNotional": "0.16429813",
        "totalNotional": "0.17422817",
        "totalBuyTicks": 4,
        "totalTicks": 5
    }
]
```

For 1m, 5m, 15m candles, there is an optional parameter `window_seconds`.  

For settings, see the [examples](https://github.com/globophobe/cryptofeed-werks/blob/main/examples/)

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

:white_check_mark: Binance

:white_check_mark: Bitfinex

:white_check_mark: Bitflyer

:white_check_mark: BitMEX

:white_check_mark: Bybit

:white_check_mark: Coinbase Pro

:white_check_mark: Upbit

Contributing
------------

Install dependencies with `poetry install`. The docker example is built with [invoke tasks](https://github.com/globophobe/cryptofeed-werks/blob/master/tasks.py). For example, `invoke build`

Future plans
------------
Order book aggregation, in the manner of [crypto-whale-watching-app](https://github.com/pmaji/crypto-whale-watching-app)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/globophobe/cryptofeed-werks",
    "name": "cryptofeed-werks",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "cryptocurrency,trading",
    "author": "Alex",
    "author_email": "globophobe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/73/a7/682ff1f32ec31ae15896cde69b6faded3fd1112b731f41cb10ea5c36adce/cryptofeed_werks-0.1.6.tar.gz",
    "platform": null,
    "description": "# What?\n\nThis is the basis of a pipeline for live data from cryptocurrency exchanges. It normalizes [cryptofeed](https://github.com/bmoscon/cryptofeed) WebSocket messages, aggregates, and optionally publishes them to GCP Pub/Sub.\n\n# How?\n\nSequences of trades that have equal symbol, timestamp, and tick rule are aggregated. 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 messages can be reduced by 30-50%\n\nBy filtering aggregated messages, for example only emitting a mesage when an aggregated trade is greater than or equal to a `significant_trade_filter`, the number of messages can be reduced more.\n\nExample\n-------\nThe following are two sequential aggregated trades by timestamp, nanoseconds, and tick rule.\n\nAs it was aggregated from 4 raw trades, the second trade has ticks 4.\n\n```python\n[\n    {\n        \"timestamp\": 1620000915.31424,\n        \"price\": \"57064.01\",\n        \"volume\": \"566.6479018604\",\n        \"notional\": \"0.00993004\",\n        \"tickRule\": -1,\n        \"ticks\": 1\n    },\n    {\n        \"timestamp\": 1620000915.885381,\n        \"price\": \"57071.2\",\n        \"volume\": \"9376.6869202914\",\n        \"notional\": \"0.16429813\",\n        \"tickRule\": 1,\n        \"ticks\": 4\n    }\n]\n```\n\nAn example filtered message, emitted because the second aggregated trade exceeds `significant_trade_filter >= 1000`\n\nInformation related to the first trade is aggregated with the second.\n\n```python\n[\n    {\n        \"timestamp\": 1620000915.885381,\n        \"price\": \"57071.2\",\n        \"volume\": \"9376.6869202914\",\n        \"notional\": \"0.16429813\",\n        \"tickRule\": 1,\n        \"ticks\": 4,\n        \"high\": '57071.2',\n        \"low\": '57064.01',\n        \"totalBuyVolume\": \"9376.6869202914\",\n        \"totalVolume\": \"9943.3348221518\",\n        \"totalBuyNotional\": \"0.16429813\",\n        \"totalNotional\": \"0.17422817\",\n        \"totalBuyTicks\": 4,\n        \"totalTicks\": 5\n    }\n]\n```\n\nFor 1m, 5m, 15m candles, there is an optional parameter `window_seconds`.  \n\nFor settings, see the [examples](https://github.com/globophobe/cryptofeed-werks/blob/main/examples/)\n\nSupported exchanges\n-------------------\n\n:white_check_mark: Binance\n\n:white_check_mark: Bitfinex\n\n:white_check_mark: Bitflyer\n\n:white_check_mark: BitMEX\n\n:white_check_mark: Bybit\n\n:white_check_mark: Coinbase Pro\n\n:white_check_mark: Upbit\n\nContributing\n------------\n\nInstall dependencies with `poetry install`. The docker example is built with [invoke tasks](https://github.com/globophobe/cryptofeed-werks/blob/master/tasks.py). For example, `invoke build`\n\nFuture plans\n------------\nOrder book aggregation, in the manner of [crypto-whale-watching-app](https://github.com/pmaji/crypto-whale-watching-app)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "WebSocket subclasses, and experiments, for data from cryptocurrency exchanges",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/globophobe/cryptofeed-werks",
        "Repository": "https://github.com/globophobe/cryptofeed-werks"
    },
    "split_keywords": [
        "cryptocurrency",
        "trading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3fd4debba916670ba3fc34373e9b96de181fbcdbfaea5f8e601911cd2a9c4698",
                "md5": "74de627f624caddc86dbb841b3b5e1c2",
                "sha256": "e7d9dd2d2bf0839e8cb34048902fbf5b69f9371d9939269847fafdec6142664e"
            },
            "downloads": -1,
            "filename": "cryptofeed_werks-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74de627f624caddc86dbb841b3b5e1c2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 18220,
            "upload_time": "2023-10-15T02:20:17",
            "upload_time_iso_8601": "2023-10-15T02:20:17.260327Z",
            "url": "https://files.pythonhosted.org/packages/3f/d4/debba916670ba3fc34373e9b96de181fbcdbfaea5f8e601911cd2a9c4698/cryptofeed_werks-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73a7682ff1f32ec31ae15896cde69b6faded3fd1112b731f41cb10ea5c36adce",
                "md5": "b8e27ed079eac0662cc45017e76b9885",
                "sha256": "f9c72b5fb80ced7124636c0a388ff0b4fcdac57433ff2579f9bbda7b44dd72ac"
            },
            "downloads": -1,
            "filename": "cryptofeed_werks-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "b8e27ed079eac0662cc45017e76b9885",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 12209,
            "upload_time": "2023-10-15T02:20:18",
            "upload_time_iso_8601": "2023-10-15T02:20:18.999944Z",
            "url": "https://files.pythonhosted.org/packages/73/a7/682ff1f32ec31ae15896cde69b6faded3fd1112b731f41cb10ea5c36adce/cryptofeed_werks-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-15 02:20:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "globophobe",
    "github_project": "cryptofeed-werks",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cryptofeed-werks"
}
        
Elapsed time: 0.12750s