mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +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"`
|
||||
|
||||
MaxQuoteUsageRatio fixedpoint.Value `json:"maxQuoteUsageRatio"`
|
||||
|
||||
NumLayers int `json:"numLayers"`
|
||||
|
||||
// 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.Available.Compare(s.makerMarket.MinNotional) > 0 {
|
||||
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 {
|
||||
disableMakerBid = true
|
||||
s.logger.Infof("%s maker bid disabled: insufficient quote balance %s", s.Symbol, b.String())
|
||||
|
|
Loading…
Reference in New Issue
Block a user