Universes
Crypto
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:
Argument | Data Type | Description | Default Value |
---|---|---|---|
market | string str | The market of the Cryptocurrencies. To view the available Crypto markets, see the CoinAPI datasets. | |
universeSettings | UniverseSettings | The universe settings. | |
universeFilterFunc | Func<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); }