mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
xmaker: add MaxQuoteUsageRatio option
This commit is contained in:
parent
5b23671b44
commit
2f261dd0a5
|
@ -179,6 +179,8 @@ type Strategy struct {
|
||||||
|
|
||||||
RecoverTradeScanPeriod types.Duration `json:"recoverTradeScanPeriod"`
|
RecoverTradeScanPeriod types.Duration `json:"recoverTradeScanPeriod"`
|
||||||
|
|
||||||
|
MaxQuoteUsageRatio fixedpoint.Value `json:"maxQuoteUsageRatio"`
|
||||||
|
|
||||||
NumLayers int `json:"numLayers"`
|
NumLayers int `json:"numLayers"`
|
||||||
|
|
||||||
// Pips is the pips of the layer prices
|
// Pips is the pips of the layer prices
|
||||||
|
@ -696,7 +698,14 @@ func (s *Strategy) updateQuote(ctx context.Context) error {
|
||||||
|
|
||||||
if b, ok := makerBalances[s.makerMarket.QuoteCurrency]; ok {
|
if b, ok := makerBalances[s.makerMarket.QuoteCurrency]; ok {
|
||||||
if b.Available.Compare(s.makerMarket.MinNotional) > 0 {
|
if b.Available.Compare(s.makerMarket.MinNotional) > 0 {
|
||||||
makerQuota.QuoteAsset.Add(b.Available)
|
if s.MaxQuoteUsageRatio.Sign() > 0 {
|
||||||
|
quoteAvailable := b.Available.Mul(s.MaxQuoteUsageRatio)
|
||||||
|
makerQuota.QuoteAsset.Add(quoteAvailable)
|
||||||
|
} else {
|
||||||
|
// use all quote balances as much as possible
|
||||||
|
makerQuota.QuoteAsset.Add(b.Available)
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
disableMakerBid = true
|
disableMakerBid = true
|
||||||
s.logger.Infof("%s maker bid disabled: insufficient quote balance %s", s.Symbol, b.String())
|
s.logger.Infof("%s maker bid disabled: insufficient quote balance %s", s.Symbol, b.String())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user