tensortrade.core.component module¶
-
class
tensortrade.core.component.Component(*args, **kwargs)[source]¶ Bases:
abc.ABC,tensortrade.core.component.ContextualizedMixin,tensortrade.core.base.IdentifiableThe main class for setting up components to be used in the TradingEnv.
This class if responsible for providing a common way in which different components of the library can be created. Specifically, it enables the creation of components from a TradingContext. Therefore making the creation of complex environments simpler where there are only a few things that need to be changed from case to case.
-
registered_name¶ The name under which constructor arguments are to be given in a dictionary and passed to a TradingContext.
- Type
-
classmethod
__init_subclass__(**kwargs) → None[source]¶ Constructs the concrete subclass of Component.
In constructing the subclass, the concrete subclass is also registered into the project level registry.
- Parameters
kwargs (keyword arguments) – The keyword arguments to be provided to the concrete subclass of Component to create an instance.
-
default(key: str, value: Any, kwargs: dict = None) → Any[source]¶ Resolves which defaults value to use for construction.
A concrete subclass will use this method to resolve which default value it should use when creating an instance. The default value should go to the value specified for the variable within the TradingContext. If that one is not provided it will resolve to value.
-
registered_name= None¶
-
-
class
tensortrade.core.component.ContextualizedMixin[source]¶ Bases:
objectA mixin that is to be mixed with any class that must function in a contextual setting.
-
property
context¶ Gets the Context the object is under.
- Returns
Context – The context the object is under.
-
property
-
class
tensortrade.core.component.InitContextMeta(name, bases, namespace)[source]¶ Bases:
abc.ABCMetaMetaclass that executes __init__ of instance in it’s core.
This class works with the TradingContext class to ensure the correct data is being given to the instance created by a concrete class that has subclassed Component.
-
__call__(*args, **kwargs) → tensortrade.core.component.InitContextMeta[source]¶ - Parameters
args – positional arguments to give constructor of subclass of Component
kwargs – keyword arguments to give constructor of subclass of Component
- Returns
Component – An instance of a concrete class the subclasses Component
-