@staticmethod<EOL><INDENT>def balance_over_time(address):<DEDENT>
forged_blocks = None<EOL>txhistory = Address.transactions(address)<EOL>delegates = Delegate.delegates()<EOL>for i in delegates:<EOL><INDENT>if address == i.address:<EOL><INDENT>forged_blocks = Delegate.blocks(i.pubkey)<EOL><DEDENT><DEDENT>balance_over_time = []<EOL>balance = <NUM_LIT:0><EOL>block = <NUM_LIT:0><EOL>Balance = namedtuple(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>')<EOL>for tx in txhistory:<EOL><INDENT>if forged_blocks:<EOL><INDENT>while forged_blocks[block].timestamp <= tx.timestamp:<EOL><INDENT>balance += (forged_blocks[block].reward + forged_blocks[block].totalFee)<EOL>balance_over_time.append(Balance(timestamp=forged_blocks[block].timestamp, amount=balance))<EOL>block += <NUM_LIT:1><EOL><DEDENT><DEDENT>if tx.senderId == address:<EOL><INDENT>balance -= (tx.amount + tx.fee)<EOL>res = Balance(timestamp=tx.timestamp, amount=balance)<EOL>balance_over_time.append(res)<EOL><DEDENT>if tx.recipientId == address:<EOL><INDENT>balance += tx.amount<EOL>res = Balance(timestamp=tx.timestamp, amount=balance)<EOL>balance_over_time.append(res)<EOL><DEDENT><DEDENT>if forged_blocks and block <= len(forged_blocks) - <NUM_LIT:1>:<EOL><INDENT>if forged_blocks[block].timestamp > txhistory[-<NUM_LIT:1>].timestamp:<EOL><INDENT>for i in forged_blocks[block:]:<EOL><INDENT>balance += (i.reward + i.totalFee)<EOL>res = Balance(timestamp=i.timestamp, amount=balance)<EOL>balance_over_time.append(res)<EOL><DEDENT><DEDENT><DEDENT>return balance_over_time<EOL>
returns a list of named tuples,  x.timestamp, x.amount including block rewards