Convert a Python function with decorator to Julia

Hello,

I wonder what is the more Julia-nesque approach to convert a Python function with decorator such as

@schedule(interval="5m", symbol="SYMBOL", window_size=150)
def run_5m(state, data):
    print("I'm running once every five minutes")

Kind regards

1 Like

I think you might want the Timer method/type, which you can read about here: Essentials · The Julia Language

If the question is less about this specific decorator and more about decorators in general, the answer is that metaprogramming with macros is the closest correspondence. However, depending on what the decorator does, there may be opportunities to implement the functionality with multiple dispatch or higher order functions, without invoking metaprogramming.