https://github.com/globophobe/asyncio-quant-tick
🔌 Aggregate candlesticks from high frequency tick data from WebSockets
https://github.com/globophobe/asyncio-quant-tick
binance bitfinex bitflyer bitmex bybit candlesticks coinbase cryptocurrency quant tick-data trading trading-strategies upbit
Last synced: 4 months ago
JSON representation
🔌 Aggregate candlesticks from high frequency tick data from WebSockets
- Host: GitHub
- URL: https://github.com/globophobe/asyncio-quant-tick
- Owner: globophobe
- License: mit
- Created: 2021-04-12T22:12:15.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-17T08:31:18.000Z (about 2 years ago)
- Last Synced: 2024-06-09T10:37:09.381Z (almost 2 years ago)
- Topics: binance, bitfinex, bitflyer, bitmex, bybit, candlesticks, coinbase, cryptocurrency, quant, tick-data, trading, trading-strategies, upbit
- Language: Python
- Homepage:
- Size: 578 KB
- Stars: 24
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# What?
Asyncio Quant Tick aggregates candlesticks from high frequency tick data from WebSockets.
# 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/asyncio-quant-tick/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/asyncio-quant-tick/blob/master/tasks.py). For example, `invoke build`