strategy/linregmaker: misc

This commit is contained in:
Andy Cheng 2022-11-22 11:35:32 +08:00
parent f121218ede
commit dd0f13e742
2 changed files with 4 additions and 9 deletions

View File

@ -18,8 +18,8 @@ backtest:
# for testing max draw down (MDD) at 03-12
# see here for more details
# https://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp
startTime: "2022-01-01"
endTime: "2022-06-30"
startTime: "2022-05-01"
endTime: "2022-10-31"
symbols:
- BTCUSDT
accounts:

View File

@ -17,11 +17,6 @@ import (
"github.com/c9s/bbgo/pkg/types"
)
// TODO:
// - TradeInBand: no buy order above the band, no sell order below the band
// - DynamicQuantity
// - Validate()
const ID = "linregmaker"
var notionModifier = fixedpoint.NewFromFloat(1.1)
@ -115,7 +110,7 @@ type Strategy struct {
DynamicExposure dynamicmetric.DynamicExposure `json:"dynamicExposure"`
bbgo.QuantityOrAmount
// TODO: Should work w/o dynamic qty
// DynamicQuantityIncrease calculates the increase position order quantity dynamically
DynamicQuantityIncrease dynamicmetric.DynamicQuantitySet `json:"dynamicQuantityIncrease"`
@ -208,6 +203,7 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
}
}
// TODO
func (s *Strategy) Validate() error {
if len(s.Symbol) == 0 {
return errors.New("symbol is required")
@ -450,7 +446,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
} else if closePrice.Compare(priceReverseEMA) < 0 {
s.mainTrendCurrent = types.DirectionDown
}
// TODO: everything should works for both direction
// Trend reversal
if s.mainTrendCurrent != s.mainTrendPrevious {