コード例 #1
0
    def configure(cls, return_base_config=True):
        """ Modes description:

            Mountain:
            - Buy orders same QUOTE
            - Sell orders same BASE

            Neutral:
            - Buy orders lower_order_base * sqrt(1 + increment)
            - Sell orders higher_order_quote * sqrt(1 + increment)

            Valley:
            - Buy orders same BASE
            - Sell orders same QUOTE

            Buy slope:
            - All orders same BASE (profit comes in QUOTE)

            Sell slope:
            - All orders same QUOTE (profit made in BASE)
        """
        modes = [('mountain', 'Mountain'), ('neutral', 'Neutral'),
                 ('valley', 'Valley'), ('buy_slope', 'Buy Slope'),
                 ('sell_slope', 'Sell Slope')]

        return BaseConfig.configure(return_base_config) + [
            ConfigElement(
                'mode', 'choice', 'neutral', 'Strategy mode',
                'How to allocate funds and profits. Doesn\'t effect existing orders, only future ones',
                modes),
            ConfigElement('spread', 'float', 6, 'Spread',
                          'The percentage difference between buy and sell',
                          (0, None, 2, '%')),
            ConfigElement(
                'increment', 'float', 4, 'Increment',
                'The percentage difference between staggered orders',
                (0, None, 2, '%')),
            ConfigElement(
                'center_price_dynamic', 'bool', True, 'Market center price',
                'Begin strategy with center price obtained from the market. Use with mature markets',
                None),
            ConfigElement(
                'center_price', 'float', 0, 'Manual center price',
                'In an immature market, give a center price manually to begin with. BASE/QUOTE',
                (0, 1000000000, 8, '')),
            ConfigElement('lower_bound', 'float', 1, 'Lower bound',
                          'The bottom price in the range',
                          (0, 1000000000, 8, '')),
            ConfigElement('upper_bound', 'float', 1000000, 'Upper bound',
                          'The top price in the range',
                          (0, 1000000000, 8, '')),
            ConfigElement('instant_fill', 'bool', True, 'Allow instant fill',
                          'Allow to execute orders by market', None),
            ConfigElement('operational_depth', 'int', 10, 'Operational depth',
                          'Order depth to maintain on books',
                          (2, 9999999, None))
        ]
コード例 #2
0
ファイル: strategy_config.py プロジェクト: bitphage/DEXBot
    def configure(cls, return_base_config=True):
        """ This function is used to auto generate fields for GUI

            :param return_base_config: If base config is used in addition to this configuration.
            :return: List of ConfigElement(s)
        """
        """ As a demonstration this template has two fields in the worker configuration. Upper and lower bound.
            Documentation of ConfigElements can be found from base.py.
        """
        return BaseConfig.configure(return_base_config) + [
            ConfigElement('lower_bound', 'float', 1, 'Lower bound',
                          'The bottom price in the range',
                          (0, 10000000, 8, '')),
            ConfigElement('upper_bound', 'float', 10, 'Upper bound',
                          'The top price in the range', (0, 10000000, 8, '')),
        ]
コード例 #3
0
 def configure(cls, return_base_config=True):
     return BaseConfig.configure(return_base_config)
コード例 #4
0
ファイル: relative_config.py プロジェクト: emmanuelapp/dexbot
    def configure(cls, return_base_config=True):
        """ Return a list of ConfigElement objects defining the configuration values for this class.

            User interfaces should then generate widgets based on these values, gather data and save back to
            the config dictionary for the worker.

            NOTE: When overriding you almost certainly will want to call the ancestor and then
            add your config values to the list.

            :param return_base_config: bool:
            :return: Returns a list of config elements
        """
        # External exchanges used to calculate center price
        EXCHANGES = [
            # ('none', 'None. Use Manual or Bitshares DEX Price (default)'),
            ('gecko', 'Coingecko'),
            ('waves', 'Waves DEX'),
            ('kraken', 'Kraken'),
            ('bitfinex', 'Bitfinex'),
            ('gdax', 'Gdax'),
            ('binance', 'Binance')
        ]

        relative_orders_config = [
            ConfigElement(
                'external_feed', 'bool', False, 'External price feed',
                'Use external reference price instead of center price acquired from the market',
                None),
            ConfigElement(
                'external_price_source', 'choice', EXCHANGES[0][0],
                'External price source',
                'The bot will try to get price information from this source',
                EXCHANGES),
            ConfigElement(
                'amount', 'float', 1, 'Amount',
                'Fixed order size, expressed in quote asset, unless "relative order size" selected',
                (0, None, 8, '')),
            ConfigElement(
                'relative_order_size', 'bool', False, 'Relative order size',
                'Amount is expressed as a percentage of the account balance of quote/base asset',
                None),
            ConfigElement('spread', 'float', 5, 'Spread',
                          'The percentage difference between buy and sell',
                          (0, 100, 2, '%')),
            ConfigElement(
                'dynamic_spread', 'bool', False, 'Dynamic spread',
                'Enable dynamic spread which overrides the spread field',
                None),
            ConfigElement(
                'market_depth_amount', 'float', 0, 'Market depth',
                'From which depth will market spread be measured? (QUOTE amount)',
                (0.00000001, 1000000000, 8, '')),
            ConfigElement(
                'dynamic_spread_factor', 'float', 1, 'Dynamic spread factor',
                'How many percent will own spread be compared to market spread?',
                (0.01, 1000, 2, '%')),
            ConfigElement(
                'center_price', 'float', 0, 'Center price',
                'Fixed center price expressed in base asset: base/quote',
                (0, None, 8, '')),
            ConfigElement(
                'center_price_dynamic', 'bool', True,
                'Measure center price from market orders',
                'Estimate the center from closest opposite orders or from a depth',
                None),
            ConfigElement(
                'center_price_depth', 'float', 0, 'Measurement depth',
                'Cumulative quote amount from which depth center price will be measured',
                (0.00000001, 1000000000, 8, '')),
            ConfigElement(
                'center_price_offset', 'bool', False,
                'Center price offset based on asset balances',
                'Automatically adjust orders up or down based on the imbalance of your assets',
                None),
            ConfigElement(
                'manual_offset', 'float', 0, 'Manual center price offset',
                "Manually adjust orders up or down. "
                "Works independently of other offsets and doesn't override them",
                (-50, 100, 2, '%')),
            ConfigElement(
                'reset_on_partial_fill', 'bool', True,
                'Reset orders on partial fill',
                'Reset orders when buy or sell order is partially filled',
                None),
            ConfigElement('partial_fill_threshold', 'float', 30,
                          'Fill threshold',
                          'Order fill threshold to reset orders',
                          (0, 100, 2, '%')),
            ConfigElement(
                'reset_on_price_change', 'bool', False,
                'Reset orders on center price change',
                'Reset orders when center price is changed more than threshold '
                '(set False for external feeds)', None),
            ConfigElement('price_change_threshold', 'float', 2,
                          'Price change threshold',
                          'Define center price threshold to react on',
                          (0, 100, 2, '%')),
            ConfigElement('custom_expiration', 'bool', False,
                          'Custom expiration',
                          'Override order expiration time to trigger a reset',
                          None),
            ConfigElement(
                'expiration_time', 'int', 157680000, 'Order expiration time',
                'Define custom order expiration time to force orders reset more often, seconds',
                (30, 157680000, ''))
        ]

        return BaseConfig.configure(
            return_base_config) + relative_orders_config
コード例 #5
0
ファイル: koth_config.py プロジェクト: fartingrocket/MMBot
    def configure(cls, return_base_config=True):
        config = [
            ConfigElement(
                'mode',
                'choice',
                'both',
                'Mode',
                'Operational mode',
                ([('both', 'Buy + sell'), ('buy', 'Buy only'),
                  ('sell', 'Sell only')]),
            ),
            ConfigElement(
                'lower_bound',
                'float',
                0,
                'Lower bound',
                'Do not place sell orders lower than this bound',
                (0, 10000000, 8, ''),
            ),
            ConfigElement(
                'upper_bound',
                'float',
                0,
                'Upper bound',
                'Do not place buy orders higher than this bound',
                (0, 10000000, 8, ''),
            ),
            ConfigElement(
                'buy_order_amount',
                'float',
                0,
                'Amount (BASE)',
                'Fixed order size for buy orders, expressed in BASE asset, unless "relative order size"'
                ' selected',
                (0, None, 8, ''),
            ),
            ConfigElement(
                'sell_order_amount',
                'float',
                0,
                'Amount (QUOTE)',
                'Fixed order size for sell orders, expressed in QUOTE asset, unless "relative order size"'
                ' selected',
                (0, None, 8, ''),
            ),
            ConfigElement(
                'relative_order_size',
                'bool',
                False,
                'Relative order size',
                'Amount is expressed as a percentage of the account balance of quote/base asset',
                None,
            ),
            ConfigElement(
                'buy_order_size_threshold',
                'float',
                0,
                'Ignore smaller buy orders',
                'Ignore buy orders which are smaller than this threshold (BASE). '
                'If unset, use own order size as a threshold',
                (0, None, 8, ''),
            ),
            ConfigElement(
                'sell_order_size_threshold',
                'float',
                0,
                'Ignore smaller sell orders',
                'Ignore sell orders which are smaller than this threshold (QUOTE). '
                'If unset, use own order size as a threshold',
                (0, None, 8, ''),
            ),
            ConfigElement(
                'min_order_lifetime',
                'int',
                6,
                'Min order lifetime',
                'Minimum order lifetime before order reset, seconds',
                (1, None, ''),
            ),
        ]

        return BaseConfig.configure(return_base_config) + config
コード例 #6
0
ファイル: staggered_config.py プロジェクト: tryiou/DEXBot
    def configure(cls, return_base_config=True):
        """
        Modes description:

        Mountain:
        - Buy orders same QUOTE
        - Sell orders same BASE

        Neutral:
        - Buy orders lower_order_base * sqrt(1 + increment)
        - Sell orders higher_order_quote * sqrt(1 + increment)

        Valley:
        - Buy orders same BASE
        - Sell orders same QUOTE

        Buy slope:
        - All orders same BASE (profit comes in QUOTE)

        Sell slope:
        - All orders same QUOTE (profit made in BASE)
        """
        modes = [
            ('mountain', 'Mountain'),
            ('neutral', 'Neutral'),
            ('valley', 'Valley'),
            ('buy_slope', 'Buy Slope'),
            ('sell_slope', 'Sell Slope'),
        ]

        return BaseConfig.configure(return_base_config) + [
            ConfigElement(
                'mode',
                'choice',
                'neutral',
                'Strategy mode',
                'How to allocate funds and profits. Doesn\'t effect existing orders, only future ones',
                modes,
            ),
            ConfigElement('spread', 'float', 6, 'Spread',
                          'The percentage difference between buy and sell',
                          (0, None, 2, '%')),
            ConfigElement(
                'increment',
                'float',
                4,
                'Increment',
                'The percentage difference between staggered orders',
                (0, None, 2, '%'),
            ),
            ConfigElement(
                'center_price_dynamic',
                'bool',
                True,
                'Market center price',
                'Begin strategy with center price obtained from the market. Use with mature markets',
                None,
            ),
            ConfigElement(
                'center_price',
                'float',
                0,
                'Manual center price',
                'In an immature market, give a center price manually to begin with. BASE/QUOTE',
                (0, 1000000000, 8, ''),
            ),
            ConfigElement(
                'lower_bound',
                'float',
                1,
                'Lower bound',
                'The lowest price (Quote/Base) in the range',
                (0, 1000000000, 8, ''),
            ),
            ConfigElement(
                'upper_bound',
                'float',
                1000000,
                'Upper bound',
                'The highest price (Quote/Base) in the range',
                (0, 1000000000, 8, ''),
            ),
            ConfigElement('instant_fill', 'bool', True, 'Allow instant fill',
                          'Allow to execute orders by market', None),
            ConfigElement(
                'operational_depth',
                'int',
                10,
                'Operational depth',
                'Order depth to maintain on books',
                (2, 9999999, None),
            ),
            ConfigElement(
                'enable_fallback_logic',
                'bool',
                True,
                'Enable fallback logic',
                'When unable to close the spread, cancel lowest buy order and place closer buy order',
                None,
            ),
            ConfigElement(
                'enable_stop_loss',
                'bool',
                False,
                'Enable Stop Loss',
                'Stop Loss order placed when bid price comes near lower bound',
                None,
            ),
            ConfigElement(
                'stop_loss_discount',
                'float',
                5,
                'Stop Loss discount',
                'Discount percent, Stop Loss order price = bid price / (1 + discount percent)',
                (0, None, 2, '%'),
            ),
            ConfigElement(
                'stop_loss_amount',
                'float',
                50,
                'Stop Loss Amount',
                'Relative amount of QUOTE asset to sell at Stop Loss, percentage',
                (0, None, 2, '%'),
            ),
        ]
コード例 #7
0
ファイル: flexible_config.py プロジェクト: bitphage/DEXBot
    def configure(cls, return_base_config=True):
        # External exchanges used to calculate center price
        EXCHANGES = [
            # ('none', 'None. Use Manual or Bitshares DEX Price (default)'),
            ('gecko', 'Coingecko'),
            ('waves', 'Waves DEX'),
            ('kraken', 'Kraken'),
            ('bitfinex', 'Bitfinex'),
            ('gdax', 'Gdax'),
            ('binance', 'Binance'),
        ]

        config = [
            ConfigElement(
                'buy_distance',
                'float',
                2,
                'Buy distance',
                'The percentage difference between buy order and center price',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'sell_distance',
                'float',
                2,
                'Sell distance',
                'The percentage difference between sell order and center price',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'buy_orders',
                'string',
                '3-2-1',
                'Buy orders',
                'Buy orders in relative amounts, you can set any number of orders. Orders are from far end towards'
                ' center',
                r'[0-9\.-]+',
            ),
            ConfigElement(
                'sell_orders',
                'string',
                '1-2-3',
                'Sell orders',
                'Sell orders in relative amounts, you can set any number of orders. Orders are from center towards'
                ' far end',
                r'[0-9\.-]+',
            ),
            ConfigElement(
                'buy_increment_step',
                'float',
                2,
                'Buy orders increment step',
                'Increment % between orders on the buy side',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'sell_increment_step',
                'float',
                2,
                'Sell orders increment step',
                'Increment % between orders on the sell side',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'buy_stop_ratio',
                'float',
                50,
                'Buy stop ratio',
                'Stop placing buy orders if BASE asset value becomes less than this ratio, percentage 0-100',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'sell_stop_ratio',
                'float',
                50,
                'Sell stop ratio',
                'Stop placing sell orders if QUOTE asset value becomes less than this ratio, percentage 0-100',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'external_feed',
                'bool',
                False,
                'External price feed',
                'Use external reference price instead of center price acquired from the market',
                None,
            ),
            ConfigElement(
                'external_price_source',
                'choice',
                EXCHANGES[0][0],
                'External price source',
                'The bot will try to get price information from this source',
                EXCHANGES,
            ),
            ConfigElement(
                'center_price_depth',
                'float',
                0,
                'Center price depth',
                'Cumulative quote amount from which depth center price will be measured',
                (0.00000000, 1000000000, 8, ''),
            ),
            ConfigElement(
                'center_price_from_last_trade',
                'bool',
                False,
                'Last trade price as new center price',
                'This will make orders move by half the spread at every fill',
                None,
            ),
            ConfigElement(
                'reset_on_partial_fill',
                'bool',
                True,
                'Reset orders on partial fill',
                'Reset orders when buy or sell order is partially filled',
                None,
            ),
            ConfigElement(
                'partial_fill_threshold',
                'float',
                90,
                'Fill threshold',
                'Order fill threshold to reset orders',
                (0, 100, 2, '%'),
            ),
            ConfigElement(
                'reset_on_price_change',
                'bool',
                False,
                'Reset orders on center price change',
                'Reset orders when center price is changed more than threshold',
                None,
            ),
            ConfigElement(
                'price_change_threshold',
                'float',
                0.5,
                'Price change threshold',
                'Define center price threshold to react on, percentage (consider using 1/10 of your spread)',
                (0, 100, 0.5, '%'),
            ),
        ]

        return BaseConfig.configure(return_base_config) + config