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