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

Examples should have tickers as CLI parameter input #76

Closed
femtotrader opened this issue Jul 2, 2016 · 0 comments · Fixed by #81
Closed

Examples should have tickers as CLI parameter input #76

femtotrader opened this issue Jul 2, 2016 · 0 comments · Fixed by #81

Comments

@femtotrader
Copy link
Contributor

For example

https://github.com/mhallsmoore/qstrader/blob/master/examples/mac_backtest.py

Instead of

def run(config, testing):
    tickers = ["SP500TR"]

we should have

def run(config, testing, tickers):
    ...

@click.command()
@click.option('--config', default=settings.DEFAULT_CONFIG_FILENAME, help='Config filename')
@click.option('--testing/--no-testing', default=False, help='Enable testing mode')
@click.option('--tickers', default='SP500TR', help='Tickers (use comma)')
def main(config, testing, tickers):
    tickers = tickers.split(",")
    config = settings.from_file(config, testing)
    run(config, testing, tickers)

if __name__ == "__main__":
    main()

So it will be possible to test a similar strategy on different tickers without changing code

test_examples.py should be changed accordingly (passing list of tickers to run)

sp500tr_buy_and_hold_backtest.py should be renamed buy_and_hold_backtest.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants