Coverage for source/agent/strategies/testing_strategy_handler_base.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-08-01 20:51 +0000

1# agent/strategies/testing_strategy_handler_base.py 

2 

3# global imports 

4from abc import ABC, abstractmethod 

5from typing import Any 

6 

7# local imports 

8from source.agent import AgentBase 

9from source.environment import TradingEnvironment 

10 

11class TestingStrategyHandlerBase(ABC): 

12 """ 

13 Implements a base class for testing strategy handlers. It expects derived classes to implement 

14 functions for evaluating agents in a trading environment. 

15 """ 

16 

17 @abstractmethod 

18 def evaluate(self, agent: AgentBase, environment: TradingEnvironment) -> \ 

19 tuple[list[str], list[dict[str, Any]]]: 

20 """ 

21 Evaluates the performance of the given agent in the specified trading environment. 

22 

23 Parameters: 

24 agent (AgentBase): The agent to evaluate. 

25 environment (TradingEnvironment): The trading environment to use for evaluation. 

26 

27 Returns: 

28 (tuple[list[str], list[dict[str, Any]]]): A tuple containing the keys and data collected during evaluation. 

29 """ 

30 

31 pass