예제 #1
0
    def load_exchanges(self, logger):
        """Create and return list of all exchange objects"""

        exchanges = []
        exchanges.append(Bitmex(logger))
        self.logger.debug("Initialised exchanges.")
        return exchanges
예제 #2
0
    def load_exchanges(self, logger):
        """
        Create and return list of all exchange object.

        Args:
            None.

        Returns:
            exchanges: list of exchange objects.

        Raises:
            None.
        """

        exchanges = []
        exchanges.append(Bitmex(logger))
        self.logger.debug("Initialised exchanges.")

        return exchanges
예제 #3
0
    def exchange_wrappers(self, logger, op_venues):
        """
        Create and return a list of exchange wrappers.

        Args:
            op_venues: list of exchange/venue names to int.

        Returns:
            exchanges: list of exchange connector objects.

        Raises:
            None.
        """

        # TODO: load exchange wrappers from 'op_venues' list param

        venues = [Bitmex(logger)]
        self.logger.info("Initialised exchange connectors.")

        return venues
예제 #4
0
파일: app.py 프로젝트: tistaharahap/mexpy
TF = os.getenv('TF', '5m')
CONTRACTS = int(os.getenv('CONTRACTS', '10'))
LEVERAGE = int(os.getenv('LEVERAGE', '20'))
SYMBOL = 'XBTUSD'
REFRESH_TIME = int(os.getenv('REFRESH_TIME', 10))
DEBUG = os.getenv('DEBUG', '0')
TG_API_KEY = os.getenv('TG_API_KEY',
                       '472836801:AAGQgDhB0dg471Nvqc9RjqiXZJ4K2qnieHQ')
TG_CHAT_ID = os.getenv('TG_CHAT_ID', '-1001351609280')
LIMIT_SELL_MARGIN = float(os.getenv('LIMIT_SELL_MARGIN', '40.0'))
STOP_MARGIN = float(os.getenv('STOP_MARGIN', '50.0'))
VWMA_PERIOD = int(os.getenv('VWMA_PERIOD', '34'))
GRACE_PERIOD_IN_MINUTES = int(os.getenv('GRACE_PERIOD_IN_MINUTES', '10'))

bitmex_client = Bitmex(test=USE_TESTNET,
                       api_key=API_KEY,
                       api_secret=API_SECRET)

LAST_ORDER_FRACTAL = 0.0


def setup_custom_logger(name):
    formatter = logging.Formatter(
        fmt='%(asctime)s - %(levelname)-2s - %(message)s',
        datefmt='%Y-%m-%d %H:%M:%S')

    screen_handler = logging.StreamHandler(stream=sys.stdout)
    screen_handler.setFormatter(formatter)

    lg = logging.getLogger(name)
    log_level = logging.DEBUG if DEBUG == '1' else logging.INFO