bhive.snapshot module

class bhive.snapshot.AccountSnapshot(account, account_history=[], hive_instance=None)

Bases: list

This class allows to easily access Account history

Parameters
  • account_name (str) – Name of the account

  • hive_instance (Hive) – Hive instance

build(only_ops=[], exclude_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False)

Builds the account history based on all account operations

Parameters
  • only_ops (array) – Limit generator by these operations (optional)

  • exclude_ops (array) – Exclude these operations from generator (optional)

build_curation_arrays(end_date=None, sum_days=7)

Build curation arrays

build_hp_arrays()

Builds the own_hp and eff_hp array

build_rep_arrays()

Build reputation arrays

build_vp_arrays()

Build vote power arrays

get_account_history(start=None, stop=None, use_block_num=True)

Uses account history to fetch all related ops

Parameters
  • start (int, datetime) – start number/date of transactions to return (optional)

  • stop (int, datetime) – stop number/date of transactions to return (optional)

  • use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.

get_data(timestamp=None, index=0)

Returns snapshot for given timestamp

get_ops(start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[])

Returns ops in the given range

parse_op(op, only_ops=[], enable_rewards=False, enable_out_votes=False, enable_in_votes=False)

Parse account history operation

reset()

Resets the arrays not the stored account history

search(search_str, start=None, stop=None, use_block_num=True)

Returns ops in the given range

update(timestamp, own, delegated_in=None, delegated_out=None, hive=0, hbd=0)

Updates the internal state arrays

Parameters
  • timestamp (datetime) – datetime of the update

  • own (amount.Amount, float) – vests

  • delegated_in (dict) – Incoming delegation

  • delegated_out (dict) – Outgoing delegation

  • hive (amount.Amount, float) – hive

  • hbd (amount.Amount, float) – hbd

update_in_vote(timestamp, weight, op)
update_out_vote(timestamp, weight)
update_rewards(timestamp, curation_reward, author_vests, author_hive, author_hbd)