Skip to content

Commit

Permalink
add matrix_channel_exists to initialization api
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume De Saint Martin committed Feb 16, 2020
1 parent 2388a6a commit cb40961
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions octobot_evaluators/api/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library.
from octobot_channels.channels.channel import set_chan
from octobot_channels.channels.channel import set_chan, get_chan
from octobot_channels.util import create_channel_instance
from octobot_commons.constants import CONFIG_TIME_FRAME
from octobot_commons.tentacles_management import create_advanced_types_list
from octobot_commons.time_frame_manager import sort_time_frames

from octobot_evaluators.channels import MatrixChannel
from octobot_evaluators.channels import MatrixChannel, MATRIX_CHANNEL
from octobot_evaluators.evaluator import StrategyEvaluator


Expand All @@ -35,3 +35,11 @@ def init_time_frames_from_strategies(config) -> None:

async def create_matrix_channels() -> None:
await create_channel_instance(MatrixChannel, set_chan)


def matrix_channel_exists() -> bool:
try:
get_chan(MATRIX_CHANNEL)
return True
except KeyError:
return False

0 comments on commit cb40961

Please sign in to comment.