Coverage for django_napse/core/models/bots/implementations/empty/strategy.py: 100%

23 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django_napse.core.models.bots.architectures.single_pair import SinglePairArchitecture 

2from django_napse.core.models.bots.implementations.empty.config import EmptyBotConfig 

3from django_napse.core.models.bots.strategy import Strategy 

4from django_napse.utils.constants import SIDES 

5 

6 

7class EmptyStrategy(Strategy): 

8 def __str__(self) -> str: 

9 return f"EMPTY BOT STRATEGY: {self.pk=}" 

10 

11 def info(self, verbose=True, beacon=""): 

12 string = "" 

13 string += f"{beacon}Strategy ({self.pk=}):\n" 

14 string += f"{beacon}Args:\n" 

15 string += f"{beacon}\t{self.config=}\n" 

16 string += f"{beacon}\t{self.architecture=}\n" 

17 if verbose: # pragma: no cover 

18 print(string) 

19 return string 

20 

21 @classmethod 

22 def config_class(cls): 

23 return EmptyBotConfig 

24 

25 @classmethod 

26 def architecture_class(cls): 

27 return SinglePairArchitecture 

28 

29 def give_order(self, data: dict) -> list[dict]: 

30 controller = data["controllers"]["main"] 

31 return [ 

32 { 

33 "controller": controller, 

34 "ArchitectureModifications": [], 

35 "StrategyModifications": [], 

36 "ConnectionModifications": [], 

37 "connection": data["connection"], 

38 "asked_for_amount": 0, 

39 "asked_for_ticker": controller.quote, 

40 "pair": controller.pair, 

41 "price": data["candles"][controller]["latest"]["close"], 

42 "side": SIDES.KEEP, 

43 }, 

44 ]