|
|
@ -386,8 +386,6 @@ class Agora(object):
|
|
|
|
if not rates:
|
|
|
|
if not rates:
|
|
|
|
rates = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=self.markets.get_all_currencies())
|
|
|
|
rates = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=self.markets.get_all_currencies())
|
|
|
|
# Set the price based on the asset
|
|
|
|
# Set the price based on the asset
|
|
|
|
else:
|
|
|
|
|
|
|
|
base_currency_price = rates
|
|
|
|
|
|
|
|
for ad in ads:
|
|
|
|
for ad in ads:
|
|
|
|
if ad[4] == "XMR":
|
|
|
|
if ad[4] == "XMR":
|
|
|
|
coin = "monero"
|
|
|
|
coin = "monero"
|
|
|
@ -396,7 +394,7 @@ class Agora(object):
|
|
|
|
currency = ad[5]
|
|
|
|
currency = ad[5]
|
|
|
|
base_currency_price = rates[coin][currency.lower()]
|
|
|
|
base_currency_price = rates[coin][currency.lower()]
|
|
|
|
price = float(ad[2])
|
|
|
|
price = float(ad[2])
|
|
|
|
rate = round(price / base_currency_price, 4)
|
|
|
|
rate = round(price / base_currency_price, 2)
|
|
|
|
ad.append(rate)
|
|
|
|
ad.append(rate)
|
|
|
|
return sorted(ads, key=lambda x: x[2])
|
|
|
|
return sorted(ads, key=lambda x: x[2])
|
|
|
|
|
|
|
|
|
|
|
@ -498,6 +496,9 @@ class Agora(object):
|
|
|
|
# self.log.info("Successfully updated ad: {id}", id=ad_id)
|
|
|
|
# self.log.info("Successfully updated ad: {id}", id=ad_id)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
if "error_code" not in rtrn["response"]["error"]:
|
|
|
|
|
|
|
|
self.log.error("Error code not in return for ad {ad_id}: {response}", ad_id=ad_id, response=rtrn["response"])
|
|
|
|
|
|
|
|
return
|
|
|
|
if rtrn["response"]["error"]["error_code"] == 429:
|
|
|
|
if rtrn["response"]["error"]["error_code"] == 429:
|
|
|
|
throttled += 1
|
|
|
|
throttled += 1
|
|
|
|
sleep_time = pow(throttled, float(settings.Agora.SleepExponent))
|
|
|
|
sleep_time = pow(throttled, float(settings.Agora.SleepExponent))
|
|
|
|