bbstrader 0.1.8__py3-none-any.whl → 0.1.91__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bbstrader might be problematic. Click here for more details.

@@ -33,61 +33,8 @@ __all__ = [
33
33
  "InternalFailTimeout",
34
34
  "trade_retcode_message",
35
35
  "raise_mt5_error",
36
- "config_logger",
37
36
  ]
38
37
 
39
- def config_logger(log_file: str, console_log=True):
40
- # Configure the logger
41
- logger = logging.getLogger(__name__)
42
- logger.setLevel(logging.DEBUG)
43
-
44
- # File handler
45
- file_handler = logging.FileHandler(log_file)
46
- file_handler.setLevel(logging.INFO)
47
-
48
- # Formatter
49
- formatter = logging.Formatter(
50
- '%(asctime)s - %(levelname)s: %(message)s', datefmt="%Y-%m-%d %H:%M:%S")
51
- file_handler.setFormatter(formatter)
52
-
53
- # Add the handler to the logger
54
- logger.addHandler(file_handler)
55
-
56
- if console_log:
57
- # handler for the console with a different level
58
- console_handler = logging.StreamHandler()
59
- console_handler.setLevel(logging.DEBUG)
60
- console_handler.setFormatter(formatter)
61
- logger.addHandler(console_handler)
62
-
63
- return logger
64
-
65
-
66
- class LogLevelFilter(logging.Filter):
67
- def __init__(self, levels: List[int]):
68
- """
69
- Initializes the filter with specific logging levels.
70
-
71
- Args:
72
- levels: A list of logging level values (integers) to include.
73
- """
74
- super().__init__()
75
- self.levels = levels
76
-
77
- def filter(self, record: logging.LogRecord) -> bool:
78
- """
79
- Filters log records based on their level.
80
-
81
- Args:
82
- record: The log record to check.
83
-
84
- Returns:
85
- True if the record's level is in the allowed levels, False otherwise.
86
- """
87
- return record.levelno in self.levels
88
-
89
-
90
-
91
38
  # TIMEFRAME is an enumeration with possible chart period values
92
39
  # See https://www.mql5.com/en/docs/python_metatrader5/mt5copyratesfrom_py#timeframe
93
40
  TIMEFRAMES = {
@@ -141,6 +88,7 @@ class TimeFrame(Enum):
141
88
  W1 = "W1"
142
89
  MN1 = "MN1"
143
90
 
91
+
144
92
  class TerminalInfo(NamedTuple):
145
93
  """
146
94
  Represents general information about the trading terminal.
@@ -470,6 +418,7 @@ class TradeDeal(NamedTuple):
470
418
  comment: str
471
419
  external_id: str
472
420
 
421
+
473
422
  class InvalidBroker(Exception):
474
423
  """Exception raised for invalid broker errors."""
475
424
  def __init__(self, message="Invalid broker."):
File without changes
bbstrader/models/ml.py ADDED
File without changes
File without changes
@@ -7,5 +7,5 @@ The module is designed to be flexible and extensible, allowing users to define t
7
7
  strategies and customize the trading process.
8
8
 
9
9
  """
10
- from bbstrader.trading.execution import ExecutionEngine
10
+ from bbstrader.trading.execution import *
11
11
  from bbstrader.trading.strategies import *