tensortrade.strategies.trading_strategy module¶
-
class
tensortrade.strategies.trading_strategy.
TradingStrategy
(environment)[source]¶ Bases:
object
An abstract trading strategy capable of self tuning, training, and evaluating.
-
abstract
__init__
(environment)[source]¶ - Parameters
environment (TradingEnvironment) – A TradingEnvironment instance for the agent to trade within.
-
property
environment
¶ A TradingEnvironment instance for the agent to trade within.
- Return type
-
abstract
restore_agent
(path)[source]¶ Deserialize the strategy’s learning agent from a file.
- Parameters
path (
str
) – The str path of where the strategy is stored.
-
abstract
run
(steps=None, episodes=None, testing=False, episode_callback=None)[source]¶ Evaluate the agent’s performance within the environment.
- Parameters
steps (
Optional
[int
]) – The number of steps to run the agent within the environment. Required if episodes is not passed.episodes (
Optional
[int
]) – The number of episodes to run the agent within the environment. Required if steps is not passed.testing (
bool
) – Whether or not the agent should be evaluated on the environment it is running in. Defaults to false.episode_callback (optional) – A callback function for monitoring the agent’s progress within the environment.
- Return type
DataFrame
- Returns
A history of the agent’s trading performance during evaluation.
-
abstract
save_agent
(path)[source]¶ Serialize the strategy’s learning agent to a file for restoring later.
- Parameters
path (
str
) – The str path of where to store the strategy.
-
abstract