hash_function#

API documentation for tradeexecutor.utils.python_function.hash_function Python function.

hash_function(func, char_length=8, bytecode_only=False)[source]#

Produces a hash for the code in the given function.

See https://stackoverflow.com/a/49998190/315168

Hash is not guaranteed to be the same across different environments / scenarios. Read the function for more info.

Parameters:
  • char_length – How many characters you want in your hash, to reduce the hash size.

  • bytecode_only

    Don’t attempt to hash with sanitised source.

    We will also autodetect this when the source is not available.

Returns:

Part of hex hash of the function body