Merge pull request #92 from gcarq/feature/rework-dry_run-mode

rework dry_run
This commit is contained in:
Michael Egger
2017-11-06 16:54:55 +01:00
committed by GitHub
4 changed files with 50 additions and 69 deletions

View File

@@ -141,9 +141,9 @@ def _status(bot: Bot, update: Update) -> None:
*Current Pair:* [{pair}]({market_url})
*Open Since:* `{date}`
*Amount:* `{amount}`
*Open Rate:* `{open_rate}`
*Open Rate:* `{open_rate:.8f}`
*Close Rate:* `{close_rate}`
*Current Rate:* `{current_rate}`
*Current Rate:* `{current_rate:.8f}`
*Close Profit:* `{close_profit}`
*Current Profit:* `{current_profit:.2f}%`
*Open Order:* `{open_order}`
@@ -243,13 +243,12 @@ def _profit(bot: Bot, update: Update) -> None:
bp_pair, bp_rate = best_pair
markdown_msg = """
*ROI:* `{profit_btc:.6f} ({profit:.2f}%)`
*ROI:* `{profit_btc:.8f} ({profit:.2f}%)`
*Trade Count:* `{trade_count}`
*First Trade opened:* `{first_trade_date}`
*Latest Trade opened:* `{latest_trade_date}`
*Avg. Duration:* `{avg_duration}`
*Best Performing:* `{best_pair}: {best_rate:.2f}%`
{dry_run_info}
""".format(
profit_btc=round(sum(profit_amounts), 8),
profit=round(sum(profits) * 100, 2),
@@ -259,8 +258,6 @@ def _profit(bot: Bot, update: Update) -> None:
avg_duration=str(timedelta(seconds=sum(durations) / float(len(durations)))).split('.')[0],
best_pair=bp_pair,
best_rate=round(bp_rate * 100, 2),
dry_run_info='\n*NOTE:* These values are mocked because *dry_run* is enabled!'
if _CONF['dry_run'] else ''
)
send_msg(markdown_msg, bot=bot)
@@ -377,11 +374,7 @@ def _performance(bot: Bot, update: Update) -> None:
profit=round(rate * 100, 2)
) for i, (pair, rate) in enumerate(pair_rates))
message = '<b>Performance:</b>\n{}\n{}'.format(
stats,
'<b>NOTE:</b> These values are mocked because <b>dry_run</b> is enabled.'
if _CONF['dry_run'] else ''
)
message = '<b>Performance:</b>\n{}'.format(stats)
logger.debug(message)
send_msg(message, parse_mode=ParseMode.HTML)