Add User-Defined Functions #8
Labels
enhancement
New feature or request
good first issue
Good for newcomers
p2
High Priority (priority 2)
Add User-Defined Functions
Motivation
Users should be able to express behavior at the beginning of a backtest and at the end of a backtest. The default, of course, is that nothing special happens after a backtest starts or stops running. But what if a user wants to set some context variables before the backtest begins running? Or what if they want to make a graph after the backtest stops running, but they don't want to perform that behavior throughout the backtest?
Current Code
https://github.com/maxholloway/backtest/blob/ab8e7db4dfb67a000b3cf387d1c94297aedfd04e/src/Backtest.jl#L383-L399
Solution
onbegin
andonend
toStrategyOptions
. These functions should take the standard user-defined function arguments. As of the time of writing, this would include onlystrat
. Dependingonbegin
here: https://github.com/maxholloway/backtest/blob/ab8e7db4dfb67a000b3cf387d1c94297aedfd04e/src/Backtest.jl#L386onend
here, replacing the currentlog
statement: https://github.com/maxholloway/backtest/blob/ab8e7db4dfb67a000b3cf387d1c94297aedfd04e/src/Backtest.jl#L398Status: Blocked until we implement context passing.
The text was updated successfully, but these errors were encountered: