From bbca05234a293da97f60f60f8eb2398bba2e8e2c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 9 Oct 2020 15:59:33 +0800 Subject: [PATCH] chore: make code more readable --- accounting/report.go | 5 ++--- slack/slacklog/logrus_look.go | 2 +- types/trade.go | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/accounting/report.go b/accounting/report.go index 2367ad17e..b02db51d1 100644 --- a/accounting/report.go +++ b/accounting/report.go @@ -44,11 +44,10 @@ func (report ProfitAndLossReport) Print() { } func (report ProfitAndLossReport) SlackAttachment() slack.Attachment { - var color = "" + var color = slackstyle.Red + if report.UnrealizedProfit > 0 { color = slackstyle.Green - } else { - color = slackstyle.Red } market, ok := types.FindMarket(report.Symbol) diff --git a/slack/slacklog/logrus_look.go b/slack/slacklog/logrus_look.go index cb58b8d8f..34f6a2467 100644 --- a/slack/slacklog/logrus_look.go +++ b/slack/slacklog/logrus_look.go @@ -32,7 +32,7 @@ func (t *LogHook) Levels() []logrus.Level { } func (t *LogHook) Fire(e *logrus.Entry) error { - var color = "#F0F0F0" + var color = "" switch e.Level { case logrus.DebugLevel: diff --git a/types/trade.go b/types/trade.go index b8b478490..e8633d64f 100644 --- a/types/trade.go +++ b/types/trade.go @@ -30,11 +30,10 @@ type Trade struct { } func (trade Trade) SlackAttachment() slack.Attachment { - var color = "" + var color = "#DC143C" + if trade.IsBuyer { color = "#228B22" - } else { - color = "#DC143C" } market, ok := FindMarket(trade.Symbol)