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
|
2022-12-13 09:16:30 +00:00
|
|
|
startTime: "2022-05-01"
|
2023-01-18 09:09:22 +00:00
|
|
|
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:
|
2022-11-23 09:44:40 +00:00
|
|
|
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
|
2022-12-13 09:16:30 +00:00
|
|
|
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
|
2022-12-13 03:06:18 +00:00
|
|
|
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.
|
2022-11-24 08:51:37 +00:00
|
|
|
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
|
2022-11-24 08:51:37 +00:00
|
|
|
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
|
2022-11-24 08:51:37 +00:00
|
|
|
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:
|
2022-11-24 08:51:37 +00:00
|
|
|
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
|
2022-11-23 09:44:40 +00:00
|
|
|
#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:
|
2022-11-22 10:24:04 +00:00
|
|
|
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.
|
2022-12-14 06:42:56 +00:00
|
|
|
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:
|
2022-11-24 08:51:37 +00:00
|
|
|
linear:
|
2022-12-14 06:42:56 +00:00
|
|
|
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:
|
2022-11-24 08:51:37 +00:00
|
|
|
linear:
|
2022-12-14 06:42:56 +00:00
|
|
|
domain: [ -0.00005, 0.0001 ]
|
|
|
|
range: [ 0.02, 0 ]
|
2022-11-23 09:44:40 +00:00
|
|
|
|
|
|
|
exits:
|
|
|
|
# roiStopLoss is the stop loss percentage of the position ROI (currently the price change)
|
|
|
|
- roiStopLoss:
|
2022-11-24 08:51:37 +00:00
|
|
|
percentage: 30%
|