2018-02-04 00:04:26 +00:00
|
|
|
# pragma pylint: disable=too-few-public-methods
|
|
|
|
|
|
|
|
"""
|
2018-04-02 14:42:53 +00:00
|
|
|
bot constants
|
2018-02-04 00:04:26 +00:00
|
|
|
"""
|
2018-04-02 14:42:53 +00:00
|
|
|
DYNAMIC_WHITELIST = 20 # pairs
|
|
|
|
PROCESS_THROTTLE_SECS = 5 # sec
|
|
|
|
TICKER_INTERVAL = 5 # min
|
|
|
|
HYPEROPT_EPOCH = 100 # epochs
|
|
|
|
RETRY_TIMEOUT = 30 # sec
|
|
|
|
DEFAULT_STRATEGY = 'DefaultStrategy'
|
2018-04-01 11:06:50 +00:00
|
|
|
DEFAULT_HYPEROPT = 'DefaultHyperOpts'
|
2018-06-07 15:29:43 +00:00
|
|
|
DEFAULT_DB_PROD_URL = 'sqlite:///tradesv3.sqlite'
|
|
|
|
DEFAULT_DB_DRYRUN_URL = 'sqlite://'
|
2018-05-25 14:04:08 +00:00
|
|
|
UNLIMITED_STAKE_AMOUNT = 'unlimited'
|
2018-11-25 16:30:06 +00:00
|
|
|
REQUIRED_ORDERTYPES = ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
|
2018-11-17 12:05:35 +00:00
|
|
|
ORDERTYPE_POSSIBILITIES = ['limit', 'market']
|
2018-12-03 19:48:51 +00:00
|
|
|
AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList']
|
2018-02-04 00:04:26 +00:00
|
|
|
|
2018-05-02 20:49:55 +00:00
|
|
|
TICKER_INTERVAL_MINUTES = {
|
|
|
|
'1m': 1,
|
2018-06-04 13:35:00 +00:00
|
|
|
'3m': 3,
|
2018-05-02 20:49:55 +00:00
|
|
|
'5m': 5,
|
|
|
|
'15m': 15,
|
|
|
|
'30m': 30,
|
|
|
|
'1h': 60,
|
|
|
|
'2h': 120,
|
|
|
|
'4h': 240,
|
|
|
|
'6h': 360,
|
2018-06-04 13:35:00 +00:00
|
|
|
'8h': 480,
|
2018-05-02 20:49:55 +00:00
|
|
|
'12h': 720,
|
|
|
|
'1d': 1440,
|
2018-06-04 13:35:00 +00:00
|
|
|
'3d': 4320,
|
2018-05-02 20:49:55 +00:00
|
|
|
'1w': 10080,
|
|
|
|
}
|
2018-02-04 00:04:26 +00:00
|
|
|
|
2018-06-03 11:47:36 +00:00
|
|
|
SUPPORTED_FIAT = [
|
|
|
|
"AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK",
|
|
|
|
"EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY",
|
|
|
|
"KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN",
|
2018-06-04 13:45:47 +00:00
|
|
|
"RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR", "USD",
|
2018-08-01 06:03:34 +00:00
|
|
|
"BTC", "XBT", "ETH", "XRP", "LTC", "BCH", "USDT"
|
2018-10-02 10:42:59 +00:00
|
|
|
]
|
2018-02-04 00:04:26 +00:00
|
|
|
|
2018-04-02 14:42:53 +00:00
|
|
|
# Required json-schema for user specified config
|
|
|
|
CONF_SCHEMA = {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
2018-11-14 10:37:53 +00:00
|
|
|
'max_open_trades': {'type': 'integer', 'minimum': -1},
|
2018-05-02 20:49:55 +00:00
|
|
|
'ticker_interval': {'type': 'string', 'enum': list(TICKER_INTERVAL_MINUTES.keys())},
|
2018-08-01 06:03:34 +00:00
|
|
|
'stake_currency': {'type': 'string', 'enum': ['BTC', 'XBT', 'ETH', 'USDT', 'EUR', 'USD']},
|
2018-06-03 22:48:26 +00:00
|
|
|
'stake_amount': {
|
|
|
|
"type": ["number", "string"],
|
|
|
|
"minimum": 0.0005,
|
|
|
|
"pattern": UNLIMITED_STAKE_AMOUNT
|
|
|
|
},
|
2018-06-03 11:47:36 +00:00
|
|
|
'fiat_display_currency': {'type': 'string', 'enum': SUPPORTED_FIAT},
|
2018-04-02 14:42:53 +00:00
|
|
|
'dry_run': {'type': 'boolean'},
|
2018-09-01 17:52:40 +00:00
|
|
|
'process_only_new_candles': {'type': 'boolean'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'minimal_roi': {
|
|
|
|
'type': 'object',
|
|
|
|
'patternProperties': {
|
|
|
|
'^[0-9.]+$': {'type': 'number'}
|
2018-02-04 00:04:26 +00:00
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'minProperties': 1
|
|
|
|
},
|
|
|
|
'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True},
|
2018-06-26 21:06:27 +00:00
|
|
|
'trailing_stop': {'type': 'boolean'},
|
2018-07-01 17:54:26 +00:00
|
|
|
'trailing_stop_positive': {'type': 'number', 'minimum': 0, 'maximum': 1},
|
2018-07-16 19:23:35 +00:00
|
|
|
'trailing_stop_positive_offset': {'type': 'number', 'minimum': 0, 'maximum': 1},
|
2018-06-14 01:32:52 +00:00
|
|
|
'unfilledtimeout': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'buy': {'type': 'number', 'minimum': 3},
|
|
|
|
'sell': {'type': 'number', 'minimum': 10}
|
|
|
|
}
|
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'bid_strategy': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'ask_last_balance': {
|
|
|
|
'type': 'number',
|
|
|
|
'minimum': 0,
|
|
|
|
'maximum': 1,
|
2018-08-29 09:38:43 +00:00
|
|
|
'exclusiveMaximum': False,
|
|
|
|
'use_order_book': {'type': 'boolean'},
|
|
|
|
'order_book_top': {'type': 'number', 'maximum': 20, 'minimum': 1},
|
|
|
|
'check_depth_of_market': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'enabled': {'type': 'boolean'},
|
|
|
|
'bids_to_ask_delta': {'type': 'number', 'minimum': 0},
|
|
|
|
}
|
|
|
|
},
|
2018-02-04 00:04:26 +00:00
|
|
|
},
|
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'required': ['ask_last_balance']
|
|
|
|
},
|
2018-08-29 09:38:43 +00:00
|
|
|
'ask_strategy': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'use_order_book': {'type': 'boolean'},
|
|
|
|
'order_book_min': {'type': 'number', 'minimum': 1},
|
|
|
|
'order_book_max': {'type': 'number', 'minimum': 1, 'maximum': 50}
|
|
|
|
}
|
|
|
|
},
|
2018-11-17 12:05:35 +00:00
|
|
|
'order_types': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'buy': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
|
|
|
'sell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
2018-11-25 16:22:56 +00:00
|
|
|
'stoploss': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
|
|
|
'stoploss_on_exchange': {'type': 'boolean'}
|
2018-11-17 12:05:35 +00:00
|
|
|
},
|
2018-11-25 18:03:28 +00:00
|
|
|
'required': ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
|
2018-11-17 12:05:35 +00:00
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'exchange': {'$ref': '#/definitions/exchange'},
|
2018-10-02 10:42:59 +00:00
|
|
|
'edge': {'$ref': '#/definitions/edge'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'experimental': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'use_sell_signal': {'type': 'boolean'},
|
2018-06-22 18:10:05 +00:00
|
|
|
'sell_profit_only': {'type': 'boolean'},
|
2018-08-29 09:38:43 +00:00
|
|
|
'ignore_roi_if_buy_signal_true': {'type': 'boolean'}
|
2018-02-04 00:04:26 +00:00
|
|
|
}
|
|
|
|
},
|
2018-12-03 19:00:18 +00:00
|
|
|
'whitelist': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
2018-12-03 19:48:51 +00:00
|
|
|
'method': {'type': 'string', 'enum': AVAILABLE_PAIRLISTS},
|
2018-12-03 19:00:18 +00:00
|
|
|
'config': {'type': 'object'}
|
|
|
|
},
|
|
|
|
'required': ['method']
|
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'telegram': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'enabled': {'type': 'boolean'},
|
|
|
|
'token': {'type': 'string'},
|
|
|
|
'chat_id': {'type': 'string'},
|
|
|
|
},
|
|
|
|
'required': ['enabled', 'token', 'chat_id']
|
|
|
|
},
|
2018-07-07 11:39:21 +00:00
|
|
|
'webhook': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'enabled': {'type': 'boolean'},
|
|
|
|
'webhookbuy': {'type': 'object'},
|
|
|
|
'webhooksell': {'type': 'object'},
|
|
|
|
'webhookstatus': {'type': 'object'},
|
|
|
|
},
|
|
|
|
},
|
2018-06-07 03:26:39 +00:00
|
|
|
'db_url': {'type': 'string'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'initial_state': {'type': 'string', 'enum': ['running', 'stopped']},
|
2018-10-10 18:08:29 +00:00
|
|
|
'forcebuy_enable': {'type': 'boolean'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'internals': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'process_throttle_secs': {'type': 'number'},
|
|
|
|
'interval': {'type': 'integer'}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'definitions': {
|
|
|
|
'exchange': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
'name': {'type': 'string'},
|
2018-07-27 08:55:36 +00:00
|
|
|
'sandbox': {'type': 'boolean'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'key': {'type': 'string'},
|
|
|
|
'secret': {'type': 'string'},
|
2018-07-27 12:07:07 +00:00
|
|
|
'password': {'type': 'string'},
|
2018-07-27 12:19:01 +00:00
|
|
|
'uid': {'type': 'string'},
|
2018-04-02 14:42:53 +00:00
|
|
|
'pair_whitelist': {
|
|
|
|
'type': 'array',
|
|
|
|
'items': {
|
|
|
|
'type': 'string',
|
2018-05-02 20:49:55 +00:00
|
|
|
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
|
2018-02-04 00:04:26 +00:00
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'uniqueItems': True
|
2018-02-04 00:04:26 +00:00
|
|
|
},
|
2018-04-02 14:42:53 +00:00
|
|
|
'pair_blacklist': {
|
|
|
|
'type': 'array',
|
|
|
|
'items': {
|
|
|
|
'type': 'string',
|
2018-05-02 20:49:55 +00:00
|
|
|
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
|
2018-04-02 14:42:53 +00:00
|
|
|
},
|
|
|
|
'uniqueItems': True
|
2018-08-07 07:25:21 +00:00
|
|
|
},
|
2018-10-04 18:34:48 +00:00
|
|
|
'outdated_offset': {'type': 'integer', 'minimum': 1},
|
|
|
|
'ccxt_config': {'type': 'object'},
|
|
|
|
'ccxt_async_config': {'type': 'object'}
|
2018-04-02 14:42:53 +00:00
|
|
|
},
|
|
|
|
'required': ['name', 'key', 'secret', 'pair_whitelist']
|
2018-10-02 10:42:59 +00:00
|
|
|
},
|
|
|
|
'edge': {
|
|
|
|
'type': 'object',
|
|
|
|
'properties': {
|
|
|
|
"enabled": {'type': 'boolean'},
|
|
|
|
"process_throttle_secs": {'type': 'integer', 'minimum': 600},
|
|
|
|
"calculate_since_number_of_days": {'type': 'integer'},
|
|
|
|
"allowed_risk": {'type': 'number'},
|
|
|
|
"stoploss_range_min": {'type': 'number'},
|
|
|
|
"stoploss_range_max": {'type': 'number'},
|
|
|
|
"stoploss_range_step": {'type': 'number'},
|
2018-11-03 13:31:34 +00:00
|
|
|
"minimum_winrate": {'type': 'number'},
|
2018-10-02 10:42:59 +00:00
|
|
|
"minimum_expectancy": {'type': 'number'},
|
|
|
|
"min_trade_number": {'type': 'number'},
|
|
|
|
"max_trade_duration_minute": {'type': 'integer'},
|
|
|
|
"remove_pumps": {'type': 'boolean'}
|
|
|
|
}
|
2018-04-02 14:42:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'anyOf': [
|
|
|
|
{'required': ['exchange']}
|
|
|
|
],
|
|
|
|
'required': [
|
|
|
|
'max_open_trades',
|
|
|
|
'stake_currency',
|
|
|
|
'stake_amount',
|
|
|
|
'dry_run',
|
|
|
|
'bid_strategy',
|
|
|
|
'telegram'
|
|
|
|
]
|
|
|
|
}
|