mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
strategy/linregmaker: default value of spread
This commit is contained in:
parent
0f0549fa42
commit
41e27a8e38
|
@ -27,7 +27,7 @@ backtest:
|
||||||
makerCommission: 10 # 0.15%
|
makerCommission: 10 # 0.15%
|
||||||
takerCommission: 15 # 0.15%
|
takerCommission: 15 # 0.15%
|
||||||
balances:
|
balances:
|
||||||
BTC: 10.0
|
BTC: 2.0
|
||||||
USDT: 10000.0
|
USDT: 10000.0
|
||||||
|
|
||||||
exchangeStrategies:
|
exchangeStrategies:
|
||||||
|
@ -70,7 +70,6 @@ exchangeStrategies:
|
||||||
|
|
||||||
# spread
|
# spread
|
||||||
spread: 0.1%
|
spread: 0.1%
|
||||||
|
|
||||||
# dynamicSpread
|
# dynamicSpread
|
||||||
dynamicSpread:
|
dynamicSpread:
|
||||||
amplitude: # delete other scaling strategy if this is defined
|
amplitude: # delete other scaling strategy if this is defined
|
||||||
|
@ -96,7 +95,7 @@ exchangeStrategies:
|
||||||
# when in up band, holds 0.05 by maximum
|
# when in up band, holds 0.05 by maximum
|
||||||
range: [ 0.001, 0.002 ]
|
range: [ 0.001, 0.002 ]
|
||||||
|
|
||||||
maxExposurePosition: 10
|
#maxExposurePosition: 10
|
||||||
DynamicExposure:
|
DynamicExposure:
|
||||||
bollBandExposure:
|
bollBandExposure:
|
||||||
interval: "1h"
|
interval: "1h"
|
||||||
|
@ -142,3 +141,8 @@ exchangeStrategies:
|
||||||
# when in down band, holds 1.0 by maximum
|
# when in down band, holds 1.0 by maximum
|
||||||
# when in up band, holds 0.05 by maximum
|
# when in up band, holds 0.05 by maximum
|
||||||
range: [ 0, 0.1 ]
|
range: [ 0, 0.1 ]
|
||||||
|
|
||||||
|
exits:
|
||||||
|
# roiStopLoss is the stop loss percentage of the position ROI (currently the price change)
|
||||||
|
- roiStopLoss:
|
||||||
|
percentage: 20%
|
||||||
|
|
|
@ -89,8 +89,7 @@ type Strategy struct {
|
||||||
// For ask orders, the ask price is ((bestAsk + bestBid) / 2 * (1.0 + spread))
|
// For ask orders, the ask price is ((bestAsk + bestBid) / 2 * (1.0 + spread))
|
||||||
// For bid orders, the bid price is ((bestAsk + bestBid) / 2 * (1.0 - spread))
|
// For bid orders, the bid price is ((bestAsk + bestBid) / 2 * (1.0 - spread))
|
||||||
// Spread can be set by percentage or floating number. e.g., 0.1% or 0.001
|
// Spread can be set by percentage or floating number. e.g., 0.1% or 0.001
|
||||||
// TODO: if nil?
|
Spread fixedpoint.Value `json:"spread"`
|
||||||
Spread fixedpoint.Value `json:"spread,omitempty"`
|
|
||||||
|
|
||||||
// BidSpread overrides the spread setting, this spread will be used for the buy order
|
// BidSpread overrides the spread setting, this spread will be used for the buy order
|
||||||
BidSpread fixedpoint.Value `json:"bidSpread,omitempty"`
|
BidSpread fixedpoint.Value `json:"bidSpread,omitempty"`
|
||||||
|
@ -104,8 +103,7 @@ type Strategy struct {
|
||||||
|
|
||||||
// MaxExposurePosition is the maximum position you can hold
|
// MaxExposurePosition is the maximum position you can hold
|
||||||
// 10 means you can hold 10 ETH long/short position by maximum
|
// 10 means you can hold 10 ETH long/short position by maximum
|
||||||
// TODO: if nil?
|
MaxExposurePosition fixedpoint.Value `json:"maxExposurePosition"`
|
||||||
MaxExposurePosition fixedpoint.Value `json:"maxExposurePosition,omitempty"`
|
|
||||||
|
|
||||||
// DynamicExposure is used to define the exposure position range with the given percentage.
|
// DynamicExposure is used to define the exposure position range with the given percentage.
|
||||||
// When DynamicExposure is set, your MaxExposurePosition will be calculated dynamically
|
// When DynamicExposure is set, your MaxExposurePosition will be calculated dynamically
|
||||||
|
@ -429,6 +427,11 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
s.useTickerPrice = true
|
s.useTickerPrice = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default spread
|
||||||
|
if s.Spread == fixedpoint.Zero {
|
||||||
|
s.Spread = fixedpoint.NewFromFloat(0.001)
|
||||||
|
}
|
||||||
|
|
||||||
// StrategyController
|
// StrategyController
|
||||||
s.Status = types.StrategyStatusRunning
|
s.Status = types.StrategyStatusRunning
|
||||||
s.OnSuspend(func() {
|
s.OnSuspend(func() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user