bzaghalarov

Untitled

Nov 16th, 2022
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. @staticmethod
  2.     def get_cross_account_features_properties(tx, account_hash: str, from_timestamp: int,
  3.                                               to_timestamp: int) -> list:
  4.         # data is stored in relationships between Account and Transaction, extract all possible dst
  5.         where_from_timestamp = "($from_timestamp <= tx.timestamp)" if from_timestamp > 0 else ""
  6.         where_to_timestamp = "(tx.timestamp < $to_timestamp)" if to_timestamp > 0 else ""
  7.         where_clause = Neo4jQueryService.join_non_empty_strings(" AND ", [where_from_timestamp, where_to_timestamp])
  8.         if len(where_clause) > 0:
  9.             where_clause = "WHERE " + where_clause
  10.  
  11.         transaction_features = tx.run(
  12.             "MATCH (src:Account {hash:$src_account_hash}) -[link1:FEATURES]-> (tx:Transaction)"
  13.             + where_clause +
  14.             "RETURN PROPERTIES(link1) as link, tx.hash as tx_hash ORDER BY tx.timestamp",
  15.             src_account_hash=account_hash,
  16.             from_timestamp=from_timestamp,
  17.             to_timestamp=to_timestamp
  18.         )
  19.         print("get_cross_account_features_properties >> transaction_features", list(transaction_features))
  20.         return list(transaction_features)
Advertisement
Add Comment
Please, Sign In to add comment