Implement ad management
This commit is contained in:
@@ -30,7 +30,6 @@ class Money(object):
|
||||
Set the logger.
|
||||
Initialise the CoinGecko API.
|
||||
"""
|
||||
print("MONEY INIT")
|
||||
self.cr = CurrencyRates()
|
||||
self.cg = AsyncCoinGeckoAPISession()
|
||||
auth = (settings.ELASTICSEARCH_USERNAME, settings.ELASTICSEARCH_PASSWORD)
|
||||
@@ -111,7 +110,7 @@ class Money(object):
|
||||
:return: dictionary of USD/XXX rates
|
||||
:rtype: dict
|
||||
"""
|
||||
rates = await self.cr.get_rates("USD")
|
||||
rates = self.cr.get_rates("USD")
|
||||
return rates
|
||||
|
||||
async def get_acceptable_margins(self, platform, currency, amount):
|
||||
@@ -135,18 +134,11 @@ class Money(object):
|
||||
max_local = max_usd * rates[currency]
|
||||
return (min_local, max_local)
|
||||
|
||||
async def get_minmax(self, platform, asset, currency):
|
||||
sets = util.get_settings(platform)
|
||||
async def get_minmax(self, min_usd, max_usd, asset, currency):
|
||||
rates = await self.get_rates_all()
|
||||
if currency not in rates and not currency == "USD":
|
||||
self.log.error(f"Can't create ad without rates: {currency}")
|
||||
return
|
||||
if asset == "XMR":
|
||||
min_usd = float(sets.MinUSDXMR)
|
||||
max_usd = float(sets.MaxUSDXMR)
|
||||
elif asset == "BTC":
|
||||
min_usd = float(sets.MinUSDBTC)
|
||||
max_usd = float(sets.MaxUSDBTC)
|
||||
if currency == "USD":
|
||||
min_amount = min_usd
|
||||
max_amount = max_usd
|
||||
|
||||
Reference in New Issue
Block a user