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.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.GDAX, 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.GDAX, self.UniverseSettings, filter_function))
public override void Initialize()
{
    UniverseSettings.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

    // Add universe selection of cryptos based on coarse fundamentals
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.GDAX, 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.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

    # Add universe selection of cryptos based on coarse fundamentals
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.GDAX, 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.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

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

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

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: