Coder Social home page Coder Social logo

globophobe / asyncio-quant-tick Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 12.0 592 KB

๐Ÿ”Œ Aggregate candlesticks from high frequency tick data from WebSockets

License: MIT License

Python 98.91% Dockerfile 1.09%
trading bybit bitmex binance bitfinex bitflyer coinbase upbit tick-data candlesticks

asyncio-quant-tick's Introduction

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.

[
    {
        "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.

[
    {
        "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

Supported exchanges

โœ… Binance

โœ… Bitfinex

โœ… Bitflyer

โœ… BitMEX

โœ… Bybit

โœ… Coinbase Pro

โœ… Upbit

Contributing

Install dependencies with poetry install. The docker example is built with invoke tasks. For example, invoke build

asyncio-quant-tick's People

Contributors

globophobe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asyncio-quant-tick's Issues

Upgrade cryptofeed to v2

There was a problem with websockets==10
The cryptofeed repo merged a PR and closed the issue, but it still exists

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.