fix: Fixed some bugs introduced during refactoring. (#167)

* Fixed some bugs introduced during refactoring.

* fix a minor bug

* build factor source data (price and volumns) from qlib if no source data is provided by the user (#168)

* Fixed some bugs introduced during refactoring.

* fix a small bug

* fix a small bug

---------

Co-authored-by: Xu Yang <peteryang@vip.qq.com>
This commit is contained in:
WinstonLiyt
2024-08-05 21:48:24 +08:00
committed by GitHub
parent 0933eb2948
commit db68a28c1b
3 changed files with 46 additions and 14 deletions
+18 -2
View File
@@ -24,7 +24,13 @@ class LoopMeta(type):
@staticmethod
def _get_steps(bases):
"""
get all the `steps` of base classes and combine them to a single one.
Recursively get all the `steps` from the base classes and combine them into a single list.
Args:
bases (tuple): A tuple of base classes.
Returns:
List[Callable]: A list of steps combined from all base classes.
"""
steps = []
for base in bases:
@@ -34,7 +40,17 @@ class LoopMeta(type):
return steps
def __new__(cls, clsname, bases, attrs):
# move custommized steps into steps
"""
Create a new class with combined steps from base classes and current class.
Args:
clsname (str): Name of the new class.
bases (tuple): Base classes.
attrs (dict): Attributes of the new class.
Returns:
LoopMeta: A new instance of LoopMeta.
"""
steps = LoopMeta._get_steps(bases) # all the base classes of parents
for name, attr in attrs.items():
if not name.startswith("__") and isinstance(attr, Callable):