Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit a9991dc

Browse files
authored
add triggers to modification log line in sdex (#257), closes #255
1 parent 8ea336c commit a9991dc

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

plugins/sellSideStrategy.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,13 @@ func (s *sellSideStrategy) modifySellLevel(offers []hProtocol.Offer, index int,
418418
offerPrice := model.NumberFromFloat(curPrice, s.orderConstraints.PricePrecision)
419419
return offerPrice, false, nil, nil
420420
}
421+
triggers := []string{}
422+
if priceTrigger {
423+
triggers = append(triggers, "price")
424+
}
425+
if amountTrigger {
426+
triggers = append(triggers, "amount")
427+
}
421428

422429
targetPrice = *model.NumberByCappingPrecision(&targetPrice, s.orderConstraints.PricePrecision)
423430
targetAmount = *model.NumberByCappingPrecision(&targetAmount, s.orderConstraints.VolumePrecision)
@@ -445,8 +452,8 @@ func (s *sellSideStrategy) modifySellLevel(offers []hProtocol.Offer, index int,
445452
lowestPriceLogged = 1 / highestPrice
446453
highestPriceLogged = 1 / lowestPrice
447454
}
448-
log.Printf("%s | modify | old level=%d | new level = %d | targetPriceQuote=%.8f | targetAmtBase=%.8f | curPriceQuote=%.8f | lowPriceQuote=%.8f | highPriceQuote=%.8f | curAmtBase=%.8f | minAmtBase=%.8f | maxAmtBase=%.8f\n",
449-
s.action, index+1, newIndex+1, priceLogged, amountLogged, curPriceLogged, lowestPriceLogged, highestPriceLogged, curAmountLogged, minAmountLogged, maxAmountLogged)
455+
log.Printf("%s | modify | old level=%d | new level = %d | triggers=%v | targetPriceQuote=%.8f | targetAmtBase=%.8f | curPriceQuote=%.8f | lowPriceQuote=%.8f | highPriceQuote=%.8f | curAmtBase=%.8f | minAmtBase=%.8f | maxAmtBase=%.8f\n",
456+
s.action, index+1, newIndex+1, triggers, priceLogged, amountLogged, curPriceLogged, lowestPriceLogged, highestPriceLogged, curAmountLogged, minAmountLogged, maxAmountLogged)
450457
return s.sdex.ModifySellOffer(offers[index], price, amount, incrementalNativeAmountRaw)
451458
},
452459
offers[index].Selling,

0 commit comments

Comments
 (0)