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:
parent
371ee1e457
commit
858d2329e5
@ -29,6 +29,9 @@
|
|||||||
"BTC_LUN"
|
"BTC_LUN"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"experimental": {
|
||||||
|
"use_sell_signal": false
|
||||||
|
},
|
||||||
"telegram": {
|
"telegram": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"token": "token",
|
"token": "token",
|
||||||
|
@ -156,10 +156,19 @@ def handle_trade(trade: Trade) -> bool:
|
|||||||
|
|
||||||
logger.debug('Handling %s ...', trade)
|
logger.debug('Handling %s ...', trade)
|
||||||
current_rate = exchange.get_ticker(trade.pair)['bid']
|
current_rate = exchange.get_ticker(trade.pair)['bid']
|
||||||
if min_roi_reached(trade, current_rate, datetime.utcnow()) or get_signal(trade.pair, SignalType.SELL):
|
|
||||||
|
# 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)
|
execute_sell(trade, current_rate)
|
||||||
return True
|
return True
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_target_bid(ticker: Dict[str, float]) -> float:
|
def get_target_bid(ticker: Dict[str, float]) -> float:
|
||||||
|
@ -202,6 +202,12 @@ CONF_SCHEMA = {
|
|||||||
'required': ['ask_last_balance']
|
'required': ['ask_last_balance']
|
||||||
},
|
},
|
||||||
'exchange': {'$ref': '#/definitions/exchange'},
|
'exchange': {'$ref': '#/definitions/exchange'},
|
||||||
|
'experimental': {
|
||||||
|
'type': 'object',
|
||||||
|
'properties': {
|
||||||
|
'use_sell_signal': {'type': 'boolean'}
|
||||||
|
}
|
||||||
|
},
|
||||||
'telegram': {
|
'telegram': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
Loading…
Reference in New Issue
Block a user