save rpc instances only in registered_modules, add some abstract methods

This commit is contained in:
gcarq
2018-06-08 03:49:09 +02:00
parent 13ba68acc6
commit cddb062db5
6 changed files with 95 additions and 104 deletions

View File

@@ -2,21 +2,21 @@
This module contains class to define a RPC communications
"""
import logging
from abc import abstractmethod
from datetime import datetime, timedelta, date
from decimal import Decimal
from typing import Dict, Tuple, Any
import arrow
import sqlalchemy as sql
from pandas import DataFrame
from numpy import mean, nan_to_num
from pandas import DataFrame
from freqtrade import exchange
from freqtrade.misc import shorten_date
from freqtrade.persistence import Trade
from freqtrade.state import State
logger = logging.getLogger(__name__)
@@ -32,6 +32,19 @@ class RPC(object):
"""
self.freqtrade = freqtrade
@abstractmethod
def cleanup(self) -> str:
""" Cleanup pending module resources """
@property
@abstractmethod
def name(self) -> None:
""" Returns the lowercase name of this module """
@abstractmethod
def send_msg(self, msg: str) -> None:
""" Sends a message to all registered rpc modules """
def rpc_trade_status(self) -> Tuple[bool, Any]:
"""
Below follows the RPC backend it is prefixed with rpc_ to raise awareness that it is