rename slack to slacklog

This commit is contained in:
c9s 2020-09-19 08:13:06 +08:00
parent 2e039c047a
commit 5d0b022027
4 changed files with 7 additions and 7 deletions

View File

@ -8,7 +8,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/slack-go/slack" "github.com/slack-go/slack"
"github.com/c9s/bbgo/pkg/bbgo/slack/slackstyle" "github.com/c9s/bbgo/pkg/bbgo/slacklog/slackstyle"
"github.com/c9s/bbgo/pkg/bbgo/types" "github.com/c9s/bbgo/pkg/bbgo/types"
) )

View File

@ -28,9 +28,9 @@ type SlackAttachmentCreator interface {
type SlackNotifier struct { type SlackNotifier struct {
Slack *slack.Client Slack *slack.Client
TradingChannel string TradeChannel string
ErrorChannel string ErrorChannel string
InfoChannel string InfoChannel string
} }
func (n *SlackNotifier) Notify(format string, args ...interface{}) { func (n *SlackNotifier) Notify(format string, args ...interface{}) {
@ -74,7 +74,7 @@ func (n *SlackNotifier) Notify(format string, args ...interface{}) {
} }
func (n *SlackNotifier) ReportTrade(trade *types.Trade) { func (n *SlackNotifier) ReportTrade(trade *types.Trade) {
_, _, err := n.Slack.PostMessageContext(context.Background(), n.TradingChannel, _, _, err := n.Slack.PostMessageContext(context.Background(), n.TradeChannel,
slack.MsgOptionText(util.Render(`:handshake: {{ .Symbol }} {{ .Side }} Trade Execution @ {{ .Price }}`, trade), true), slack.MsgOptionText(util.Render(`:handshake: {{ .Symbol }} {{ .Side }} Trade Execution @ {{ .Price }}`, trade), true),
slack.MsgOptionAttachments(trade.SlackAttachment())) slack.MsgOptionAttachments(trade.SlackAttachment()))
@ -86,7 +86,7 @@ func (n *SlackNotifier) ReportTrade(trade *types.Trade) {
func (n *SlackNotifier) ReportPnL(report *ProfitAndLossReport) { func (n *SlackNotifier) ReportPnL(report *ProfitAndLossReport) {
attachment := report.SlackAttachment() attachment := report.SlackAttachment()
_, _, err := n.Slack.PostMessageContext(context.Background(), n.TradingChannel, _, _, err := n.Slack.PostMessageContext(context.Background(), n.TradeChannel,
slack.MsgOptionText(util.Render( slack.MsgOptionText(util.Render(
`:heavy_dollar_sign: Here is your *{{ .symbol }}* PnL report collected since *{{ .startTime }}*`, `:heavy_dollar_sign: Here is your *{{ .symbol }}* PnL report collected since *{{ .startTime }}*`,
map[string]interface{}{ map[string]interface{}{

View File

@ -1,4 +1,4 @@
package slack package slacklog
import ( import (
"context" "context"