I'd like to output some information about my algorithm when a backtest completes. I can't see anything in the API that I could use for this purpose. Is there a way to do it?
I'd like to output some information about my algorithm when a backtest completes. I can't see anything in the API that I could use for this purpose. Is there a way to do it?
@Joe, this is a very good idea, but we don't currently trigger any event other than trades. Would you mind sharing what you want to output re: the algorithm at the end of the simulation?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.
@John
One of the things I'm trying to build is a complex event processing model where some various measures of market performance become (one of several) inputs into it, so I'm less interested in seeing the overall performance than I am in calculating some strings of numbers during the backtest that I can feed into the model. Does this make sense?
I think we could provide some hooks that an algorithm can overwrite. Something like pre_simulation() and post_simulation().
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.
Would it be feasible to give Quantopian users some disk file storage space and enable Python file I/O?
It seems to me a better concept than hooks would be to add events to the simulation and have a user settable event mask. I assume at some point you want to introduce other sorts of events like market open and close, right? Assume I have an algo I want to test like, for example: when a stock closes 3 days in row greater than its open price and it closes between its 3 day moving average and 10 day moving average, then buy and hold for 15 days. The only way I can see to do that now is if I keep track of all the bookkeeping myself. If I recieved an open event and close event, that would simplify things quite a bit. And of course, you can start looking at the gaps as well.
@Grant: Yeah, maybe the option to mount some cloud storage space would be useful.
@Joe: I think that has some appeal (although it seems that this too could be accomplished with a market_open() and market_close() hook). Can you be more specific on the code you'd like to be able to write? I.e. how would you check for events.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.
Of course I realize these are really pretty similar approaches and accomplish the same thing, so it really is just a matter of preference I think, but this is what I had in mind when I read the thread:
class Asset:
def closeevent(self, data, content):
...
def openevent(self, data, content):
....
def initialize(context):
...
setmask( events i'd like to see )
context.assets = [Asset(sid(1)), Asset(sid(2), etc,]
...
def handle_data(data, context):
for asset in context.assets:
getattr(asset, data[eventname])(data, context)
Sorry about the formatting...should have put it in a code chuck but didn't realize that until after I posted.
P.S. How about being able to edit posts? At least for 10 minutes or so after they are posted?
Sorry for the late reply. Just to summarize so that I'm sure I understand you correctly. Your idea is to create an asset class for which you can define behaviors once that security opens and closes. So if that event occurs it will call the event-methods of all the assets (via the getattr call)?
How would you specify which events you'd like to see (the call to setmask)? Would that just be a list of e.g. ['openevent', 'closeevent']? Are there other events you might want to look for?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.