mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
strategy/linregmaker: update config
This commit is contained in:
parent
ff334ca13d
commit
c6f9b0feed
|
@ -38,33 +38,45 @@ exchangeStrategies:
|
||||||
# interval is how long do you want to update your order price and quantity
|
# interval is how long do you want to update your order price and quantity
|
||||||
interval: 1m
|
interval: 1m
|
||||||
|
|
||||||
|
# leverage uses the account net value to calculate the allowed margin
|
||||||
leverage: 1
|
leverage: 1
|
||||||
|
|
||||||
# reverseEMA
|
# reverseEMA is used to determine the long-term trend.
|
||||||
|
# Above the ReverseEMA is the long trend and vise versa.
|
||||||
|
# All the opposite trend position will be closed upon the trend change
|
||||||
reverseEMA:
|
reverseEMA:
|
||||||
interval: 1d
|
interval: 1d
|
||||||
window: 60
|
window: 60
|
||||||
|
|
||||||
# reverseInterval
|
# reverseInterval is the interval to check trend reverse against ReverseEMA. Close price of this interval crossing
|
||||||
|
# the ReverseEMA triggers main trend change.
|
||||||
reverseInterval: 4h
|
reverseInterval: 4h
|
||||||
|
|
||||||
# fastLinReg
|
# fastLinReg is to determine the short-term trend.
|
||||||
|
# Buy/sell orders are placed if the FastLinReg and the ReverseEMA trend are in the same direction, and only orders
|
||||||
|
# that reduce position are placed if the FastLinReg and the ReverseEMA trend are in different directions.
|
||||||
fastLinReg:
|
fastLinReg:
|
||||||
interval: 1m
|
interval: 1m
|
||||||
window: 30
|
window: 30
|
||||||
|
|
||||||
# slowLinReg
|
# slowLinReg is to determine the midterm trend.
|
||||||
|
# When the SlowLinReg and the ReverseEMA trend are in different directions, creation of opposite position is
|
||||||
|
# allowed.
|
||||||
slowLinReg:
|
slowLinReg:
|
||||||
interval: 1m
|
interval: 1m
|
||||||
window: 120
|
window: 120
|
||||||
|
|
||||||
# allowOppositePosition
|
# allowOppositePosition if true, the creation of opposite position is allowed when both fast and slow LinReg are in
|
||||||
|
# the opposite direction to main trend
|
||||||
allowOppositePosition: true
|
allowOppositePosition: true
|
||||||
|
|
||||||
# fasterDecreaseRatio
|
# fasterDecreaseRatio the quantity of decreasing position orders are multiplied by this ratio when both fast and
|
||||||
|
# slow LinReg are in the opposite direction to main trend
|
||||||
fasterDecreaseRatio: 2
|
fasterDecreaseRatio: 2
|
||||||
|
|
||||||
# neutralBollinger
|
# neutralBollinger is the smaller range of the bollinger band
|
||||||
|
# If price is in this band, it usually means the price is oscillating.
|
||||||
|
# If price goes out of this band, we tend to not place sell orders or buy orders
|
||||||
neutralBollinger:
|
neutralBollinger:
|
||||||
interval: "15m"
|
interval: "15m"
|
||||||
window: 21
|
window: 21
|
||||||
|
@ -73,9 +85,13 @@ exchangeStrategies:
|
||||||
# tradeInBand: when tradeInBand is set, you will only place orders in the bollinger band.
|
# tradeInBand: when tradeInBand is set, you will only place orders in the bollinger band.
|
||||||
tradeInBand: true
|
tradeInBand: true
|
||||||
|
|
||||||
# spread
|
# spread is the price spread from the middle price.
|
||||||
|
# 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))
|
||||||
|
# Spread can be set by percentage or floating number. e.g., 0.1% or 0.001
|
||||||
spread: 0.1%
|
spread: 0.1%
|
||||||
# dynamicSpread
|
# dynamicSpread enables the automatic adjustment to bid and ask spread.
|
||||||
|
# Overrides Spread, BidSpread, and AskSpread
|
||||||
dynamicSpread:
|
dynamicSpread:
|
||||||
amplitude: # delete other scaling strategy if this is defined
|
amplitude: # delete other scaling strategy if this is defined
|
||||||
# window is the window of the SMAs of spreads
|
# window is the window of the SMAs of spreads
|
||||||
|
@ -87,8 +103,7 @@ exchangeStrategies:
|
||||||
exp:
|
exp:
|
||||||
# from down to up
|
# from down to up
|
||||||
domain: [ 0.0001, 0.005 ]
|
domain: [ 0.0001, 0.005 ]
|
||||||
# when in down band, holds 1.0 by maximum
|
# the spread range
|
||||||
# when in up band, holds 0.05 by maximum
|
|
||||||
range: [ 0.001, 0.002 ]
|
range: [ 0.001, 0.002 ]
|
||||||
bidSpreadScale:
|
bidSpreadScale:
|
||||||
byPercentage:
|
byPercentage:
|
||||||
|
@ -96,12 +111,15 @@ exchangeStrategies:
|
||||||
exp:
|
exp:
|
||||||
# from down to up
|
# from down to up
|
||||||
domain: [ 0.0001, 0.005 ]
|
domain: [ 0.0001, 0.005 ]
|
||||||
# when in down band, holds 1.0 by maximum
|
# the spread range
|
||||||
# when in up band, holds 0.05 by maximum
|
|
||||||
range: [ 0.001, 0.002 ]
|
range: [ 0.001, 0.002 ]
|
||||||
|
|
||||||
|
# maxExposurePosition is the maximum position you can hold
|
||||||
|
# 10 means you can hold 10 ETH long/short position by maximum
|
||||||
#maxExposurePosition: 10
|
#maxExposurePosition: 10
|
||||||
DynamicExposure:
|
# dynamicExposure is used to define the exposure position range with the given percentage.
|
||||||
|
# When DynamicExposure is set, your MaxExposurePosition will be calculated dynamically
|
||||||
|
dynamicExposure:
|
||||||
bollBandExposure:
|
bollBandExposure:
|
||||||
interval: "1h"
|
interval: "1h"
|
||||||
window: 21
|
window: 21
|
||||||
|
@ -112,12 +130,13 @@ exchangeStrategies:
|
||||||
exp:
|
exp:
|
||||||
# from lower band -100% (-1) to upper band 100% (+1)
|
# from lower band -100% (-1) to upper band 100% (+1)
|
||||||
domain: [ -1, 1 ]
|
domain: [ -1, 1 ]
|
||||||
# when in down band, holds 1.0 by maximum
|
# when in down band, holds 0.1 by maximum
|
||||||
# when in up band, holds 0.05 by maximum
|
# when in up band, holds 1 by maximum
|
||||||
range: [ 0.1, 10 ]
|
range: [ 0.1, 1 ]
|
||||||
|
|
||||||
# quantity is the base order quantity for your buy/sell order.
|
# quantity is the base order quantity for your buy/sell order.
|
||||||
quantity: 0.1
|
quantity: 0.1
|
||||||
|
# dynamicQuantityIncrease calculates the increase position order quantity dynamically
|
||||||
dynamicQuantityIncrease:
|
dynamicQuantityIncrease:
|
||||||
- linRegDynamicQuantity:
|
- linRegDynamicQuantity:
|
||||||
quantityLinReg:
|
quantityLinReg:
|
||||||
|
@ -125,13 +144,10 @@ exchangeStrategies:
|
||||||
window: 20
|
window: 20
|
||||||
dynamicQuantityLinRegScale:
|
dynamicQuantityLinRegScale:
|
||||||
byPercentage:
|
byPercentage:
|
||||||
# log means we want to use log scale, you can replace "log" with "linear" for linear scale
|
|
||||||
linear:
|
linear:
|
||||||
# from lower band -100% (-1) to upper band 100% (+1)
|
|
||||||
domain: [ -0.000002, 0.000002 ]
|
domain: [ -0.000002, 0.000002 ]
|
||||||
# when in down band, holds 1.0 by maximum
|
|
||||||
# when in up band, holds 0.05 by maximum
|
|
||||||
range: [ 0, 0.001 ]
|
range: [ 0, 0.001 ]
|
||||||
|
# dynamicQuantityDecrease calculates the decrease position order quantity dynamically
|
||||||
dynamicQuantityDecrease:
|
dynamicQuantityDecrease:
|
||||||
- linRegDynamicQuantity:
|
- linRegDynamicQuantity:
|
||||||
quantityLinReg:
|
quantityLinReg:
|
||||||
|
@ -139,12 +155,8 @@ exchangeStrategies:
|
||||||
window: 20
|
window: 20
|
||||||
dynamicQuantityLinRegScale:
|
dynamicQuantityLinRegScale:
|
||||||
byPercentage:
|
byPercentage:
|
||||||
# log means we want to use log scale, you can replace "log" with "linear" for linear scale
|
|
||||||
linear:
|
linear:
|
||||||
# from lower band -100% (-1) to upper band 100% (+1)
|
|
||||||
domain: [0.000002, -0.000002 ]
|
domain: [0.000002, -0.000002 ]
|
||||||
# when in down band, holds 1.0 by maximum
|
|
||||||
# when in up band, holds 0.05 by maximum
|
|
||||||
range: [ 0, 0.001 ]
|
range: [ 0, 0.001 ]
|
||||||
|
|
||||||
exits:
|
exits:
|
||||||
|
|
|
@ -17,6 +17,8 @@ import (
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: Docs
|
||||||
|
|
||||||
const ID = "linregmaker"
|
const ID = "linregmaker"
|
||||||
|
|
||||||
var notionModifier = fixedpoint.NewFromFloat(1.1)
|
var notionModifier = fixedpoint.NewFromFloat(1.1)
|
||||||
|
@ -403,7 +405,6 @@ func (s *Strategy) getOrderQuantities(askPrice fixedpoint.Value, bidPrice fixedp
|
||||||
}
|
}
|
||||||
|
|
||||||
// getAllowedBalance returns the allowed qty of orders
|
// getAllowedBalance returns the allowed qty of orders
|
||||||
// TODO LATER: Check max qty of margin and futures
|
|
||||||
func (s *Strategy) getAllowedBalance() (baseQty, quoteQty fixedpoint.Value) {
|
func (s *Strategy) getAllowedBalance() (baseQty, quoteQty fixedpoint.Value) {
|
||||||
// Default
|
// Default
|
||||||
baseQty = fixedpoint.PosInf
|
baseQty = fixedpoint.PosInf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user