mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
strategy/linregmaker: misc
This commit is contained in:
parent
f121218ede
commit
dd0f13e742
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user