From e22a2caadeebf9f1ad600d678f53e7a0a5788663 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 21 Mar 2021 11:21:33 +0800 Subject: [PATCH] add basic risk control to the xmaker config --- config/xmaker-btcusdt.yaml | 29 ++++++++++++++++++++++++++--- config/xmaker-ethusdt.yaml | 32 +++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/config/xmaker-btcusdt.yaml b/config/xmaker-btcusdt.yaml index daf688ced..cda539e68 100644 --- a/config/xmaker-btcusdt.yaml +++ b/config/xmaker-btcusdt.yaml @@ -41,16 +41,39 @@ persistence: sessions: max: exchange: max - envVarPrefix: max + envVarPrefix: MAX binance: exchange: binance - envVarPrefix: binance + envVarPrefix: BINANCE + +riskControls: + # This is the session-based risk controller, which let you configure different risk controller by session. + sessionBased: + # "max" is the session name that you want to configure the risk control + max: + # orderExecutor is one of the risk control + orderExecutor: + # symbol-routed order executor + bySymbol: + BTCUSDT: + # basic risk control order executor + basic: + # keep at least X USDT (keep cash) + minQuoteBalance: 100.0 + + # maximum BTC balance (don't buy too much) + maxBaseAssetBalance: 1.0 + + # minimum BTC balance (don't sell too much) + minBaseAssetBalance: 0.01 + + maxOrderAmount: 1000.0 crossExchangeStrategies: - mobydick: - symbol: "BTCUSDT" + symbol: BTCUSDT sourceExchange: binance makerExchange: max updateInterval: 1s diff --git a/config/xmaker-ethusdt.yaml b/config/xmaker-ethusdt.yaml index fc5e4d6f2..77009855d 100644 --- a/config/xmaker-ethusdt.yaml +++ b/config/xmaker-ethusdt.yaml @@ -21,15 +21,6 @@ notifications: submitOrder: "$silent" pnL: "bbgo-pnl" -reportPnL: -- averageCostBySymbols: - - "BTCUSDT" - - "BNBUSDT" - of: binance - when: - - "@daily" - - "@hourly" - persistence: json: directory: var/data @@ -47,6 +38,29 @@ sessions: exchange: binance envVarPrefix: binance +riskControls: + # This is the session-based risk controller, which let you configure different risk controller by session. + sessionBased: + # "max" is the session name that you want to configure the risk control + max: + # orderExecutor is one of the risk control + orderExecutor: + # symbol-routed order executor + bySymbol: + ETHUSDT: + # basic risk control order executor + basic: + # keep at least X USDT (keep cash) + minQuoteBalance: 100.0 + + # maximum ETH balance (don't buy too much) + maxBaseAssetBalance: 10.0 + + # minimum ETH balance (don't sell too much) + minBaseAssetBalance: 0.0 + + maxOrderAmount: 1000.0 + crossExchangeStrategies: - mobydick: