-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Support for setting parameters externally #456
Conversation
Depends on #459. |
b98c744
to
4c19066
Compare
I'm +1 on making it easier to sweep a parameter space, but I think I'm -1 on this as an API. Forwarding parameters from
I'm also generally -1 on the use of |
I agree with all your points. One other easy way would be a dict you pass specifically to |
I think this isn't actually that much work to do. We mostly just need to decide what we actually want the model to be. Part of that change likely also involves killing the subclass-and-override API, which I think has proven much harder to support in a clean way than the algoscript and function-passing APIs. |
I'm a bit more pessimistic. Unless you have the resources to spearhead that effort? If not, would you be fine with the interim solution of an
Sounds like something we should discuss in a hangout if we want to start tackling that. |
Turns out we were already forwarding |
Passing a dict for backtesting parameters is an interesting solution. But you should also have a look at Bunch objects https://pypi.python.org/pypi/bunch/1.0.1 they are very convenient to access parameters in an "object" manner. |
Thanks for the pointer @femtotrader. If those can be unpacked using |
ping @ssanderson |
@twiecki sorry, I lost track of this one. I won't have bandwidth to work on an implementation of this until mid-March I think. In the shorter term I could probably spend a day or two hashing out what I think is the right design (with input from you and @ehebert, @llllllllll and others of course). I'm really hesitant to use the "we need this soon" argument as a reason to change the API in a way that we agree makes it worse, since that's trading a one-time benefit for a compounding cost. What's the timescale on which you think you need parameter optimization? |
If we truly do need to do something in the short term, I'd prefer it be something that's explicitly marked as provisional and that's easy to remove in the future. That's probably easier to do with your explicit |
@ssanderson We just had our kick-off meeting on that so very soon. Yeah, I think the |
@ssanderson Any update? I don't see us refactoring this soon and I really need this functionality. |
Hello, I'm also looking for such a feature. I wonder if passing an additional parameter to algo my_algo = TradingAlgorithm(
) Parameters could be available through It shouldn't be so hard and it shouldn't break anything. Kind regards 2015-02-12 14:31 GMT+01:00 Thomas Wiecki notifications@github.com:
|
The reason for this change is that it was impossible to use a TradingAlgorithm that passes in an initialize function in a parameter optimization. This issue is discussed in #455. It seems easy enough to just forward any left-over *args and **kwargs to the user-defined initialize function. As these are only passed when they are defined we do not break backwards compatibility with this.
@c0indev3l That's exactly what this PR would allow. It's pretty simple to do actually. I think I'll just merge this as it's critical functionality and easy to remove later when we actually do refactor this. |
@twiecki @ssanderson Any word on this? Trying to implement optimization techniques in Zipline is very ugly without this PR and it seems like a feature that quite a few people want. Having a backtester without a clean way of optimizing is a bit non-nonsensical imo. |
Agree with @warren-oneill. I'm also not convinced anymore that |
I have a much simpler idea for implementing this: Instead of changing when initialize gets called or passing through parameters from |
Makes sense but one thing that hasn't been tackled, as far as I'm aware, is a rolling optimization. Or is it possible with this setup? |
That's true that this is not addressed. It's a bit more tricky though as the algorithm state would have to saved (pickled) and different versions be run over the same time-period. |
Closing in favor of #600. We should port the example from here however. |
The reason for this change is that it was impossible to
use a TradingAlgorithm that passes in an initialize function
in a parameter optimization. This issue is discussed in #455.
It seems easy enough to just forward any left-over _args
and *_kwargs to the user-defined initialize function. As these
are only passed when they are defined we do not break backwards
compatibility with this.