Merge pull request #6 from appleboy/patch

chore: make code more readable
This commit is contained in:
Yo-An Lin 2020-10-09 21:03:56 +08:00 committed by GitHub
commit 38307f0f43
3 changed files with 5 additions and 7 deletions

View File

@ -44,11 +44,10 @@ func (report ProfitAndLossReport) Print() {
} }
func (report ProfitAndLossReport) SlackAttachment() slack.Attachment { func (report ProfitAndLossReport) SlackAttachment() slack.Attachment {
var color = "" var color = slackstyle.Red
if report.UnrealizedProfit > 0 { if report.UnrealizedProfit > 0 {
color = slackstyle.Green color = slackstyle.Green
} else {
color = slackstyle.Red
} }
market, ok := types.FindMarket(report.Symbol) market, ok := types.FindMarket(report.Symbol)

View File

@ -32,7 +32,7 @@ func (t *LogHook) Levels() []logrus.Level {
} }
func (t *LogHook) Fire(e *logrus.Entry) error { func (t *LogHook) Fire(e *logrus.Entry) error {
var color = "#F0F0F0" var color = ""
switch e.Level { switch e.Level {
case logrus.DebugLevel: case logrus.DebugLevel:

View File

@ -30,11 +30,10 @@ type Trade struct {
} }
func (trade Trade) SlackAttachment() slack.Attachment { func (trade Trade) SlackAttachment() slack.Attachment {
var color = "" var color = "#DC143C"
if trade.IsBuyer { if trade.IsBuyer {
color = "#228B22" color = "#228B22"
} else {
color = "#DC143C"
} }
market, ok := FindMarket(trade.Symbol) market, ok := FindMarket(trade.Symbol)