add experimental flag support and add use_sell_signal (#143)

* add use_sell_signal to config schema

* check use_sell_signal

* set use_sell_signal to false
This commit is contained in:
Michael Egger 2017-11-24 21:58:00 +01:00 committed by GitHub
parent 371ee1e457
commit 858d2329e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 4 deletions

View File

@ -29,6 +29,9 @@
"BTC_LUN"
]
},
"experimental": {
"use_sell_signal": false
},
"telegram": {
"enabled": true,
"token": "token",

View File

@ -156,10 +156,19 @@ def handle_trade(trade: Trade) -> bool:
logger.debug('Handling %s ...', trade)
current_rate = exchange.get_ticker(trade.pair)['bid']
if min_roi_reached(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL):
execute_sell(trade, current_rate)
return True
return False
# Check if minimal roi has been reached
if not min_roi_reached(trade, current_rate, datetime.utcnow()):
return False
# Check if sell signal has been enabled and triggered
if _CONF.get('experimental', {}).get('use_sell_signal'):
logger.debug('Checking sell_signal ...')
if not get_signal(trade.pair, SignalType.SELL):
return False
execute_sell(trade, current_rate)
return True
def get_target_bid(ticker: Dict[str, float]) -> float:

View File

@ -202,6 +202,12 @@ CONF_SCHEMA = {
'required': ['ask_last_balance']
},
'exchange': {'$ref': '#/definitions/exchange'},
'experimental': {
'type': 'object',
'properties': {
'use_sell_signal': {'type': 'boolean'}
}
},
'telegram': {
'type': 'object',
'properties': {