Merge branch 'StopLossSupport' into wohlgemuth

This commit is contained in:
Gert Wohlgemuth 2018-05-13 11:39:04 -07:00
commit 30d6d562af
4 changed files with 9 additions and 7 deletions

View File

@ -4,6 +4,7 @@
"stake_amount": 0.05, "stake_amount": 0.05,
"fiat_display_currency": "USD", "fiat_display_currency": "USD",
"dry_run": false, "dry_run": false,
"trailing_stop": false,
"unfilledtimeout": 600, "unfilledtimeout": 600,
"bid_strategy": { "bid_strategy": {
"ask_last_balance": 0.0 "ask_last_balance": 0.0

View File

@ -5,6 +5,7 @@
"fiat_display_currency": "USD", "fiat_display_currency": "USD",
"dry_run": false, "dry_run": false,
"ticker_interval": "5m", "ticker_interval": "5m",
"trailing_stop": true,
"minimal_roi": { "minimal_roi": {
"40": 0.0, "40": 0.0,
"30": 0.01, "30": 0.01,

View File

@ -205,11 +205,11 @@ class Analyze(object):
# just for debugging # just for debugging
if 'trailing_stop' in self.config and self.config['trailing_stop']: if 'trailing_stop' in self.config and self.config['trailing_stop']:
print( logger.warning(
"HIT STOP: current price at {:.6f}, stop loss is {:.6f}, " "HIT STOP: current price at {:.6f}, stop loss is {:.6f}, "
"initial stop loss was at {:.6f}, trade opened at {:.6f}".format( "initial stop loss was at {:.6f}, trade opened at {:.6f}".format(
current_rate, trade.stop_loss, trade.initial_stop_loss, trade.open_rate)) current_rate, trade.stop_loss, trade.initial_stop_loss, trade.open_rate))
print("trailing stop saved us: {:.6f}".format(trade.stop_loss - trade.initial_stop_loss)) logger.debug("trailing stop saved us: {:.6f}".format(trade.stop_loss - trade.initial_stop_loss))
logger.debug('Stop loss hit.') logger.debug('Stop loss hit.')
return True return True

View File

@ -128,7 +128,7 @@ class Trade(_DECL_BASE):
self.max_rate = current_price self.max_rate = current_price
# no stop loss assigned yet # no stop loss assigned yet
if self.stop_loss is None: if self.stop_loss is None or self.stop_loss == 0:
logger.debug("assigning new stop loss") logger.debug("assigning new stop loss")
self.stop_loss = new_loss self.stop_loss = new_loss
self.initial_stop_loss = new_loss self.initial_stop_loss = new_loss
@ -142,12 +142,12 @@ class Trade(_DECL_BASE):
logger.debug("keeping current stop loss") logger.debug("keeping current stop loss")
print( print(
"{} - current price {:.6f}, bought at {:.6f} and calculated " "{} - current price {:.8f}, bought at {:.8f} and calculated "
"stop loss is at: {:.6f} initial stop at {:.6f}. trailing stop loss saved us: {:.6f} " "stop loss is at: {:.8f} initial stop at {:.8f}. trailing stop loss saved us: {:.8f} "
"and max observed rate was {:.6f}".format( "and max observed rate was {:.8f}".format(
self.pair, current_price, self.open_rate, self.pair, current_price, self.open_rate,
self.initial_stop_loss, self.initial_stop_loss,
self.stop_loss, self.stop_loss - self.initial_stop_loss, self.stop_loss, float(self.stop_loss) - float(self.initial_stop_loss),
self.max_rate self.max_rate
)) ))