# Path: zaifbot/exchange/currency_pairs.py
# class CurrencyPair:
#     _lock = Lock()
#     _instances = {}
# 
#     def __new__(cls, name):
#         with cls._lock:
#             name = str(name)
#             if cls._instances.get(name, None) is None:
#                 cls._instances[name] = super().__new__(cls)
#         return cls._instances[name]
# 
#     def __init__(self, name):
#         self._name = str(name)
#         self._info = _ZaifCurrencyPairsInfo()[self._name]
# 
#     def __str__(self):
#         return self._name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @property
#     def info(self):
#         return self._info
# 
#     @property
#     def is_token(self):
#         return self._info['is_token']
# 
# Path: zaifbot/logger.py
# def _bot_console_handler():
# def _bot_file_handler(file=None):
# def _bot_logger():
# def _trade_logger():
# def add_logging_directions(webhook_url=None, email={}):


from threading import Thread, Event, Lock
from zaifapi.impl import ZaifPublicStreamApi
from zaifbot.exchange.currency_pairs import CurrencyPair
from zaifbot.logger import bot_logger




class BotStreamApi:
    _lock = Lock()
    _sockets = {}
    _stop_events = {}
    _error_events = {}
    _instance = None

    def __new__(cls):
        with cls._lock:
            if cls._instance is None:
                cls._instance = super().__new__(cls)
        return cls._instance

    def execute(self, currency_pair):

# Path: zaifbot/exchange/currency_pairs.py
# class CurrencyPair:
#     _lock = Lock()
#     _instances = {}
# 
#     def __new__(cls, name):
#         with cls._lock:
#             name = str(name)
#             if cls._instances.get(name, None) is None:
#                 cls._instances[name] = super().__new__(cls)
#         return cls._instances[name]
# 
#     def __init__(self, name):
#         self._name = str(name)
#         self._info = _ZaifCurrencyPairsInfo()[self._name]
# 
#     def __str__(self):
#         return self._name
# 
#     @property
#     def name(self):
#         return self._name
# 
#     @property
#     def info(self):
#         return self._info
# 
#     @property
#     def is_token(self):
#         return self._info['is_token']
# 
# Path: zaifbot/logger.py
# def _bot_console_handler():
# def _bot_file_handler(file=None):
# def _bot_logger():
# def _trade_logger():
# def add_logging_directions(webhook_url=None, email={}):


# Path: zaifbot/exchange/api/websocket.py
from threading import Thread, Event, Lock
from zaifapi.impl import ZaifPublicStreamApi
from zaifbot.exchange.currency_pairs import CurrencyPair
from zaifbot.logger import bot_logger





class BotStreamApi:
    _lock = Lock()
    _sockets = {}
    _stop_events = {}
    _error_events = {}
    _instance = None

    def __new__(cls):
        with cls._lock:
            if cls._instance is None:
                cls._instance = super().__new__(cls)
        return cls._instance

    def execute(self, currency_pair):

        if isinstance(currency_pair, CurrencyPair):