mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
drop legacy OrderProcessor and remove slack debug
This commit is contained in:
parent
468864302e
commit
b22e0370b3
|
@ -144,7 +144,6 @@ func (e *BasicRiskControlOrderExecutor) SubmitOrders(ctx context.Context, orders
|
|||
e.Notify(":memo: Submitting %s %s %s order with quantity %s @ %s", o.Symbol, o.Side, o.Type, o.QuantityString, o.PriceString, o)
|
||||
}
|
||||
|
||||
|
||||
return e.session.Exchange.SubmitOrders(ctx, formattedOrders...)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package bbgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -17,26 +13,6 @@ var (
|
|||
ErrAssetBalanceLevelTooHigh = errors.New("asset balance level too high")
|
||||
)
|
||||
|
||||
// OrderProcessor does:
|
||||
// - Check quote balance
|
||||
// - Check and control the order amount
|
||||
// - Adjust order amount due to the minAmount configuration and maxAmount configuration
|
||||
// - Canonicalize the volume precision base on the given exchange
|
||||
type OrderProcessor struct {
|
||||
// balance control
|
||||
MinQuoteBalance float64 `json:"minQuoteBalance"`
|
||||
MaxAssetBalance float64 `json:"maxBaseAssetBalance"`
|
||||
MinAssetBalance float64 `json:"minBaseAssetBalance"`
|
||||
MaxOrderAmount float64 `json:"maxOrderAmount"`
|
||||
|
||||
// MinProfitSpread is used when submitting sell orders, it check if there the selling can make the profit.
|
||||
MinProfitSpread float64 `json:"minProfitSpread"`
|
||||
|
||||
|
||||
Exchange types.Exchange `json:"-"`
|
||||
}
|
||||
|
||||
func (p *OrderProcessor) Submit(ctx context.Context, order types.SubmitOrder) error {
|
||||
/*
|
||||
tradingCtx := p.OrderExecutor.Context
|
||||
currentPrice := tradingCtx.CurrentPrice
|
||||
|
@ -125,11 +101,6 @@ func (p *OrderProcessor) Submit(ctx context.Context, order types.SubmitOrder) er
|
|||
order.QuantityString = market.FormatVolume(quantity)
|
||||
*/
|
||||
|
||||
createdOrders, err := p.Exchange.SubmitOrders(ctx, order)
|
||||
_ = createdOrders
|
||||
return err
|
||||
}
|
||||
|
||||
func adjustQuantityByMinAmount(quantity float64, currentPrice float64, minAmount float64) float64 {
|
||||
// modify quantity for the min amount
|
||||
amount := currentPrice * quantity
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/notifier/slacknotifier"
|
||||
"github.com/c9s/bbgo/pkg/slack/slacklog"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
||||
)
|
||||
|
||||
var errSlackTokenUndefined = errors.New("slack token is not defined.")
|
||||
|
@ -117,7 +116,7 @@ func runConfig(ctx context.Context, userConfig *bbgo.Config) error {
|
|||
log.AddHook(slacklog.NewLogHook(slackToken, conf.ErrorChannel))
|
||||
}
|
||||
|
||||
log.Infof("adding slack notifier...")
|
||||
log.Infof("adding slack notifier with default channel: %s", conf.DefaultChannel)
|
||||
var notifier = slacknotifier.New(slackToken, conf.DefaultChannel)
|
||||
trader.AddNotifier(notifier)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ type Notifier struct {
|
|||
type NotifyOption func(notifier *Notifier)
|
||||
|
||||
func New(token, channel string, options ...NotifyOption) *Notifier {
|
||||
var client = slack.New(token, slack.OptionDebug(true))
|
||||
// var client = slack.New(token, slack.OptionDebug(true))
|
||||
var client = slack.New(token)
|
||||
|
||||
notifier := &Notifier{
|
||||
channel: channel,
|
||||
|
|
Loading…
Reference in New Issue
Block a user