mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
rename slack to slacklog
This commit is contained in:
parent
2e039c047a
commit
5d0b022027
|
@ -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"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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{}{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package slack
|
package slacklog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
Loading…
Reference in New Issue
Block a user