MCPcopy Index your code
hub / github.com/kernc/backtesting.py / try_

Function try_

backtesting/_util.py:26–30  ·  view source on GitHub ↗
(lazy_func, default=None, exception=Exception)

Source from the content-addressed store, hash-verified

24
25
26def try_(lazy_func, default=None, exception=Exception):
27 try:
28 return lazy_func()
29 except exception:
30 return default
31
32
33@contextmanager

Callers 6

_plot_indicatorsFunction · 0.90
initMethod · 0.90
nextMethod · 0.90
IMethod · 0.85
__repr__Method · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by 5

initMethod · 0.72
nextMethod · 0.72
IMethod · 0.68
__repr__Method · 0.68
runMethod · 0.68