From 3939c21a72333e8d2cd47a6775bfd3d3df120d7d Mon Sep 17 00:00:00 2001 From: zman Date: Mon, 14 Apr 2025 20:31:03 -0400 Subject: [PATCH] asdf --- app/services/pricing.py | 24 +++++++++++++----------- requests.md | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/services/pricing.py b/app/services/pricing.py index 58136b4..a57e8cf 100644 --- a/app/services/pricing.py +++ b/app/services/pricing.py @@ -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 diff --git a/requests.md b/requests.md index 0c186db..e43a52a 100644 --- a/requests.md +++ b/requests.md @@ -2,7 +2,7 @@ curl -J http://192.168.1.41:8000/api/tcgplayer/inventory/update --remote-name curl -J -X POST http://192.168.1.41:8000/api/tcgplayer/inventory/add \ -H "Content-Type: application/json" \ - -d '{"open_box_ids": ["fcc28f9e-bc8b-4e89-a46e-7da746a96a5b","4a09930f-1830-4b8b-8006-a391e1adca66"]}' \ + -d '{"open_box_ids": ["f4a8e94c-5592-4b27-97b7-5cdb3eb45a71","81918f03-cbd2-4129-9f5c-eada6e1a811f","c2083c29-6fac-4621-b4b6-30c2dac75fab", "4ac89a6b-b8b7-44cf-8a4e-4a95c8e9006d", "0e809522-cef6-4c3c-b8a3-742c2e3c83fd","9e68466f-5abb-4725-9da8-91e5aaa4e805"]}' \ --remote-name curl -X POST http://192.168.1.41:8000/api/boxes \