Exemplo n.º 1
0
def index():
    # price курс BTC_ETH
    ticker = polo.api('returnTicker')
    allprice = (ticker['BTC_ETH'])
    price1 = allprice['last']
    price = price1[0:6]
    # priceUSD курс USDT_ETH
    ticker2 = polo.api('returnTicker')
    allprice2 = (ticker2['USDT_ETH'])
    price2 = allprice2['last']
    priceUSD = price2[0:5]
    accounts = {}
    totshare = 0
    reward = BLOCK_REWARD - FEE
    c = EthJsonRpc('localhost', 8545)
    posts = c.eth_accounts()
    conn = sqlite3.connect(DBSHARE_FILE)
    db = conn.cursor()
    for row in db.execute('SELECT miner, sum(diff) FROM share GROUP BY miner'):
        accounts[row[0]] = row[1]
        totshare += row[1]
    for acc in accounts:
        racc = accounts[acc] * reward / float(totshare)
    conn.commit()
    conn.close()
    # запрос хэшрейтинга пула и количества блоков сети
    c = EthJsonRpc('localhost', 8545)
    Hashrate = c.eth_hashrate()
    Blocks = c.eth_blockNumber()
    return render_template('index.html',
                           price=price,
                           priceUSD=priceUSD,
                           Blocks=Blocks,
                           accounts=accounts,
                           Hashrate=Hashrate,
                           totshare=totshare,
                           cround=cround,
                           server=SERVER_POOL)
Exemplo n.º 2
0
def index():
	# price курс BTC_ETH

	# priceUSD курс USDT_ETH

	accounts = {}
	totshare = 0
	reward = BLOCK_REWARD - FEE
	c = EthJsonRpc('172.16.0.7', 8545)
	posts = c.eth_accounts()
	conn = sqlite3.connect(DBSHARE_FILE)
	db = conn.cursor()
	for row in db.execute('SELECT miner, sum(diff) FROM share GROUP BY miner'):
	 	accounts [row [0]] = row [1]
		totshare += row [1]
	for acc in accounts:
		racc = accounts[acc] * reward / float (totshare)
	conn.commit ()
	conn.close ()
	# запрос хэшрейтинга пула и количества блоков сети
	c = EthJsonRpc('172.16.0.7', 8545)
	Hashrate = c.eth_hashrate()
	Blocks = c.eth_blockNumber()
	return render_template('index.html', Blocks=Blocks, accounts=accounts, Hashrate=Hashrate, totshare=totshare, cround=cround, server=SERVER_POOL)