mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
improve detector name
This commit is contained in:
parent
cbd7a3bd21
commit
377cf2e0ba
|
@ -50,9 +50,9 @@ func (e *BinanceExchange) QueryKLines(ctx context.Context, symbol, interval stri
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var klines []KLine
|
||||
var kLines []KLine
|
||||
for _, kline := range resp {
|
||||
klines = append(klines, KLine{
|
||||
kLines = append(kLines, KLine{
|
||||
Symbol: symbol,
|
||||
Interval: interval,
|
||||
StartTime: kline.OpenTime,
|
||||
|
@ -66,7 +66,7 @@ func (e *BinanceExchange) QueryKLines(ctx context.Context, symbol, interval stri
|
|||
NumberOfTrades: kline.TradeNum,
|
||||
})
|
||||
}
|
||||
return klines, nil
|
||||
return kLines, nil
|
||||
}
|
||||
|
||||
func (e *BinanceExchange) QueryTrades(ctx context.Context, market string, startTime time.Time) (trades []Trade, err error) {
|
||||
|
|
|
@ -16,6 +16,7 @@ func NotZero(v float64) bool {
|
|||
}
|
||||
|
||||
type KLineDetector struct {
|
||||
Name string `json:"name"`
|
||||
Interval string `json:"interval"`
|
||||
MinPriceChange float64 `json:"minPriceChange"`
|
||||
MaxPriceChange float64 `json:"maxPriceChange"`
|
||||
|
@ -34,9 +35,16 @@ type KLineDetector struct {
|
|||
}
|
||||
|
||||
func (d *KLineDetector) SlackAttachment() slack.Attachment {
|
||||
var name = fmt.Sprintf("Detector %s", d.Interval)
|
||||
var name = "Detector "
|
||||
|
||||
if len(d.Name) > 0 {
|
||||
name += " " + d.Name
|
||||
}
|
||||
|
||||
name += fmt.Sprintf(" %s", d.Interval)
|
||||
|
||||
if d.EnableLookBack {
|
||||
name = fmt.Sprintf("Detector %s x %d", d.Interval, d.LookBackFrames)
|
||||
name += fmt.Sprintf(" x %d", d.LookBackFrames)
|
||||
}
|
||||
|
||||
if NotZero(d.MaxPriceChange) {
|
||||
|
@ -45,7 +53,23 @@ func (d *KLineDetector) SlackAttachment() slack.Attachment {
|
|||
name += fmt.Sprintf(" MaxPriceChange %.2f ~ NO LIMIT", d.MinPriceChange)
|
||||
}
|
||||
|
||||
var fields []slack.AttachmentField
|
||||
var fields = []slack.AttachmentField{
|
||||
{
|
||||
Title: "Interval",
|
||||
Value: d.Interval,
|
||||
Short: true,
|
||||
},
|
||||
{
|
||||
Title: "MinMaxPriceChange",
|
||||
Value: formatFloat(d.MinPriceChange, 2),
|
||||
Short: true,
|
||||
},
|
||||
{
|
||||
Title: "MaxMaxPriceChange",
|
||||
Value: formatFloat(d.MaxPriceChange, 2),
|
||||
Short: true,
|
||||
},
|
||||
}
|
||||
|
||||
if d.EnableMinThickness {
|
||||
fields = append(fields, slack.AttachmentField{
|
||||
|
|
Loading…
Reference in New Issue
Block a user