tensortrade.env.default.observers module¶
-
class
tensortrade.env.default.observers.
IntradayObserver
(portfolio: Portfolio, feed: DataFeed = None, renderer_feed: DataFeed = None, stop_time: datetime.time = datetime.time(16, 0), window_size: int = 1, min_periods: int = None, randomize: bool = False, **kwargs)[source]¶ Bases:
tensortrade.env.generic.components.observer.Observer
The IntradayObserver observer that is compatible with the other default components. :param portfolio: The portfolio to be used to create the internal data feed mechanism. :type portfolio: Portfolio :param feed: The feed to be used to collect observations to the observation window. :type feed: DataFeed :param renderer_feed: The feed to be used for giving information to the renderer. :type renderer_feed: DataFeed :param stop_time: The time at which the episode will stop. :type stop_time: datetime.time :param window_size: The size of the observation window. :type window_size: int :param min_periods: The amount of steps needed to warmup the feed. :type min_periods: int :param randomize: Whether or not to select a random episode when reset. :type randomize: bool :param **kwargs: Additional keyword arguments for observer creation. :type **kwargs: keyword arguments
-
feed
¶ The master feed in charge of streaming the internal, external, and renderer data feeds.
Type: DataFeed
-
stop_time
¶ The time at which the episode will stop.
Type: datetime.time
-
history
¶ The observation history.
Type: ObservationHistory
-
renderer_history
¶ The history of the renderer data feed.
Type: List[dict]
-
has_next
() → bool[source]¶ Checks if there is another observation to be generated. :returns: bool – Whether there is another observation to be generated.
-
observation_space
¶ The observation space of the TradingEnv. (Space, read-only)
-
-
class
tensortrade.env.default.observers.
ObservationHistory
(window_size: int)[source]¶ Bases:
object
Stores observations from a given episode of the environment.
Parameters: window_size (int) – The amount of observations to keep stored before discarding them. -
rows
¶ The rows of observations that are used as the environment observation at each step of an episode.
Type: pd.DataFrame
-
observe
() → numpy.array[source]¶ Gets the observation at a given step in an episode
Returns: np.array – The current observation of the environment.
-
-
class
tensortrade.env.default.observers.
TensorTradeObserver
(portfolio: Portfolio, feed: DataFeed = None, renderer_feed: DataFeed = None, window_size: int = 1, min_periods: int = None, **kwargs)[source]¶ Bases:
tensortrade.env.generic.components.observer.Observer
The TensorTrade observer that is compatible with the other default components.
Parameters: - portfolio (Portfolio) – The portfolio to be used to create the internal data feed mechanism.
- feed (DataFeed) – The feed to be used to collect observations to the observation window.
- renderer_feed (DataFeed) – The feed to be used for giving information to the renderer.
- window_size (int) – The size of the observation window.
- min_periods (int) – The amount of steps needed to warmup the feed.
- **kwargs (keyword arguments) – Additional keyword arguments for observer creation.
-
feed
¶ The master feed in charge of streaming the internal, external, and renderer data feeds.
Type: DataFeed
-
history
¶ The observation history.
Type: ObservationHistory
-
renderer_history
¶ The history of the renderer data feed.
Type: List[dict]
-
has_next
() → bool[source]¶ Checks if there is another observation to be generated.
Returns: bool – Whether there is another observation to be generated.
-
observation_space
¶ The observation space of the TradingEnv. (Space, read-only)