def test_normal_value():
    value = Values(value=0.1, usd=2, eur=4)

    value_dict = value.to_dict()

    assert len(value_dict) == 3

    assert value_dict['value'] == 0.1
    assert value_dict['usd'] == 2
    assert value_dict['eur'] == 4
Esempio n. 2
0
 def __init__(self, estimated_value, dst_address, no_txs, dst_properties,
              labels, rates):
     self.id = dst_address
     self.node_type = 'address'
     self.labels = labels
     self.received = Values(**dst_properties.total_received._asdict())\
         .to_dict()
     self.balance = compute_balance(dst_properties.total_received.value,
                                    dst_properties.total_spent.value, rates)
     self.no_txs = no_txs
     self.estimated_value = Values(**estimated_value._asdict()).to_dict()
Esempio n. 3
0
 def __init__(self, estimated_value, no_txs, dst_properties, rates,
              dst_cluster, src_cluster, labels, from_search=False):
     self.id = dst_cluster
     self.node_type = 'entity'
     self.received = Values(**dst_properties.total_received._asdict())\
         .to_dict()
     self.balance = compute_balance(dst_properties.total_received.value,
                                    dst_properties.total_spent.value,
                                    rates)
     self.no_txs = no_txs
     self.estimated_value = Values(**estimated_value._asdict()).to_dict()
     self.labels = labels
     if from_search:
         self.dst_entity = dst_cluster
         self.src_entity = src_cluster
Esempio n. 4
0
 def __init__(self, address, first_tx, last_tx, no_incoming_txs,
              no_outgoing_txs, total_received, total_spent, in_degree,
              out_degree, rates):
     self.address = address
     self.first_tx = TxSummary(first_tx.height, first_tx.timestamp,
                               first_tx.tx_hash.hex()).to_dict()
     self.last_tx = TxSummary(last_tx.height, last_tx.timestamp,
                              last_tx.tx_hash.hex()).to_dict()
     self.no_incoming_txs = no_incoming_txs
     self.no_outgoing_txs = no_outgoing_txs
     self.total_received = Values(**total_received._asdict()).to_dict()
     self.total_spent = Values(**total_spent._asdict()).to_dict()
     self.in_degree = in_degree
     self.out_degree = out_degree
     self.balance = compute_balance(total_received.value, total_spent.value,
                                    rates)