mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xmaker: adjust credit buffer algo
This commit is contained in:
parent
1d6282a10b
commit
77b7b29739
|
@ -402,14 +402,14 @@ func (s *Strategy) updateQuote(ctx context.Context) {
|
||||||
if quote, ok := hedgeAccount.Balance(s.sourceMarket.QuoteCurrency); ok {
|
if quote, ok := hedgeAccount.Balance(s.sourceMarket.QuoteCurrency); ok {
|
||||||
netQuote := quote.Net()
|
netQuote := quote.Net()
|
||||||
if netQuote.Sign() > 0 {
|
if netQuote.Sign() > 0 {
|
||||||
hedgeQuota.BaseAsset.Add(netQuote.Mul(creditBufferRatio).Div(bestBid.Price))
|
hedgeQuota.QuoteAsset.Add(netQuote.Mul(creditBufferRatio))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if base, ok := hedgeAccount.Balance(s.sourceMarket.BaseCurrency); ok {
|
if base, ok := hedgeAccount.Balance(s.sourceMarket.BaseCurrency); ok {
|
||||||
netBase := base.Net()
|
netBase := base.Net()
|
||||||
if netBase.Sign() > 0 {
|
if netBase.Sign() > 0 {
|
||||||
hedgeQuota.QuoteAsset.Add(netBase.Mul(creditBufferRatio).Mul(bestAsk.Price))
|
hedgeQuota.BaseAsset.Add(netBase.Mul(creditBufferRatio))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// netValueInUsd, err := s.accountValueCalculator.NetValue(ctx)
|
// netValueInUsd, err := s.accountValueCalculator.NetValue(ctx)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user