@cyan-gloom
Hello. The provided code is insufficient to understand the problem.
I assume that a certain function might not be returning the required value (for instance, the function where your model is being created).
I recommend that you check all return values of functions, using tools like display or print. Then, compare them with what is returned in properly working examples.
The state allows you to use data from previous iterations. You can find an example here:
https://github.com/quantiacs/toolbox/blob/2f4c42e33c7ce789dfad5d170444fd542e28c8ae/qnt/examples/004-strategy-futures-multipass-stateful.py