[Del]remove Singleton
This commit is contained in:
parent
6c15a50599
commit
1d6506c5f3
@ -24,7 +24,7 @@ from .event import (
|
||||
from .gateway import BaseGateway
|
||||
from .object import CancelRequest, LogData, OrderRequest, SubscribeRequest
|
||||
from .setting import SETTINGS
|
||||
from .utility import Singleton, get_folder_path
|
||||
from .utility import get_folder_path
|
||||
|
||||
|
||||
class MainEngine:
|
||||
@ -197,7 +197,7 @@ class BaseEngine(ABC):
|
||||
pass
|
||||
|
||||
|
||||
class LogEngine(BaseEngine, metaclass=Singleton):
|
||||
class LogEngine(BaseEngine):
|
||||
"""
|
||||
Processes log event and output with logging module.
|
||||
"""
|
||||
|
@ -12,25 +12,6 @@ import talib
|
||||
from .object import BarData, TickData
|
||||
|
||||
|
||||
class Singleton(type):
|
||||
"""
|
||||
Singleton metaclass,
|
||||
|
||||
usage:
|
||||
class A(metaclass=Singleton):
|
||||
...
|
||||
"""
|
||||
_instances = {}
|
||||
|
||||
def __call__(cls, *args, **kwargs):
|
||||
""""""
|
||||
if cls not in cls._instances:
|
||||
cls._instances[cls] = super(Singleton, cls).__call__(
|
||||
*args, **kwargs
|
||||
)
|
||||
return cls._instances[cls]
|
||||
|
||||
|
||||
def _get_trader_dir(temp_name: str):
|
||||
"""
|
||||
Get path where trader is running in.
|
||||
|
Loading…
Reference in New Issue
Block a user