for i in range(1, num_iteration+1): _index_from = i*1000 history = target_account.get_account_history(index=_index_from,limit=1000, order=1) for operation in history: if operation['type'] =='transfer': # Check if Transaction Timestamp is in the given period of time timestamp = datetime.datetime.strptime(operation['timestamp'],"%Y-%m-%dT%H:%M:%S") if timestamp < start_date: continue elif timestamp > end_date: break
# Classify transfers into IN transfers and OUT transfers if operation['from'] == account_name: dealer = operation['to'] transfer_type = 'transfer to' amount = -1* Amount(operation['amount']).amount else: dealer = operation['from'] transfer_type = 'transfer from' amount = Amount(operation['amount']).amount # Decrypt Memo if the message is decrypted try: if operation['memo'][0] == '#': memo = s.decode_memo(operation['memo']).replace(',',' ').replace('\n',' ') else: memo = operation['memo'].replace(',',' ').replace('\n',' ') except: memo = '' # Write File if Amount(operation['amount']).asset =='STEEM': transfer_file.write('{},{},{},{},{},{},{}\n'.format(operation['timestamp'],transfer_type, dealer, amount,0,operation['trx_id'], memo)) else: transfer_file.write('{},{},{},{},{},{},{}\n'.format(operation['timestamp'],transfer_type, dealer,0, amount,operation['trx_id'], memo))