Add total_bids_value_multiplier to automation strategies.

order value is the max value of a bid that can be accepted.
order value * total_bids_value_multiplier is the max sum of all bids that can be accepted.
This commit is contained in:
tecnovert
2023-02-17 22:51:49 +02:00
parent c13606ab54
commit c322c9ae0c
2 changed files with 20 additions and 2 deletions

View File

@@ -4247,8 +4247,10 @@ class BasicSwap(BaseApp):
active_bids, total_bids_value = self.getCompletedAndActiveBidsValue(offer, use_session)
if total_bids_value + bid.amount > offer.amount_from:
raise AutomationConstraint('Over remaining offer value {}'.format(offer.amount_from - total_bids_value))
total_bids_value_multiplier = opts.get('total_bids_value_multiplier', 1.0)
if total_bids_value_multiplier > 0.0:
if total_bids_value + bid.amount > offer.amount_from * total_bids_value_multiplier:
raise AutomationConstraint('Over remaining offer value {}'.format(offer.amount_from * total_bids_value_multiplie - total_bids_value))
num_not_completed = 0
for active_bid in active_bids: