{"id":13449714,"url":"https://github.com/bmoscon/cryptofeed","last_synced_at":"2025-05-12T15:18:50.705Z","repository":{"id":38539804,"uuid":"114459569","full_name":"bmoscon/cryptofeed","owner":"bmoscon","description":"Cryptocurrency Exchange Websocket Data Feed Handler","archived":false,"fork":false,"pushed_at":"2025-02-08T23:40:30.000Z","size":121348,"stargazers_count":2423,"open_issues_count":82,"forks_count":722,"subscribers_count":78,"default_branch":"master","last_synced_at":"2025-05-12T15:18:30.690Z","etag":null,"topics":["asyncio","binance","bitcoin","btc","coinbase","coinbase-api","crypto","cryptocurrencies","cryptocurrency","ethereum","exchange","ftx-exchange","influxdb","market-data","python","trading","trading-platform","websocket","websockets"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmoscon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"bmoscon","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-12-16T12:35:23.000Z","updated_at":"2025-05-11T18:57:38.000Z","dependencies_parsed_at":"2024-01-15T01:56:39.627Z","dependency_job_id":"a00e3810-2f65-4aae-b147-c34612f13330","html_url":"https://github.com/bmoscon/cryptofeed","commit_stats":{"total_commits":2256,"total_committers":127,"mean_commits":"17.763779527559056","dds":0.1578014184397163,"last_synced_commit":"0cdc5d7eb66da69c420a65cb8061367d3d37e5c8"},"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmoscon%2Fcryptofeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmoscon%2Fcryptofeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmoscon%2Fcryptofeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmoscon%2Fcryptofeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmoscon","download_url":"https://codeload.github.com/bmoscon/cryptofeed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253763962,"owners_count":21960484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","binance","bitcoin","btc","coinbase","coinbase-api","crypto","cryptocurrencies","cryptocurrency","ethereum","exchange","ftx-exchange","influxdb","market-data","python","trading","trading-platform","websocket","websockets"],"created_at":"2024-07-31T06:00:52.145Z","updated_at":"2025-05-12T15:18:50.153Z","avatar_url":"https://github.com/bmoscon.png","language":"Python","readme":"# Cryptocurrency Exchange Feed Handler\n[![License](https://img.shields.io/badge/license-XFree86-blue.svg)](LICENSE)\n![Python](https://img.shields.io/badge/Python-3.8+-green.svg)\n[![PyPi](https://img.shields.io/badge/PyPi-cryptofeed-brightgreen.svg)](https://pypi.python.org/pypi/cryptofeed)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/efa4e0d6e10b41d0b51454d08f7b33b1)](https://www.codacy.com/app/bmoscon/cryptofeed?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=bmoscon/cryptofeed\u0026amp;utm_campaign=Badge_Grade)\n\nHandles multiple cryptocurrency exchange data feeds and returns normalized and standardized results to client registered callbacks for events like trades, book updates, ticker updates, etc. Utilizes websockets when possible, but can also poll data via REST endpoints if a websocket is not provided.\n\n## Supported exchanges\n\n* [AscendEX](https://ascendex.com/)\n* [Bequant](https://bequant.io/)\n* [Bitfinex](https://bitfinex.com)\n* [bitFlyer](https://bitflyer.com/)\n* [Bithumb](https://en.bithumb.com/)\n* [Bitstamp](https://www.bitstamp.net/)\n* [Blockchain.com](https://www.blockchain.com/)\n* [Bybit](https://www.bybit.com/)\n* [Binance](https://www.binance.com/en)\n* [Binance Delivery](https://binance-docs.github.io/apidocs/delivery/en/)\n* [Binance Futures](https://www.binance.com/en/futures)\n* [Binance US](https://www.binance.us/en)\n* [Bit.com](https://www.bit.com)\n* [Bitget](https://www.bitget.com/)\n* [BitMEX](https://www.bitmex.com/)\n* [Coinbase](https://www.coinbase.com/)\n* [Crypto.com](https://www.crypto.com)\n* [Delta](https://www.delta.exchange/)\n* [Deribit](https://www.deribit.com/)\n* [dYdX](https://dydx.exchange/)\n* [FMFW.io](https://www.fmfw.io/)\n* [EXX](https://www.exx.com/)\n* [Gate.io](https://www.gate.io/)\n* [Gate.io Futures](https://www.gate.io/futures_center)\n* [Gemini](https://gemini.com/)\n* [HitBTC](https://hitbtc.com/)\n* [Huobi](https://www.hbg.com/)\n* [Huobi DM](https://www.huobi.com/en-us/markets/hb_dm/)\n* Huobi Swap (Coin-M and USDT-M)\n* [Independent Reserve](https://www.independentreserve.com/) \n* [Kraken](https://www.kraken.com/)\n* [Kraken Futures](https://futures.kraken.com/)\n* [KuCoin](https://www.kucoin.com/)\n* [OKCoin](http://okcoin.com/)\n* [OKX](https://www.okx.com/)\n* [Phemex](https://phemex.com/)\n* [Poloniex](https://www.poloniex.com/)\n* [ProBit](https://www.probit.com/)\n* [Upbit](https://sg.upbit.com/home)\n\n\n## Basic Usage\n\nCreate a FeedHandler object and add subscriptions. For the various data channels that an exchange supports, you can supply callbacks for data events, or use provided backends (described below) to handle the data for you. Start the feed handler and you're done!\n\n```python\nfrom cryptofeed import FeedHandler\n# not all imports shown for clarity\n\nfh = FeedHandler()\n\n# ticker, trade, and book are user defined functions that\n# will be called when ticker, trade and book updates are received\nticker_cb = {TICKER: ticker}\ntrade_cb = {TRADES: trade}\ngemini_cb = {TRADES: trade, L2_BOOK: book}\n\n\nfh.add_feed(Coinbase(symbols=['BTC-USD'], channels=[TICKER], callbacks=ticker_cb))\nfh.add_feed(Bitfinex(symbols=['BTC-USD'], channels=[TICKER], callbacks=ticker_cb))\nfh.add_feed(Poloniex(symbols=['BTC-USDT'], channels=[TRADES], callbacks=trade_cb))\nfh.add_feed(Gemini(symbols=['BTC-USD', 'ETH-USD'], channels=[TRADES, L2_BOOK], callbacks=gemini_cb))\n\nfh.run()\n```\n\nPlease see the [examples](https://github.com/bmoscon/cryptofeed/tree/master/examples) for more code samples and the [documentation](https://github.com/bmoscon/cryptofeed/blob/master/docs/README.md) for more information about the library usage.\n\n\nFor an example of a containerized application using cryptofeed to store data to a backend, please see [Cryptostore](https://github.com/bmoscon/cryptostore).\n\n\n## National Best Bid/Offer (NBBO)\n\nCryptofeed also provides a synthetic [NBBO](examples/demo_nbbo.py) (National Best Bid/Offer) feed that aggregates the best bids and asks from the user specified feeds.\n\n```python\nfrom cryptofeed import FeedHandler\nfrom cryptofeed.exchanges import Coinbase, Gemini, Kraken\n\n\ndef nbbo_update(symbol, bid, bid_size, ask, ask_size, bid_feed, ask_feed):\n    print(f'Pair: {symbol} Bid Price: {bid:.2f} Bid Size: {bid_size:.6f} Bid Feed: {bid_feed} Ask Price: {ask:.2f} Ask Size: {ask_size:.6f} Ask Feed: {ask_feed}')\n\n\ndef main():\n    f = FeedHandler()\n    f.add_nbbo([Coinbase, Kraken, Gemini], ['BTC-USD'], nbbo_update)\n    f.run()\n```\n\n## Supported Channels\n\nCryptofeed supports the following channels from exchanges:\n\n### Market Data Channels (Public)\n\n* L1_BOOK - Top of book\n* L2_BOOK - Price aggregated sizes. Some exchanges provide the entire depth, some provide a subset.\n* L3_BOOK - Price aggregated orders. Like the L2 book, some exchanges may only provide partial depth.\n* TRADES - Note this reports the taker's side, even for exchanges that report the maker side.\n* TICKER\n* FUNDING\n* OPEN_INTEREST - Open interest data.\n* LIQUIDATIONS\n* INDEX\n* CANDLES - Candlestick / K-Line data.\n\n### Authenticated Data Channels\n\n* ORDER_INFO - Order status updates\n* TRANSACTIONS - Real-time updates on account deposits and withdrawals\n* BALANCES - Updates on wallet funds\n* FILLS - User's executed trades\n\n\n## Backends\n\nCryptofeed supports `backend` callbacks that will write directly to storage or other interfaces.\n\nSupported Backends:\n* Redis (Streams and Sorted Sets)\n* [Arctic](https://github.com/manahl/arctic)\n* ZeroMQ\n* UDP Sockets\n* TCP Sockets\n* Unix Domain Sockets\n* [InfluxDB v2](https://github.com/influxdata/influxdb)\n* MongoDB\n* Kafka\n* RabbitMQ\n* PostgreSQL\n* [QuasarDB](https://quasar.ai/)\n* GCP Pub/Sub\n* [QuestDB](https://questdb.io/)\n\n\n## Installation\n\n**Note:** cryptofeed requires Python 3.8+\n\nCryptofeed can be installed from PyPi. (It's recommended that you install in a virtual environment of your choosing).\n\n    pip install cryptofeed\n\nCryptofeed has optional dependencies, depending on the backends used. You can install them individually, or all at once. To install Cryptofeed along with all its optional dependencies in one bundle:\n\n    pip install cryptofeed[all]\n\nIf you wish to clone the repository and install from source, run this command from the root of the cloned repository.\n\n    python setup.py install\n\nAlternatively, you can install in 'edit' mode (also called development mode):\n\n    python setup.py develop\n\nSee more discussion of package installation in [INSTALL.md](https://github.com/bmoscon/cryptofeed/blob/master/INSTALL.md).\n\n\n\n## Rest API\n\nCryptofeed supports some REST interfaces for retrieving real-time and historical data, as well as order placement and account management. These are integrated into the exchange classes directly. You can view the supported methods by calling the `info()` method on any exchange. The methods for interacting with the exchange RET endpoints exist in two flavors, the synchronous methods (suffixed with `_sync`) as well as the asynchronous which can be utilized with asyncio. For more information see the [documentation](docs/rest.md).\n\n\n## Future Work\n\nThere are a lot of planned features, new exchanges, etc planned! If you'd like to discuss ongoing development, please join the [discord](https://discord.gg/zaBYaGAYfR) or open a thread in the [discussions](https://github.com/bmoscon/cryptofeed/discussions) in GitHub.\n\n## Contributing\n\nIssues and PRs are welcomed!\n\nCryptofeed wouldn't be possible without the help of many [contributors](AUTHORS.md)! I owe them and all other contributors my thanks!\n\n## Donations / Support\n\nSupport and donations are appreciated but not required. You can donate via [GitHub Sponsors](https://github.com/sponsors/bmoscon), or via the addresses below:\n\n* Bitcoin: bc1qm0kxz8hqacaglku5fjhfe9a5hjnuyfwk02lsyr\n* Ethereum: 0x690709FEe13eEce9E7852089BB2D53Ae5D073154\n","funding_links":["https://github.com/sponsors/bmoscon"],"categories":["Data Sources","Data Source","Python"],"sub_categories":["Cryptocurrencies","Crypto"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmoscon%2Fcryptofeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmoscon%2Fcryptofeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmoscon%2Fcryptofeed/lists"}