From a064e6506882055a301a483d482e3fa67b8f3c57 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 13 Feb 2022 22:18:19 +0000 Subject: [PATCH] Remove some debug output --- handler/agora.py | 6 +++--- handler/markets.py | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/handler/agora.py b/handler/agora.py index a2d2766..baa9949 100644 --- a/handler/agora.py +++ b/handler/agora.py @@ -319,7 +319,7 @@ class Agora(object): date_parsed = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%fZ") now = datetime.now() sec_ago_date = (now - date_parsed).total_seconds() - self.log.debug("Seconds ago date for {date} ^ {now}: {x}", date=date, now=str(now), x=sec_ago_date) + # self.log.debug("Seconds ago date for {date} ^ {now}: {x}", date=date, now=str(now), x=sec_ago_date) return sec_ago_date < 172800 @handle_exceptions @@ -458,7 +458,7 @@ class Agora(object): try: rates[cg_asset_name][currency.lower()] except KeyError: - self.log.error("Error getting public ads for currency {currency}", currency=currency) + # self.log.error("Error getting public ads for currency {currency}", currency=currency) continue ads_list = self.enum_public_ads(asset, currency, providers) if not ads_list: @@ -495,7 +495,7 @@ class Agora(object): if rtrn["success"]: ads[ad_index][4] = True throttled = 0 - self.log.info("Successfully updated ad: {id}", id=ad_id) + # self.log.info("Successfully updated ad: {id}", id=ad_id) continue else: if rtrn["response"]["error"]["error_code"] == 429: diff --git a/handler/markets.py b/handler/markets.py index 3140dd7..0ebbb1c 100644 --- a/handler/markets.py +++ b/handler/markets.py @@ -93,54 +93,54 @@ class Markets(object): :return: the rate we should use for this currency :rtype: float """ - self.log.debug("Autoprice starting for {x}", x=currency) + # self.log.debug("Autoprice starting for {x}", x=currency) # Find cheapest ad # Filter by 3rd index on each ad list to find the cheapest min_margin_ad = min(ads, key=lambda x: x[6]) - self.log.debug("Minimum margin ad: {x}", x=min_margin_ad) + # self.log.debug("Minimum margin ad: {x}", x=min_margin_ad) # Find second cheapest that is not us # Remove results from ads that are us ads_without_us = [ad for ad in ads if not ad[1] == settings.Agora.Username] - self.log.debug("Ads without us: {x}", x=ads_without_us) + # self.log.debug("Ads without us: {x}", x=ads_without_us) # Find ads above our min that are not us ads_above_our_min_not_us = [ad for ad in ads_without_us if ad[6] > float(settings.Agora.MinMargin)] - self.log.debug("Ads above our min not us: {x}", x=ads_above_our_min_not_us) + # self.log.debug("Ads above our min not us: {x}", x=ads_above_our_min_not_us) # Check that this list without us is not empty if ads_without_us: # Find the cheapest from these min_margin_ad_not_us = min(ads_without_us, key=lambda x: x[6]) - self.log.debug("Min margin ad not us: {x}", x=min_margin_ad_not_us) + # self.log.debug("Min margin ad not us: {x}", x=min_margin_ad_not_us) # Lowball the lowest ad that is not ours lowball_lowest_not_ours = min_margin_ad_not_us[6] # - 0.005 - self.log.debug("Lowball lowest not ours: {x}", x=lowball_lowest_not_ours) + # self.log.debug("Lowball lowest not ours: {x}", x=lowball_lowest_not_ours) # Check if the username field of the cheapest ad matches ours if min_margin_ad[1] == settings.Agora.Username: - self.log.debug("We are the cheapest for: {x}", x=currency) + # self.log.debug("We are the cheapest for: {x}", x=currency) # We are the cheapest! # Are all of the ads ours? all_ads_ours = all([ad[1] == settings.Agora.Username for ad in ads]) if all_ads_ours: - self.log.debug("All ads are ours for: {x}", x=currency) + # self.log.debug("All ads are ours for: {x}", x=currency) # Now we know it's safe to return the maximum value return float(settings.Agora.MaxMargin) else: - self.log.debug("All ads are NOT ours for: {x}", x=currency) + # self.log.debug("All ads are NOT ours for: {x}", x=currency) # All the ads are not ours, but we are first... # Check if the lowballed, lowest (that is not ours) ad's margin # is less than our minimum if lowball_lowest_not_ours < float(settings.Agora.MinMargin): - self.log.debug("Lowball lowest not ours less than MinMargin") + # self.log.debug("Lowball lowest not ours less than MinMargin") return float(settings.Agora.MinMargin) elif lowball_lowest_not_ours > float(settings.Agora.MaxMargin): - self.log.debug("Lowball lowest not ours more than MaxMargin") + # self.log.debug("Lowball lowest not ours more than MaxMargin") return float(settings.Agora.MaxMargin) else: - self.log.debug("Returning lowballed figure: {x}", x=lowball_lowest_not_ours) + # self.log.debug("Returning lowballed figure: {x}", x=lowball_lowest_not_ours) return lowball_lowest_not_ours else: - self.log.debug("We are NOT the cheapest for: {x}", x=currency) + # self.log.debug("We are NOT the cheapest for: {x}", x=currency) # We are not the cheapest :( # Check if this list is empty if not ads_above_our_min_not_us: @@ -150,7 +150,7 @@ class Markets(object): cheapest_ad = min(ads_above_our_min_not_us, key=lambda x: x[4]) cheapest_ad_margin = cheapest_ad[6] # - 0.005 if cheapest_ad_margin > float(settings.Agora.MaxMargin): - self.log.debug("Cheapest ad not ours more than MaxMargin") + # self.log.debug("Cheapest ad not ours more than MaxMargin") return float(settings.Agora.MaxMargin) - self.log.debug("Cheapest ad above our min that is not us: {x}", x=cheapest_ad) + # self.log.debug("Cheapest ad above our min that is not us: {x}", x=cheapest_ad) return cheapest_ad_margin