示例#1
0
async def create_trading_modes(config: dict,
                               exchange_manager: ExchangeManager,
                               trading_mode_class: AbstractTradingMode.__class__,
                               bot_id: str) -> list:
    is_symbol_wildcard = trading_mode_class.get_is_symbol_wildcard()
    if is_symbol_wildcard or (not is_symbol_wildcard and exchange_manager.exchange_config.traded_symbol_pairs):
        return await _create_trading_modes(trading_mode_class=trading_mode_class,
                                           config=config,
                                           exchange_manager=exchange_manager,
                                           cryptocurrencies=exchange_manager.exchange_config.traded_cryptocurrencies,
                                           symbols=exchange_manager.exchange_config.traded_symbol_pairs,
                                           time_frames=exchange_manager.exchange_config.traded_time_frames,
                                           bot_id=bot_id)
    # Do not create no symbol wildcard trading mode if no trading pair is available
    raise TradingModeIncompatibility(f"As non symbol-wildcard trading mode, {trading_mode_class.get_name()} requires "
                                     f"at least one exchange trading pair to be initialized. "
                                     f"None of the required pairs are available on {exchange_manager.exchange_name}.")
示例#2
0
def __get_time_frames_to_create(
        trading_mode_class: AbstractTradingMode.__class__,
        time_frames: list) -> list:
    return time_frames if time_frames and not trading_mode_class.get_is_time_frame_wildcard(
    ) else [None]
示例#3
0
def __get_symbols_to_create(trading_mode_class: AbstractTradingMode.__class__,
                            symbols: list) -> list:
    return symbols if symbols and not trading_mode_class.get_is_symbol_wildcard(
    ) else [None]
示例#4
0
def __get_cryptocurrencies_to_create(
        trading_mode_class: AbstractTradingMode.__class__,
        cryptocurrencies: list) -> list:
    return cryptocurrencies if cryptocurrencies and not trading_mode_class.get_is_cryptocurrency_wildcard(
    ) else [None]