mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
adjust second layer price according to the pips
This commit is contained in:
parent
b86ed36aa2
commit
d2a770bc05
|
@ -266,6 +266,9 @@ func (s *Strategy) updateQuote(ctx context.Context) {
|
|||
accumulativeBidQuantity += bidQuantity
|
||||
bidPrice := aggregatePrice(sourceBook.Bids, accumulativeBidQuantity)
|
||||
bidPrice = bidPrice.MulFloat64(1.0 - s.BidMargin.Float64())
|
||||
if i > 0 && s.Pips > 0 {
|
||||
bidPrice -= fixedpoint.NewFromFloat(s.makerMarket.TickSize * float64(s.Pips))
|
||||
}
|
||||
|
||||
if makerQuota.QuoteAsset.Lock(bidQuantity.Mul(bidPrice)) && hedgeQuota.BaseAsset.Lock(bidQuantity) {
|
||||
// if we bought, then we need to sell the base from the hedge session
|
||||
|
@ -307,6 +310,9 @@ func (s *Strategy) updateQuote(ctx context.Context) {
|
|||
|
||||
askPrice := aggregatePrice(sourceBook.Asks, accumulativeBidQuantity)
|
||||
askPrice = askPrice.MulFloat64(1.0 + s.AskMargin.Float64())
|
||||
if i > 0 && s.Pips > 0 {
|
||||
askPrice += fixedpoint.NewFromFloat(s.makerMarket.TickSize * float64(s.Pips))
|
||||
}
|
||||
|
||||
if makerQuota.BaseAsset.Lock(askQuantity) && hedgeQuota.QuoteAsset.Lock(askQuantity.Mul(askPrice)) {
|
||||
// if we bought, then we need to sell the base from the hedge session
|
||||
|
|
Loading…
Reference in New Issue
Block a user