tensortrade.core.base module

Responsible for the basic classes in the project.

tensortrade.core.base.global_clock

A clock that provides a global reference for all objects that share a timeline.

Type:

Clock

class tensortrade.core.base.Identifiable[source]

Bases: object

Identifiable mixin for adding a unique id property to instances of a class.

property id: str

Gets the identifier for the object.

Returns:

str – The identifier for the object.

class tensortrade.core.base.Observable[source]

Bases: object

An object with some value that can be observed.

An object to which a listener can be attached to and be alerted about on an event happening.

listeners

A list of listeners that the object will alert on events occurring.

Type:

list of listeners

attach(listener)[source]

Adds a listener to receive alerts.

detach(listener)[source]

Removes a listener from receiving alerts.

attach(listener) Observable[source]

Adds a listener to receive alerts.

Parameters:

listener (a listener object)

Returns:

Observable – The observable being called.

detach(listener) Observable[source]

Removes a listener from receiving alerts.

Parameters:

listener (a listener object)

Returns:

Observable – The observable being called.

class tensortrade.core.base.TimeIndexed[source]

Bases: object

A class for objects that are indexed by time.

property clock: Clock

Gets the clock associated with this object.

Returns:

Clock – The clock associated with this object.

class tensortrade.core.base.TimedIdentifiable[source]

Bases: Identifiable, TimeIndexed

A class an identifiable object embedded in a time process.

created_at

The time at which this object was created according to its associated clock.

Type:

datetime.datetime

property clock: Clock

Gets the clock associated with the object.

Returns:

Clock – The clock associated with the object.