asdf
All checks were successful
Deploy App to Docker / deploy (push) Successful in 29s

This commit is contained in:
2025-04-14 20:31:03 -04:00
parent 9ff87dc107
commit 3939c21a72
2 changed files with 14 additions and 12 deletions

View File

@@ -13,8 +13,8 @@ import logging
logger = logging.getLogger(__name__)
ACTIVE_PRICING_ALGORITHIM = 'default_pricing_algo' # 'default_pricing_algo' or 'tcgplayer_recommended_algo'
FREE_SHIPPING = False
ACTIVE_PRICING_ALGORITHIM = 'tcgplayer_recommended_algo' # 'default_pricing_algo' or 'tcgplayer_recommended_algo'
FREE_SHIPPING = True
class PricingService:
@@ -170,11 +170,11 @@ class PricingService:
# Original markup bands
markup_bands = {
Decimal('2.53'): (Decimal('0.01'), Decimal('0.50')),
Decimal('1.42'): (Decimal('0.51'), Decimal('1.00')),
Decimal('1.29'): (Decimal('1.01'), Decimal('3.00')),
Decimal('1.17'): (Decimal('3.01'), Decimal('20.00')),
Decimal('1.07'): (Decimal('20.01'), Decimal('35.00')),
Decimal('2.34'): (Decimal('0.01'), Decimal('0.50')),
Decimal('1.36'): (Decimal('0.51'), Decimal('1.00')),
Decimal('1.24'): (Decimal('1.01'), Decimal('3.00')),
Decimal('1.15'): (Decimal('3.01'), Decimal('20.00')),
Decimal('1.06'): (Decimal('20.01'), Decimal('35.00')),
Decimal('1.05'): (Decimal('35.01'), Decimal('50.00')),
Decimal('1.03'): (Decimal('50.01'), Decimal('100.00')),
Decimal('1.02'): (Decimal('100.01'), Decimal('200.00')),
@@ -192,10 +192,12 @@ class PricingService:
markup_bands = adjusted_bands
if FREE_SHIPPING:
if tcg_low_shipping:
if tcg_low_shipping and (tcg_low >= Decimal('5.00')):
tcg_compare_price = tcg_low_shipping
elif tcg_low_shipping and (tcg_low < Decimal('5.00')):
tcg_compare_price = max(tcg_low_shipping - Decimal('1.31'), tcg_low)
elif tcg_low:
tcg_compare_price = tcg_low + Decimal('1.31')
tcg_compare_price = tcg_low
else:
logger.warning(f"No TCG low or shipping price available for row: {row}")
row['new_price'] = None
@@ -211,11 +213,11 @@ class PricingService:
new_price = self.smooth_markup(tcg_compare_price, markup_bands)
# Enforce minimum price
if new_price < Decimal('0.25'):
if new_price < Decimal('0.35'):
new_price = Decimal('0.25')
# Avoid huge price drops
if current_price is not None and Decimal(str(((current_price - new_price) / current_price))) > Decimal('0.25'):
if current_price is not None and Decimal(str(((current_price - new_price) / current_price))) > Decimal('0.5'):
logger.warning(f"Price drop too large for row: {row}")
new_price = current_price