---
title: "Bitfinex Crypto Price Data"
description: "Bitfinex Crypto Price Data dataset from QuantConnect."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/quantconnect/bitfinex-crypto-price-data
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/quantconnect/bitfinex-crypto-price-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/14%20Datasets/02%20QuantConnect/05%20Bitfinex%20Crypto%20Price%20Data
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Bitfinex Crypto Price Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Datasets > [QuantConnect](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/quantconnect.md) > Bitfinex Crypto Price Data

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

The Bitfinex Crypto Price Data is for Cryptocurrency price and volume data points. The data covers 570 Cryptocurrency pairs, starts in January 2013, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Bitfinex.

For more information about the Bitfinex Crypto Price Data dataset, including CLI commands and pricing, see the [dataset listing](https://www.quantconnect.com/datasets/bitfinex-crypto-price-data).

## About the Provider

Bitfinex was founded by Giancarlo Devasini and Raphael Nicolle in 2012 with the goal to "give our users the ultimate cryptocurrency trading experience". Bitfinex provides access to trading Crypto for clients outside [prohibited jurisdictions](https://www.bitfinex.com/legal/exchange/terms) with no minimum deposit to set up an account. If you fund your account with fiat currency, they enforce a [10,000 minimum](https://support.bitfinex.com/hc/en-us/articles/360023357574-Bank-Wire-Deposit-) for USD, EUR, and GBP. However, if you fund your account with Crypto, they do not enforce a minimum deposit. Bitfinex also provides Crypto staking, a mobile app, and an unrealized profit leaderboard for the traders on the platform. Bitfinex has always been at the forefront of technological innovation in digital asset trading.

## Getting Started

The following snippet demonstrates how to request data from the Bitfinex Crypto Price dataset:

```python
# Bitfinex accepts both Cash and Margin type account.
self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.CASH)
#self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN)

self.btcusd = self.add_crypto("BTCUSD", Resolution.MINUTE, Market.BITFINEX).symbol

self._universe = self.add_universe(CryptoUniverse.bitfinex(self.universe_selection_filter))
```

## Data Summary

The following table describes the dataset properties:

| Property | Value |
| --- | --- |
| Start Date | January 2013 |
| Asset Coverage | 570 Currency Pairs |
| Data Density | Dense |
| Resolution | Tick, Second, Minute, Hourly, & Daily |
| Timezone | UTC |
| Market Hours | [Always Open](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/market-hours.md) |

## Requesting Data

To add Bitfinex Crypto Price data to your algorithm, call the `add_crypto` method. Save a reference to the Crypto `Symbol` so you can access the data later in your algorithm.

```python
class CoinAPIDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2020, 6, 1)
        self.set_end_date(2021, 6, 1)
        self.set_cash(100000)

        # Bitfinex accepts both Cash and Margin type account.
        self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN)

        self.btcusd = self.add_crypto("BTCUSD", Resolution.MINUTE, Market.BITFINEX).symbol
```

For more information about creating Crypto subscriptions, see [Requesting Data](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/crypto/requesting-data.md).

## Accessing Data

To get the current Bitfinex Crypto Price data, index the `bars`, `quote_bars`, or `ticks` properties of the current [`Slice`](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/timeslices.md) with the Crypto `Symbol`. `Slice` objects deliver unique events to your algorithm as they happen, but the `Slice` may not contain data for your security at every time step. To avoid issues, check if the `Slice` contains the data you want before you index it.

```python
def on_data(self, slice: Slice) -> None:
    if self.btcusd in slice.bars:
        trade_bar = slice.bars[self.btcusd]
        self.log(f"{self.btcusd} close at {slice.time}: {trade_bar.close}")

    if self.btcusd in slice.quote_bars:
        quote_bar = slice.quote_bars[self.btcusd]
        self.log(f"{self.btcusd} bid at {slice.time}: {quote_bar.bid.close}")

    if self.btcusd in slice.ticks:
        ticks = slice.ticks[self.btcusd]
        for tick in ticks:
            self.log(f"{self.btcusd} price at {slice.time}: {tick.price}")
```

You can also iterate through all of the data objects in the current `Slice`.

```python
def on_data(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.bars.items():
        self.log(f"{symbol} close at {slice.time}: {trade_bar.close}")

    for symbol, quote_bar in slice.quote_bars.items():
        self.log(f"{symbol} bid at {slice.time}: {quote_bar.bid.close}")

    for symbol, ticks in slice.ticks.items():
        for tick in ticks:
            self.log(f"{symbol} price at {slice.time}: {tick.price}")
```

For more information about accessing Crypto data, see [Handling Data](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/crypto/handling-data.md).

## Historical Data

To get historical Bitfinex Crypto Price data, call the `history` method with the Crypto `Symbol`. If there is no data in the period you request, the history result is empty.

```python
# DataFrame
history_df = self.history(self.btcusd, 100, Resolution.DAILY)

# TradeBar objects
history_trade_bars = self.history[TradeBar](self.btcusd, 100, Resolution.MINUTE)

# QuoteBar objects
history_quote_bars = self.history[QuoteBar](self.btcusd, 100, Resolution.MINUTE)

# Tick objects
history_ticks = self.history[Tick](self.btcusd, timedelta(seconds=10), Resolution.TICK)
```

For more information about historical data, see [History Requests](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md).

## Universe Selection

To select a dynamic universe of Bitfinex Crypto pairs, call the `add_universe` method with a `CryptoUniverse` object. A [Crypto universe](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/crypto.md) uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

```python
def initialize(self) -> None:
    self.universe_settings.asynchronous = True
    self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN)
    self._universe = self.add_universe(CryptoUniverse.bitfinex(self.universe_selection_filter))

def universe_selection_filter(self, universe_day):
    return [c.symbol for c in universe_day if c.volume >= 100 and c.volume_in_usd > 10000]
```

For more information about universe settings, see [Settings](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/settings.md).

## Universe History

You can get historical universe data in an algorithm and in the Research Environment.

### Historical Universe Data in Algorithms

To get historical universe data in an algorithm, call the `history` method with the `Universe` object, and the lookback period. If there is no data in the period you request, the history result is empty.

```python
# DataFrame example where the columns are the CryptoUniverse attributes:
history_df = self.history(self._universe, 30, Resolution.DAILY, flatten=True)

# Series example where the values are lists of CryptoUniverse objects:
history = self.history(self._universe, 30, Resolution.DAILY)
for (univere_symbol, time), universe_day in history.items():
    for universe_item in universe_day:
        self.log(f"{universe_item.symbol} price at {universe_item.end_time}: {universe_item.close}")
```

### Historical Universe Data in Research

To get historical universe data in research, call the `universe_history` method with the `Universe` object, and the lookback period. The `universe_history` returns the filtered universe. If there is no data in the period you request, the history result is empty.

```python
# DataFrame example where the columns are the CryptoUniverse attributes:
history_df = qb.universe_history(universe, qb.time-timedelta(30), qb.time, flatten=True)

# Series example where the values are lists of CryptoUniverse objects:
universe_history = qb.universe_history(universe, qb.time-timedelta(30), qb.time)
for (univere_symbol, time), universe_day in universe_history.items():
    for universe_item in universe_day:
        print(f"{universe_item.symbol} price at {universe_item.end_time}: {universe_item.close}")
```

You can call the `history` method in Research.

## Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the `add_crypto` method, call the `remove_security` method.

```python
self.remove_security(self.btcusd)
```

The `remove_security` method cancels your open orders for the security and liquidates your holdings in the [virtual pair](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/crypto/holdings.md#03-Virtual-Pairs).

## Supported Assets

The following table shows the available Cryptocurrency pairs:

| Pairs Available (570) |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
| 1INCHUSD | 1INCHUSDT | AAABBB | AAVEUSD | AAVEUSDT | ADABTC |
| ADAUSD | ADAUSDT | AIOZUSD | AIXUSD | AIXUSDT | ALBTUSD |
| ALBTUSDT | ALGOBTC | ALGOUSD | ALGOUSDT | ALT11M2507USD | ALT11M2507USDT |
| ALT11M250830USD | ALT11M250830USDT | ALT11M251029USD | ALT11M251029USDT | ALT2612USD | ALT2612USDT |
| AMPLBTC | AMPLUSD | AMPLUSDT | ANCUSD | ANCUSDT | ANTBTC |
| ANTETH | ANTUSD | APENFTUSD | APEUSD | APEUSDT | APTUSD |
| APTUSDT | ARBUSD | ARBUSDT | ATHUSD | ATHUSDT | ATOMBTC |
| ATOMETH | ATOMUSD | ATOMUSDT | AUSDTUSD | AUSDTUSDT | AVAXBTC |
| AVAXUSD | AVAXUSDT | AXSUSD | AXSUSDT | AZEROUSD | AZEROUSDT |
| B21USD | B21USDT | B2MUSD | B2MUSDT | BALUSD | BALUSDT |
| BANDUSD | BANDUSDT | BATUSD | BATUSDT | BCHABCUSD | BCHNUSD |
| BESTUSD | BFTUSD | BGBUSD | BGBUSDT | BLASTUSD | BLASTUSDT |
| BMIUSD | BMIUSDT | BNTUSD | BOBAUSD | BOBAUSDT | BONKUSD |
| BONKUSDT | BOSONUSD | BOSONUSDT | BSVBTC | BSVUSD | BTCCNHT |
| BTCEUR | BTCEURQ | BTCEURR | BTCEURT | BTCGBP | BTCJPY |
| BTCMIM | BTCTRY | BTCUSD | BTCUSDQ | BTCUSDR | BTCUSDT |
| BTCXAUT | BTCXCHF | BTGBTC | BTGUSD | BTSEUSD | BTTUSD |
| BXNUSD | BXNUSDT | CCDBTC | CCDUSD | CCDUSDT | CELOUSD |
| CELOUSDT | CELUSD | CELUSDT | CHEXUSD | CHSBBTC | CHSBUSD |
| CHSBUSDT | CHZUSD | CHZUSDT | CLOUSD | CNHCNHT | CNHTUSD |
| COMPUSD | COMPUSDT | CRVUSD | CRVUSDT | CTKUSD | CTKUSDT |
| DAIBTC | DAIETH | DAIUSD | DASHBTC | DASHUSD | DATAUSD |
| DCRUSD | DGBUSD | DOGEBTC | DOGEUSD | DOGEUSDT | DOPUSD |
| DOPUSDT | DORAUSD | DORAUSDT | DOTBTC | DOTUSD | DOTUSDT |
| DUSKBTC | DUSKUSD | DVFUSD | DYMUSD | DYMUSDT | EDOUSD |
| EGLDUSD | EGLDUSDT | EIGENUSD | EIGENUSDT | ENAUSD | ENAUSDT |
| ENJUSD | EOSBTC | EOSETH | EOSEUR | EOSGBP | EOSJPY |
| EOSUSD | EOSUSDT | ESSUSD | ETCBTC | ETCUSD | ETCUSDT |
| ETH2ETH | ETH2USD | ETH2USDT | ETHBTC | ETHEUR | ETHEURT |
| ETHGBP | ETHJPY | ETHUSD | ETHUSDT | ETHWUSD | ETHWUSDT |
| ETHXAUT | ETPBTC | ETPUSD | EURQEUR | EURQUSD | EURQUSDT |
| EURREUR | EURRUSD | EURRUSDT | EURSUSD | EURTEUR | EURTUSD |
| EURTUSDT | EURUSDT | EXOUSD | FCLUSD | FCLUSDT | FETUSD |
| FETUSDT | FILUSD | FILUSDT | FLOKIUSD | FLOKIUSDT | FORTHUSD |
| FORTHUSDT | FTMUSD | FTMUSDT | FTTUSD | FTTUSDT | FUNUSD |
| GALAUSD | GALAUSDT | GBPEURT | GBPUSDT | GLMUSD | GMMTUSD |
| GMMTUSDT | GNOUSD | GOMININGUSD | GOMININGUSDT | GOTEUR | GOTUSD |
| GRTUSD | GRTUSDT | GTXUSD | GTXUSDT | GUNUSD | GUNUSDT |
| HILSVUSD | HIXUSD | HIXUSDT | HMSTRUSD | HMSTRUSDT | HMTUSD |
| HMTUSDT | HTXDAOUSD | HTXDAOUSDT | HTXUSD | HTXUSDT | ICEUSD |
| ICPBTC | ICPUSD | ICPUSDT | IDUSD | IDUSDT | IOTABTC |
| IOTAETH | IOTAEUR | IOTAGBP | IOTAJPY | IOTAUSD | IQXUSD |
| IQXUSDT | JASMYUSD | JASMYUSDT | JPYUSDT | JSTBTC | JSTUSD |
| JSTUSDT | JUPUSD | JUPUSDT | JUSTICEUSD | JUSTICEUSDT | JXXUSD |
| JXXUSDT | KAIAUSD | KAIAUSDT | KAIUSD | KAIUSDT | KANUSD |
| KANUSDT | KARATEUSD | KARATEUSDT | KAVAUSD | KAVAUSDT | KMNOUSD |
| KMNOUSDT | KNCBTC | KNCUSD | KSMUSD | KSMUSDT | LDOUSD |
| LDOUSDT | LEOBTC | LEOEOS | LEOETH | LEOUSD | LEOUSDT |
| LIFIIIUSD | LIFIIIUSDT | LINKUSD | LINKUSDT | LRCUSD | LTCBTC |
| LTCUSD | LTCUSDT | LUNABTC | LUNAETH | LUNAUSD | LUNAUSDT |
| LYMUSD | MANABTC | MANAUSD | MANEKIUSD | MANEKIUSDT | MATICBTC |
| MATICUSD | MATICUSDT | MDOGBTC | MDOGUSD | MDOGUSDT | MEWUSD |
| MEWUSDT | MIMUSD | MIMUSDT | MIRUSD | MIRUSDT | MKRUSD |
| MKRUSDT | MLNUSD | MOBUSD | MOBUSDT | MPCUSD | MPCUSDT |
| MXNTUSD | NEARUSD | NEARUSDT | NEOBTC | NEOETH | NEOEUR |
| NEOGBP | NEOJPY | NEOUSD | NEOUSDT | NEXOBTC | NEXOUSD |
| NEXOUSDT | NOTUSD | NOTUSDT | NYMUSD | NYMUSDT | OCEANUSD |
| OCEANUSDT | ODEUSD | OMGBTC | OMGETH | OMGUSD | OMNIUSD |
| OPXUSD | OPXUSDT | ORSUSD | OXYUSD | OXYUSDT | PASSUSD |
| PAXUSD | PAXUSDT | PEPEUSD | PEPEUSDT | PLANETSUSD | PLANETSUSDT |
| PLUUSD | PNGUSD | PNGUSDT | PNKETH | PNKUSD | POLUSD |
| POLUSDT | QRDOUSD | QRDOUSDT | QSHUSD | QTFBTC | QTFUSD |
| QTUMBTC | QTUMUSD | RBTCBTC | RBTCUSD | REEFUSD | REEFUSDT |
| REP2BTC | REP2USD | REQUSD | ROSEUSD | ROSEUSDT | RRTUSD |
| SANBTC | SANDUSD | SANDUSDT | SANETH | SANUSD | SCROLLUSD |
| SCROLLUSDT | SEIUSD | SEIUSDT | SGBUSD | SGBUSDT | SHIBUSD |
| SHIBUSDT | SHMUSD | SHMUSDT | SNTUSD | SNXUSD | SNXUSDT |
| SOLBTC | SOLUSD | SOLUSDT | SONICUSD | SONICUSDT | SPECUSD |
| SPECUSDT | SPELLMIM | SPELLUSD | SPELLUSDT | SRMUSD | SRMUSDT |
| STGUSD | STGUSDT | STORJUSD | STRKUSD | STRKUSDT | STXUSD |
| STXUSDT | SUIUSD | SUIUSDT | SUKUUSD | SUKUUSDT | SUNUSD |
| SUNUSDT | SUSHIUSD | SUSHIUSDT | SWEATUSD | SWEATUSDT | SXXUSD |
| SXXUSDT | TERRAUSTUSD | TERRAUSTUSDT | TESTADATESTUSD | TESTALGOTESTUSD | TESTAPTTESTUSD |
| TESTAVAXTESTUSD | TESTBTCTESTUSD | TESTBTCTESTUSDT | TESTDOGETESTUSD | TESTDOTTESTUSD | TESTEOSTESTUSD |
| TESTETHTESTUSD | TESTFILTESTUSD | TESTLTCTESTUSD | TESTMATICTESTUSD | TESTMATICTESTUSDT | TESTNEARTESTUSD |
| TESTSOLTESTUSD | TESTXAUTTESTUSD | TESTXTZTESTUSD | THETAUSD | THETAUSDT | TIAUSD |
| TIAUSDT | TITAN1GBP | TITAN1USD | TITAN2GBP | TITAN2USD | TLOSUSD |
| TLOSUSDT | TOKENUSD | TOKENUSDT | TOMIUSD | TOMIUSDT | TONUSD |
| TONUSDT | TRADEUSD | TRADEUSDT | TRXBTC | TRXETH | TRXEUR |
| TRXUSD | TRXUSDT | TRYUSDT | TURBOUSD | TURBOUSDT | TUSDUSD |
| TUSDUSDT | UNIUSD | UNIUSDT | UOPUSD | UOPUSDT | UOSBTC |
| UOSUSD | USDCUSD | USDCUSDT | USDFUSD | USDFUSDT | USDQUSD |
| USDQUSDT | USDRUSD | USDRUSDT | USDTCNHT | USDTMXNT | USDTUSD |
| USTBLUSD | USTBLUSDT | UTKUSD | UXLINKUSD | UXLINKUSDT | VEEUSD |
| VELARUSD | VELARUSDT | VELOUSD | VELOUSDT | VETBTC | VETUSD |
| VETUSDT | VSYBTC | VSYUSD | WAVESUSD | WAVESUSDT | WAXUSD |
| WBTCBTC | WBTCUSD | WHBTUSD | WHBTUSDT | WIFUSD | WIFUSDT |
| WILDUSD | WILDUSDT | WNCGUSD | WNCGUSDT | WOOUSD | WOOUSDT |
| XAUTBTC | XAUTUSD | XAUTUSDT | XCHFUSD | XDCUSD | XDCUSDT |
| XLMBTC | XLMETH | XLMUSD | XLMUSDT | XMRBTC | XMRUSD |
| XMRUSDT | XRAUSD | XRDBTC | XRDUSD | XRPBTC | XRPUSD |
| XRPUSDT | XSNUSD | XTPUSD | XTPUSDT | XTZBTC | XTZUSD |
| XTZUSDT | XVGUSD | YFIUSD | YFIUSDT | ZCNUSD | ZECBTC |
| ZECUSD | ZILBTC | ZILUSD | ZKXUSD | ZKXUSDT | ZMTUSD |
| ZMTUSDT | ZROUSD | ZROUSDT | ZRXBTC | ZRXETH | ZRXUSD |

## Example Applications

The Bitfinex Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

- Buy and hold
- Trading Cryptocurrency volatility and price action
- Allocating a small portion of your portfolio to Cryptocurrencies to hedge against inflation

### Classic Algorithm Example

The following example algorithm buys and holds Bitcoin through the Bitfinex exchange:

```python
from AlgorithmImports import *

class CoinAPIDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.universe_settings.asynchronous = True
        self.set_cash(100_000)
        # Bitfinex accepts both Cash and Margin account types. Select the
        # one you need for the best reality modeling.
        self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN)
        # Add BTCUSD data.
        self._btc = self.add_crypto("BTCUSD", Resolution.MINUTE, Market.BITFINEX)
        # Historical data
        history = self.history(self._btc.symbol, 30, Resolution.DAILY)
        # Add a Crypto universe that selects Crypto pairs on Bitfinex.
        universe = self.add_universe(CryptoUniverse.bitfinex(self._select_assets))
        # Historical Universe data
        universe_history = self.history(universe, 30, Resolution.DAILY)
        for (universe_symbol, time), universe_day in universe_history.items():
            for universe_item in universe_day:
                symbol = universe_item.symbol
                price = universe_item.close

    def _select_assets(self, universe_day):
        # Filter for materially traded Crypto pairs with significant
        # size and dollar volume, assuming higher capital flow in for
        # higher return.
        return [universe_item.symbol for universe_item in universe_day
                if universe_item.volume >= 100
                and universe_item.volume_in_usd > 10_000_000]

    def on_data(self, slice: Slice) -> None:
        # Speculate-invest all available free cash on BTCUSD, repecting
        # the order quantity restrictions to avoid invalid orders.
        if self.portfolio.cash_book['BTC'].amount != 0:
            return
        # Define a buffer so that we can scale down the order size,
        # avoiding trading errors.
        buffer = max(
            BitfinexFeeModel.TAKER_FEE,
            self.settings.free_portfolio_value_percentage
        )
        quantity = (
            self.portfolio.cash_book['USD'].amount
            / self._btc.ask_price
            * (1-buffer)
        )
        # Check if the quantity exceeds the minimum order size. On
        # Bitfinex, the minimum order size is measured in the base
        # currency (BTC in this case).
        if abs(quantity) < self._btc.symbol_properties.minimum_order_size:
            return
        self.market_order(self._btc, quantity)
```

### Framework Algorithm Example

The following example algorithm creates a dynamic universe of Crypto pairs on the Bitfinex exchange and then forms a equal-weighted portfolio of all the pairs in the universe:

```python
from AlgorithmImports import *

class CoinAPIDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.set_cash(100000)
        self.settings.free_portfolio_value_percentage = 0.05
        # Bitfinex accepts both Cash and Margin account types, select the one you need for the best reality modeling.
        self.set_brokerage_model(BrokerageName.BITFINEX, AccountType.MARGIN)

        # Warm up the security with the last known price to avoid conversion error
        self.settings.seed_initial_prices = True
        self.universe_settings.asynchronous = True
        self.universe_settings.resolution = Resolution.MINUTE
        # Add Crypto Universe Selection that select crypto pairs in Bitfinex exchange
        self.add_universe(CryptoUniverse.bitfinex(self._select_assets))
        # Get the pairs on Bitfinex that have USD as the quote currency.
        self._market_pairs = [
            x.key.symbol
            for x in self.symbol_properties_database.get_symbol_properties_list(Market.BITFINEX)
            if x.value.quote_currency == self.account_currency
        ]
        self.add_alpha(ConstantAlphaModel(InsightType.PRICE, InsightDirection.UP, timedelta(hours=4), 0.025, None))
        # Equally invest to evenly dissipate the capital concentration risk of inidividual crypto pair
        self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())

    def _select_assets(self, universe_day: List[CryptoUniverse]) -> List[Symbol]:
        # Select pairs where the quote currency is USD.
        pairs = [c for c in universe_day if c.symbol.value in self._market_pairs]
        # Filter for materially traded crypto pairs with significant dollar volume, assuming higher capital flow in for higher return.
        pairs = sorted(pairs, key=lambda c: c.volume_in_usd)[-3:]
        return [c.symbol for c in pairs]

    def on_securities_changed(self, changes: SecurityChanges) -> None:
        for security in changes.added_securities:
            # Historical data
            history = self.history(security.symbol, 30, Resolution.DAILY)
            self.debug(f"We got {len(history)} items from our history request")
```

### Research Example

The following example lists crypto-currency pairs with the greatest dollar volume in the Bitfinex exchange:

```python
qb = QuantBook()

# Add Cryptocurrency pair
symbol = qb.add_crypto("BTCUSDT", market=Market.BITFINEX).symbol

# Historical data
history = qb.history(symbol, 30, Resolution.DAILY)
for (symbol, time), row in history.iterrows():
    print(f'{time} {symbol} {row.close}')

# Add Crypto Universe Selection
def universe_selection_filter(universe_day):
    selected = sorted([x for x in universe_day
        if x.volume_in_usd and x.volume_in_usd > 10000],
        key=lambda x: x.volume_in_usd, reverse=True)[:5]
    return [x.symbol for x in selected]

universe = qb.add_universe(CryptoUniverse.bitfinex(universe_selection_filter))

# Historical Universe data
history = qb.universe_history(universe, qb.time-timedelta(30), qb.time)
for (univere_symbol, time), universe_day in history.items():
    print(f'=== {time} ===')
    for universe_item in sorted(universe_day, key=lambda x: x.volume_in_usd, reverse=True):
        print(f"{universe_item.symbol}: {universe_item.volume_in_usd}")
```

## Data Point Attributes

The Bitfinex Crypto Price dataset provides `TradeBar`, `QuoteBar`, `Tick`, and `CryptoUniverse` objects.

### TradeBar Attributes

`TradeBar` objects have the following attributes:

*Members of `QuantConnect.Data.Market.TradeBar` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Data.Market.TradeBar&language=python*

### QuoteBar Attributes

`QuoteBar` objects have the following attributes:

*Members of `QuantConnect.Data.Market.QuoteBar` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Data.Market.QuoteBar&language=python*

### Tick Attributes

`Tick` objects have the following attributes:

*Members of `QuantConnect.Data.Market.Tick` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Data.Market.Tick&language=python*

### CryptoUniverse Attributes

`CryptoUniverse` objects have the following attributes:

*Members of `QuantConnect.DataSource.CryptoUniverse` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.DataSource.CryptoUniverse&language=python*
