Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add User-Defined Functions #8

Open
maxholloway opened this issue Jun 28, 2020 · 0 comments
Open

Add User-Defined Functions #8

maxholloway opened this issue Jun 28, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers p2 High Priority (priority 2)

Comments

@maxholloway
Copy link
Owner

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

  1. Add functions called onbegin and onend to StrategyOptions. These functions should take the standard user-defined function arguments. As of the time of writing, this would include only strat. Depending
  2. Invoke onbegin here: https://github.com/maxholloway/backtest/blob/ab8e7db4dfb67a000b3cf387d1c94297aedfd04e/src/Backtest.jl#L386
  3. Invoke onend here, replacing the current log statement: https://github.com/maxholloway/backtest/blob/ab8e7db4dfb67a000b3cf387d1c94297aedfd04e/src/Backtest.jl#L398

Status: Blocked until we implement context passing.

@maxholloway maxholloway added enhancement New feature or request good first issue Good for newcomers p2 High Priority (priority 2) labels Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers p2 High Priority (priority 2)
Projects
None yet
Development

No branches or pull requests

1 participant