Universes

Crypto

Introduction

A Crypto universe lets you select a basket of Cryptocurrencies based on CryptoCoarseFundamental data.

Crypto Universes

To add a universe of Cryptocurrencies, in the Initialize method, pass a CryptoCoarseFundamentalUniverse to the AddUniverse method.

def Initialize(self) -> None:
    self.UniverseSettings.Asynchronous = True
    self.UniverseSettings.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.Coinbase, AccountType.Cash)

    # Add universe selection of cryptos based on coarse fundamentals
    filter_function = lambda crypto_coarse: [c.Symbol for c in crypto_coarse]
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Coinbase, self.UniverseSettings, filter_function))
public override void Initialize()
{
    UniverseSettings.Asynchronous = true;
    UniverseSettings.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.Coinbase, AccountType.Cash);

    // Add universe selection of cryptos based on coarse fundamentals
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Coinbase, UniverseSettings, cryptoCoarse => from x in cryptoCoarse select x.Symbol));
}

The following table describes the CryptoCoarseFundamentalUniverse constructor arguments:

ArgumentData TypeDescriptionDefault Value
marketstringstrThe market of the Cryptocurrencies. To view the available Crypto markets, see the CoinAPI datasets.
universeSettingsUniverseSettingsThe universe settings.
universeFilterFuncFunc<IEnumerable<CryptoCoarseFundamental>, IEnumerable<Symbol>>Callable[[List[CryptoCoarseFundamental]], List[Symbol]]A function to select some of the Cryptocurrencies for the universe.

The filter function receives CryptoCoarseFundamental objects, which represent one of the Cryptocurrencies in the market. The Symbol objects that the filter function returns represent the universe constituents. CryptoCoarseFundamental objects have the following attributes:

To perform thorough filtering on the CryptoCoarseFundamental objects, define an isolated filter method.

def Initialize(self) -> None:
    self.UniverseSettings.Asynchronous = True
    self.UniverseSettings.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.Coinbase, AccountType.Cash)

    # Add universe selection of cryptos based on coarse fundamentals
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Coinbase, self.UniverseSettings, self.universe_filter))

def universe_filter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    # Define the universe selection function
    return [cf.Symbol for cf in crypto_coarse if cf.Volume >= 100 and cf.VolumeInUsd > 10000]
public override void Initialize()
{
    UniverseSettings.Asynchronous = true;
    UniverseSettings.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.Coinbase, AccountType.Cash);

    // Add universe selection of cryptos based on coarse fundamentals
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Coinbase, UniverseSettings, UniverseFilter));
}

private IEnumerable<Symbol> UniverseFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return cryptoCoarse.Where(cf => cf.Volume >= 100m && cf.VolumeInUsd > 10000m).Select(x => x.Symbol);
}

Alternative Data Universes

An alternative data universe lets you select a basket of Cryptocurrencies based on an alternative dataset that's linked to them. If you use an alternative data universe, you limit your universe to only the securities in the dataset, which avoids unnecessary subscriptions. Currently, only the Crypto Market Cap alternative dataset supports universe selection for Crypto.

Selection Frequency

Crypto universes run on a daily basis.

Live Trading Considerations

In live mode, the pipeline has a 16-hour delay. Your algorithm receives the CryptoCoarseFundamental objects at around 16:00-16:30 Coordinated Universal Time (UTC) each day, depending on the data processing task.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: