mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
grid2: add skipSpreadCheck option
This commit is contained in:
parent
c0598a05f6
commit
bc8d7e9968
|
@ -83,3 +83,6 @@ exchangeStrategies:
|
|||
resetPositionWhenStart: true
|
||||
clearOpenOrdersWhenStart: false
|
||||
keepOrdersWhenShutdown: false
|
||||
|
||||
## skipSpreadCheck skips the minimal spread check for the grid profit
|
||||
# skipSpreadCheck: true
|
||||
|
|
|
@ -128,8 +128,9 @@ func (s *GridProfitStats) SlackAttachment() slack.Attachment {
|
|||
footer += fmt.Sprintf(" since %s", s.Since.String())
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s Grid Profit Stats", s.Symbol)
|
||||
return slack.Attachment{
|
||||
Title: "Grid Profit Stats",
|
||||
Title: title,
|
||||
Color: "warning",
|
||||
Fields: fields,
|
||||
Footer: footer,
|
||||
|
|
|
@ -103,6 +103,8 @@ type Strategy struct {
|
|||
// it makes sure that your grid configuration is profitable.
|
||||
FeeRate fixedpoint.Value `json:"feeRate"`
|
||||
|
||||
SkipSpreadCheck bool `json:"skipSpreadCheck"`
|
||||
|
||||
GridProfitStats *GridProfitStats `persistence:"grid_profit_stats"`
|
||||
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
|
||||
Position *types.Position `persistence:"position"`
|
||||
|
@ -141,8 +143,10 @@ func (s *Strategy) Validate() error {
|
|||
return fmt.Errorf("gridNum can not be zero")
|
||||
}
|
||||
|
||||
if err := s.checkSpread(); err != nil {
|
||||
return errors.Wrapf(err, "spread is too small, please try to reduce your gridNum or increase the price range (upperPrice and lowerPrice)")
|
||||
if !s.SkipSpreadCheck {
|
||||
if err := s.checkSpread(); err != nil {
|
||||
return errors.Wrapf(err, "spread is too small, please try to reduce your gridNum or increase the price range (upperPrice and lowerPrice)")
|
||||
}
|
||||
}
|
||||
|
||||
if !s.QuantityOrAmount.IsSet() && s.QuoteInvestment.IsZero() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user