@@ -498,21 +498,32 @@ func (s *Strategy) updateQuote(ctx context.Context) {
498
498
}
499
499
500
500
accumulativeBidQuantity = accumulativeBidQuantity .Add (bidQuantity )
501
+
501
502
if s .UseDepthPrice {
502
503
sideBook := sourceBook .SideBook (types .SideTypeBuy )
503
504
if s .DepthQuantity .Sign () > 0 {
504
- bidPrice = aggregatePrice (sideBook , s .DepthQuantity )
505
+ if i == 0 {
506
+ bidPrice = aggregatePrice (sideBook , s .DepthQuantity )
507
+ bidPrice = bidPrice .Mul (fixedpoint .One .Sub (quote .BidMargin ))
508
+ } else if i > 0 && quote .BidLayerPips .Sign () > 0 {
509
+ pips := quote .BidLayerPips .Mul (s .makerMarket .TickSize )
510
+ bidPrice = bidPrice .Sub (pips )
511
+ }
505
512
} else {
506
513
bidPrice = aggregatePrice (sideBook , accumulativeBidQuantity )
514
+ bidPrice = bidPrice .Mul (fixedpoint .One .Sub (quote .BidMargin ))
515
+ }
516
+ } else {
517
+ if i == 0 {
518
+ bidPrice = bidPrice .Mul (fixedpoint .One .Sub (quote .BidMargin ))
519
+ } else if i > 0 && quote .BidLayerPips .Sign () > 0 {
520
+ pips := quote .BidLayerPips .Mul (s .makerMarket .TickSize )
521
+ bidPrice = bidPrice .Sub (pips )
507
522
}
508
523
}
509
524
510
525
if i == 0 {
511
- bidPrice = bidPrice .Mul (fixedpoint .One .Sub (quote .BidMargin ))
512
526
makerBestBidPriceMetrics .With (labels ).Set (bidPrice .Float64 ())
513
- } else if i > 0 && quote .BidLayerPips .Sign () > 0 {
514
- pips := quote .BidLayerPips .Mul (s .makerMarket .TickSize )
515
- bidPrice = bidPrice .Sub (pips )
516
527
}
517
528
518
529
if makerQuota .QuoteAsset .Lock (bidQuantity .Mul (bidPrice )) && hedgeQuota .BaseAsset .Lock (bidQuantity ) {
@@ -558,18 +569,28 @@ func (s *Strategy) updateQuote(ctx context.Context) {
558
569
559
570
if s .UseDepthPrice {
560
571
if s .DepthQuantity .Sign () > 0 {
561
- askPrice = aggregatePrice (sourceBook .SideBook (types .SideTypeSell ), s .DepthQuantity )
572
+ if i == 0 {
573
+ askPrice = aggregatePrice (sourceBook .SideBook (types .SideTypeSell ), s .DepthQuantity )
574
+ askPrice = askPrice .Mul (fixedpoint .One .Add (quote .AskMargin ))
575
+ } else if i > 0 && quote .AskLayerPips .Sign () > 0 {
576
+ pips := quote .AskLayerPips .Mul (s .makerMarket .TickSize )
577
+ askPrice = askPrice .Add (pips )
578
+ }
562
579
} else {
563
580
askPrice = aggregatePrice (sourceBook .SideBook (types .SideTypeSell ), accumulativeAskQuantity )
581
+ askPrice = askPrice .Mul (fixedpoint .One .Add (quote .AskMargin ))
582
+ }
583
+ } else {
584
+ if i == 0 {
585
+ askPrice = askPrice .Mul (fixedpoint .One .Add (quote .AskMargin ))
586
+ } else if i > 0 && quote .AskLayerPips .Sign () > 0 {
587
+ pips := quote .AskLayerPips .Mul (s .makerMarket .TickSize )
588
+ askPrice = askPrice .Add (pips )
564
589
}
565
590
}
566
591
567
592
if i == 0 {
568
- askPrice = askPrice .Mul (fixedpoint .One .Add (quote .AskMargin ))
569
593
makerBestAskPriceMetrics .With (labels ).Set (askPrice .Float64 ())
570
- } else if i > 0 && quote .AskLayerPips .Sign () > 0 {
571
- pips := quote .AskLayerPips .Mul (s .makerMarket .TickSize )
572
- askPrice = askPrice .Add (pips )
573
594
}
574
595
575
596
if makerQuota .BaseAsset .Lock (askQuantity ) && hedgeQuota .QuoteAsset .Lock (askQuantity .Mul (askPrice )) {
0 commit comments