mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
atrpin: add minPriceRange config
This commit is contained in:
parent
e52e53aa42
commit
d4330a7a32
|
@ -1,6 +1,6 @@
|
|||
sessions:
|
||||
max:
|
||||
exchange: max
|
||||
exchange: &exchange max
|
||||
envVarPrefix: max
|
||||
|
||||
persistence:
|
||||
|
@ -12,13 +12,14 @@ persistence:
|
|||
db: 0
|
||||
|
||||
exchangeStrategies:
|
||||
- on: max
|
||||
- on: *exchange
|
||||
atrpin:
|
||||
symbol: BTCUSDT
|
||||
interval: 5m
|
||||
window: 14
|
||||
multiplier: 100.0
|
||||
amount: 1000
|
||||
minPriceRange: 20%
|
||||
amount: 100
|
||||
|
||||
backtest:
|
||||
startTime: "2018-10-01"
|
||||
|
@ -26,7 +27,7 @@ backtest:
|
|||
symbols:
|
||||
- BTCUSDT
|
||||
sessions:
|
||||
- max
|
||||
- *exchange
|
||||
# syncSecKLines: true
|
||||
accounts:
|
||||
max:
|
||||
|
|
|
@ -27,9 +27,10 @@ type Strategy struct {
|
|||
|
||||
Symbol string `json:"symbol"`
|
||||
|
||||
Interval types.Interval `json:"interval"`
|
||||
Window int `json:"window"`
|
||||
Multiplier float64 `json:"multiplier"`
|
||||
Interval types.Interval `json:"interval"`
|
||||
Window int `json:"window"`
|
||||
Multiplier float64 `json:"multiplier"`
|
||||
MinPriceRange fixedpoint.Value `json:"minPriceRange"`
|
||||
|
||||
bbgo.QuantityOrAmount
|
||||
// bbgo.OpenPositionOptions
|
||||
|
@ -92,7 +93,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
|
||||
// if the atr is too small, apply the price range protection with 10%
|
||||
// priceRange protection 10%
|
||||
priceRange = fixedpoint.Max(priceRange, k.Close.Mul(fixedpoint.NewFromFloat(0.1)))
|
||||
priceRange = fixedpoint.Max(priceRange, k.Close.Mul(s.MinPriceRange))
|
||||
log.Infof("priceRange: %f", priceRange.Float64())
|
||||
|
||||
ticker, err := session.Exchange.QueryTicker(ctx, s.Symbol)
|
||||
|
|
Loading…
Reference in New Issue
Block a user