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

"smac" strategy not working #430

Open
avrenli2 opened this issue Apr 2, 2024 · 0 comments
Open

"smac" strategy not working #430

avrenli2 opened this issue Apr 2, 2024 · 0 comments

Comments

@avrenli2
Copy link

avrenli2 commented Apr 2, 2024

Hello,
I tried running the smac strategy's optimization tool, but it returns an error message:

from fastquant import get_stock_data, backtest
df = get_stock_data("TSLA", "2018-01-01", "2024-01-01")
opt = backtest("smac", df, fast_period=range(2,20), slow_period=range(2,30))

Error message:

ValueError                                Traceback (most recent call last)
[<ipython-input-14-f4fb58717c23>](https://localhost:8080/#) in <cell line: 1>()
----> 1 opt = ft.backtest("smac", df, fast_period=range(2,20), slow_period=range(2,30))

[/usr/local/lib/python3.10/dist-packages/fastquant/backtest/backtest.py](https://localhost:8080/#) in backtest(strategy, data, commission, init_cash, plot, fractional, slippage, single_position, verbose, sort_by, sentiments, strats, return_history, return_plot, channel, symbol, allow_short, short_max, figsize, multi_line_indicators, data_class, data_kwargs, plot_kwargs, fig, **kwargs)
    243                 print("=============================================")
    244                 print("Plotting backtest for optimal parameters ...")
--> 245             _, fig = backtest(
    246                 strategy,
    247                 data,

ValueError: too many values to unpack (expected 2)

You can also see my Google Colab notebook [here](https://colab.research.google.com/drive/16TXojnk_VNzfE8tV0D2hLorldFXHzZRr?usp=sharing)

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

No branches or pull requests

1 participant