Maintained

Cryptofeed guide

Cryptofeed is the go-to tool for collecting real-time crypto data you can later backtest on.

Last reviewed

Quick answer

Cryptofeed is an open-source Python library that connects to many crypto exchanges’ WebSocket feeds and normalizes trades, tickers, order books, funding, open interest and liquidations into common objects delivered to your callbacks. Backends write data to Redis, Postgres, Kafka, Arctic and more, making it a common choice for recording tick data.

Cryptofeed at a glance

Category
Broker, exchange & data libraries
Language
Python
License
XFree86
Does
Market data
Markets
Crypto
Best for
Recording order-book and trade data, and real-time signals across exchanges.
In AlgoGP
Use the exported strategy object from your own code

Pick it if

Recording order-book and trade data, and real-time signals across exchanges.

Watch out for

Market data only; no order execution.

Cryptofeed strengths and limitations

Strengths

  • Normalized feeds across exchanges.
  • Book management with checksums where supported.
  • Many storage backends.

Limitations

  • Market data only; no order execution.
  • You manage infrastructure for long-running capture.

Cryptofeed example

pip install cryptofeed
Install
from cryptofeed import FeedHandler
from cryptofeed.defines import TRADES
from cryptofeed.exchanges import Coinbase, Kraken

async def trade(t, receipt_ts):
    print(t.exchange, t.symbol, t.side, t.amount, t.price)

fh = FeedHandler()
for ex in (Coinbase, Kraken):
    fh.add_feed(ex(symbols=["BTC-USD"], channels=[TRADES], callbacks={TRADES: trade}))
fh.run()
Print BTC trades from two exchanges.

Use Cryptofeed with AlgoGP

AlgoGP does not add Cryptofeed to projects automatically yet, but nothing stops you using them together. Every AlgoGP project exports plain Python with a framework-neutral strategy object, so you can call it from Cryptofeed yourself.

  1. 1

    Design and backtest in AlgoGP

    Describe the idea to the copilot and backtest it on AlgoGP’s normalized history.

  2. 2

    Add any bridge to get the adapter core

    Adding a bridged framework (for example Backtrader) writes frameworks/algogp_bridge.py, whose StrategyBridge.on_bar() returns the orders the strategy wants.

  3. 3

    Call it from Cryptofeed

    Feed Cryptofeed’s bars to StrategyBridge, place the returned orders with Cryptofeed, and report fills back with sync().

Cryptofeed connects to Binance, Bybit, OKX, Kraken, Coinbase Exchange, Gemini, Bitfinex, Deribit, BitMEX, KuCoin. Each guide shows how to create the API key, which you can store in the project’s Keys & secrets.

Cryptofeed: frequently asked questions

Can Cryptofeed place orders?

No; pair it with CCXT or an exchange SDK for execution.

Cryptofeed alternatives

Independent guide. AlgoGP is not affiliated with Cryptofeed. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.

Build a strategy