added a function
This commit is contained in:
parent
f46b4177e8
commit
8be88e702b
2 changed files with 19 additions and 19 deletions
|
@ -195,9 +195,9 @@ async def update_xmr_data(yesterday, coin):
|
||||||
)
|
)
|
||||||
|
|
||||||
async with aiohttp.ClientSession(**client_args) as session:
|
async with aiohttp.ClientSession(**client_args) as session:
|
||||||
for count in range(1, 1400):
|
#for count in range(1, 1400):
|
||||||
block = str(height - count)
|
# block = str(height - count)
|
||||||
actions.append(asyncio.ensure_future(get_block_data(session, block)))
|
# 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', 'USD')))
|
||||||
actions.append(asyncio.ensure_future(get_coinmarketcap_data(session, 'xmr', 'BTC')))
|
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:
|
for response in responses:
|
||||||
if response:
|
if response:
|
||||||
try:
|
try:
|
||||||
if response['provider'] == 'localmonero':
|
# if response['provider'] == 'localmonero':
|
||||||
date_aux = response['block_header']['timestamp']
|
# date_aux = response['block_header']['timestamp']
|
||||||
if date_aux == yesterday:
|
# if date_aux == yesterday:
|
||||||
try:
|
# try:
|
||||||
blocksize += int(response['block_header']['size'])
|
# blocksize += int(response['block_header']['size'])
|
||||||
for tx in response['block_header']['txs']:
|
# for tx in response['block_header']['txs']:
|
||||||
if tx['coinbase']:
|
# if tx['coinbase']:
|
||||||
revenue += int(tx['xmr_outputs'])
|
# revenue += int(tx['xmr_outputs'])
|
||||||
else:
|
# else:
|
||||||
txs += 1
|
# txs += 1
|
||||||
fees += int(tx['tx_fee'])
|
# fees += int(tx['tx_fee'])
|
||||||
revenue += int(tx['tx_fee'])
|
# revenue += int(tx['tx_fee'])
|
||||||
success += 1
|
# success += 1
|
||||||
except:
|
# except:
|
||||||
errors += 1
|
# errors += 1
|
||||||
|
|
||||||
if response['provider'] == 'coinmarketcap':
|
if response['provider'] == 'coinmarketcap':
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1344,7 +1344,7 @@ async def index(request):
|
||||||
|
|
||||||
if update_xmr:
|
if update_xmr:
|
||||||
count = get_history_function('xmr', yesterday, yesterday)
|
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:
|
if update_socials:
|
||||||
synchronous.check_new_social('Bitcoin')
|
synchronous.check_new_social('Bitcoin')
|
||||||
|
|
Loading…
Reference in a new issue