added a function

This commit is contained in:
Morpheus 2023-10-08 18:39:47 -03:00
parent f46b4177e8
commit 8be88e702b
2 changed files with 19 additions and 19 deletions

View file

@ -195,9 +195,9 @@ async def update_xmr_data(yesterday, coin):
)
async with aiohttp.ClientSession(**client_args) as session:
for count in range(1, 1400):
block = str(height - count)
actions.append(asyncio.ensure_future(get_block_data(session, block)))
#for count in range(1, 1400):
# block = str(height - count)
# actions.append(asyncio.ensure_future(get_block_data(session, block)))
actions.append(asyncio.ensure_future(get_coinmarketcap_data(session, 'xmr', 'USD')))
actions.append(asyncio.ensure_future(get_coinmarketcap_data(session, 'xmr', 'BTC')))
@ -216,21 +216,21 @@ async def update_xmr_data(yesterday, coin):
for response in responses:
if response:
try:
if response['provider'] == 'localmonero':
date_aux = response['block_header']['timestamp']
if date_aux == yesterday:
try:
blocksize += int(response['block_header']['size'])
for tx in response['block_header']['txs']:
if tx['coinbase']:
revenue += int(tx['xmr_outputs'])
else:
txs += 1
fees += int(tx['tx_fee'])
revenue += int(tx['tx_fee'])
success += 1
except:
errors += 1
# if response['provider'] == 'localmonero':
# date_aux = response['block_header']['timestamp']
# if date_aux == yesterday:
# try:
# blocksize += int(response['block_header']['size'])
# for tx in response['block_header']['txs']:
# if tx['coinbase']:
# revenue += int(tx['xmr_outputs'])
# else:
# txs += 1
# fees += int(tx['tx_fee'])
# revenue += int(tx['tx_fee'])
# success += 1
# except:
# errors += 1
if response['provider'] == 'coinmarketcap':
try:

View file

@ -1344,7 +1344,7 @@ async def index(request):
if update_xmr:
count = get_history_function('xmr', yesterday, yesterday)
#await asynchronous.update_xmr_data(yesterday, coin_xmr)
await asynchronous.update_xmr_data(yesterday, coin_xmr)
if update_socials:
synchronous.check_new_social('Bitcoin')