---
title: "Key Concepts"
description: "A custom universe lets you select a basket of assets from a custom dataset."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/streaming-data/custom-universes/key-concepts
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/streaming-data/custom-universes/key-concepts.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/16%20Importing%20Data/02%20Streaming%20Data/03%20Custom%20Universes/01%20Key%20Concepts
modified: 2026-10-30
index: https://www.quantconnect.com/llms.txt
---

# Key Concepts

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Importing Data > Streaming Data > Custom Universes > Key Concepts

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

## Introduction

A custom universe lets you select a basket of assets from a custom dataset.

## Initialize Universes

To add a custom universe to your algorithm, in the `initialize` method, pass your universe type and a selector function to the `add_universe` method.

```python
self.add_universe(MyCustomUniverseDataClass, self._selector_function)
```

## Receive Custom Data

The universe selector function receives a list of your custom objects and must return a list of `Symbol` objects. In the selector function definition, you can use any of the properties of your custom data type. The `Symbol` objects that you return from the selector function set the constituents of the universe.

```python
class MyCustomUniverseAlgorithm(QCAlgorithm):
	def _selector_function(self, data: List[MyCustomUniverseDataClass]) -> List[Symbol]:
    	sorted_data = sorted([ x for x in data if x["CustomAttribute1"] > 0 ],
                         	key=lambda x: x["CustomAttribute2"],
                         	reverse=True)
    	return [x.symbol for x in sorted_data[:5]]
```

## Historical Data

To get historical data for a [custom data universe](https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/streaming-data/custom-universes/key-concepts.md), call the `history` method with the `Universe` object. For more information about historical data, see [Universes](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/custom-data.md#04-Universes).
