Skip to content

ObjectActivator

QuantConnect.Util.ObjectActivator

Bases: Object

Provides methods for creating new instances of objects

add_activator

add_activator(
    key: Type, value: Callable[[List[Object]], Object]
) -> None

Adds method to return an instance of object

Parameters:

Name Type Description Default
key Type

The key of the method to add

required
value Callable[[List[Object]], Object]

The value of the method to add

required

clone

clone(instance_to_clone: Any) -> Object

Clones the specified instance using reflection

Parameters:

Name Type Description Default
instance_to_clone Any

The instance to be cloned

required

Returns:

Type Description
Object

A field/property wise, non-recursive clone of the instance.

get_activator

get_activator(
    data_type: Type,
) -> Callable[[List[Object]], Object]

Fast Object Creator from Generic Type: Modified from http://rogeralsing.com/2008/02/28/linq-expressions-creating-objects/

Parameters:

Name Type Description Default
data_type Type

Type of the object we wish to create

required

Returns:

Type Description
Callable[[List[Object]], Object]

Method to return an instance of object.

reset_activators

reset_activators() -> None

Reset the object activators