Ejemplo n.º 1
0
    def __init__(self, options):
        super().__init__("watcher", options)

        self._watchers = {}

        self._identity = options.get('identity', 'demo')
        self._backtesting = options.get('backtesting', False)

        # fetchers config
        self._fetchers_config = utils.load_config(options, 'fetchers')

        # user identities
        self._identities_config = utils.identities(options.get('config-path'))
        self._profile = options.get('profile', 'default')
        self._profile_config = utils.load_config(options, "profiles/%s" % self._profile)

        # watchers config
        self._watchers_config = self._init_watchers_config(options)

        # backtesting options
        self._backtesting = options.get('backtesting', False)
        self._start_timestamp = options['from'].timestamp() if options.get('from') else 0
        self._end_timestamp = options['to'].timestamp() if options.get('to') else 0

        # read-only, means to do not write to the market DB
        self._read_only = options.get('read-only', False)
Ejemplo n.º 2
0
    def __init__(self, watcher_service, monitor_service, options):
        super().__init__("trader", options)

        self._traders = {}

        self._keys_map_to_trader = {}
        self._next_trader_key = 1
        self._next_trader_uid = 1

        self._keys_map_to_order = {}
        self._next_key = 1
        self._next_order_uid = 1

        self._policy = TraderService.POLICY_COPY_EVERYWHERE
        self._watcher_service = watcher_service
        self._monitor_service = monitor_service

        self._identity = options.get('identity', 'demo')
        self._report_path = options.get('reports-path', './')
        self._watcher_only = options.get('watcher-only', False)

        # user identities
        self._identities_config = utils.identities(
            options.get('config-path')) or {}
        self._profile = options.get('profile', 'default')
        self._profile_config = utils.profiles(options.get('config-path')) or {}

        # traders config
        self._traders_config = self._init_traders_config(options)

        # backtesting options
        self._backtesting = options.get('backtesting', False)
        self._start_timestamp = options['from'].timestamp() if options.get(
            'from') else 0
        self._end_timestamp = options['to'].timestamp() if options.get(
            'to') else 0

        # enable/disable execution of order/position (play/pause)
        self._activity = True

        # paper mode options
        self._paper_mode = options.get('paper-mode', False)