bbgo_origin/config/linregmaker.yaml

170 lines
5.9 KiB
YAML
Raw Normal View History

2022-11-21 05:46:13 +00:00
---
persistence:
redis:
host: 127.0.0.1
port: 6379
db: 0
sessions:
binance:
exchange: binance
envVarPrefix: binance
margin: true
isolatedMargin: true
isolatedMarginSymbol: BTCUSDT
backtest:
sessions: [binance]
# 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-05-01"
endTime: "2022-05-02"
2022-11-21 05:46:13 +00:00
symbols:
- BTCUSDT
accounts:
binance:
makerCommission: 10 # 0.15%
takerCommission: 15 # 0.15%
balances:
BTC: 2.0
2022-11-21 05:46:13 +00:00
USDT: 10000.0
exchangeStrategies:
- on: binance
linregmaker:
symbol: BTCUSDT
# interval is how long do you want to update your order price and quantity
interval: 1m
2022-12-13 09:37:47 +00:00
# leverage uses the account net value to calculate the allowed margin
leverage: 1
2022-12-13 09:37:47 +00:00
# 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
2022-11-21 05:46:13 +00:00
reverseEMA:
interval: 1d
window: 60
2022-11-21 05:46:13 +00:00
2022-12-13 09:37:47 +00:00
# reverseInterval is the interval to check trend reverse against ReverseEMA. Close price of this interval crossing
# the ReverseEMA triggers main trend change.
reverseInterval: 4h
2022-12-13 09:37:47 +00:00
# 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.
2022-11-21 05:46:13 +00:00
fastLinReg:
interval: 1m
window: 30
2022-11-21 05:46:13 +00:00
2022-12-13 09:37:47 +00:00
# slowLinReg is to determine the midterm trend.
# When the SlowLinReg and the ReverseEMA trend are in different directions, creation of opposite position is
# allowed.
2022-11-21 05:46:13 +00:00
slowLinReg:
interval: 1m
window: 120
2022-11-21 05:46:13 +00:00
2022-12-13 09:37:47 +00:00
# allowOppositePosition if true, the creation of opposite position is allowed when both fast and slow LinReg are in
# the opposite direction to main trend
2022-11-21 05:46:13 +00:00
allowOppositePosition: true
2022-12-13 09:37:47 +00:00
# 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
2022-11-21 05:46:13 +00:00
fasterDecreaseRatio: 2
2022-12-13 09:37:47 +00:00
# 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
2022-11-21 05:46:13 +00:00
neutralBollinger:
interval: "15m"
2022-11-21 05:46:13 +00:00
window: 21
bandWidth: 2.0
# tradeInBand: when tradeInBand is set, you will only place orders in the bollinger band.
tradeInBand: true
2022-12-13 09:37:47 +00:00
# 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
2022-11-21 05:46:13 +00:00
spread: 0.1%
2022-12-13 09:37:47 +00:00
# dynamicSpread enables the automatic adjustment to bid and ask spread.
# Overrides Spread, BidSpread, and AskSpread
2022-11-21 05:46:13 +00:00
dynamicSpread:
amplitude: # delete other scaling strategy if this is defined
# window is the window of the SMAs of spreads
window: 1
interval: "1m"
askSpreadScale:
byPercentage:
# exp means we want to use exponential scale, you can replace "exp" with "linear" for linear scale
exp:
# from down to up
domain: [ 0.0001, 0.005 ]
2022-12-13 09:37:47 +00:00
# the spread range
2022-11-21 05:46:13 +00:00
range: [ 0.001, 0.002 ]
bidSpreadScale:
byPercentage:
# exp means we want to use exponential scale, you can replace "exp" with "linear" for linear scale
exp:
# from down to up
domain: [ 0.0001, 0.005 ]
2022-12-13 09:37:47 +00:00
# the spread range
2022-11-21 05:46:13 +00:00
range: [ 0.001, 0.002 ]
2022-12-13 09:37:47 +00:00
# maxExposurePosition is the maximum position you can hold
# 10 means you can hold 10 ETH long/short position by maximum
#maxExposurePosition: 10
2022-12-13 09:37:47 +00:00
# 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:
interval: "1h"
window: 21
bandWidth: 2.0
dynamicExposurePositionScale:
byPercentage:
# exp means we want to use exponential scale, you can replace "exp" with "linear" for linear scale
exp:
# from lower band -100% (-1) to upper band 100% (+1)
domain: [ -1, 1 ]
2022-12-13 09:37:47 +00:00
# when in down band, holds 0.1 by maximum
# when in up band, holds 1 by maximum
range: [ 0.1, 1 ]
2022-11-21 05:46:13 +00:00
# quantity is the base order quantity for your buy/sell order.
quantity: 0.001
# amount: fixed amount instead of qty
#amount: 10
# useDynamicQuantityAsAmount calculates amount instead of quantity
useDynamicQuantityAsAmount: false
2022-12-13 09:37:47 +00:00
# dynamicQuantityIncrease calculates the increase position order quantity dynamically
2022-11-21 05:46:13 +00:00
dynamicQuantityIncrease:
- linRegDynamicQuantity:
quantityLinReg:
interval: 1m
window: 20
dynamicQuantityLinRegScale:
byPercentage:
linear:
domain: [ -0.0001, 0.00005 ]
range: [ 0, 0.02 ]
2022-12-13 09:37:47 +00:00
# dynamicQuantityDecrease calculates the decrease position order quantity dynamically
2022-11-21 05:46:13 +00:00
dynamicQuantityDecrease:
- linRegDynamicQuantity:
quantityLinReg:
interval: 1m
window: 20
dynamicQuantityLinRegScale:
byPercentage:
linear:
domain: [ -0.00005, 0.0001 ]
range: [ 0.02, 0 ]
exits:
# roiStopLoss is the stop loss percentage of the position ROI (currently the price change)
- roiStopLoss:
percentage: 30%