Sure. Generally checking every 15 minutes, or even every 5-10 minutes will be essentially the same unless you are making high frequency trades. I think the best way to do this is to use schedule_function, like this:
def initialize(context):
# For every minute available (max is 6 hours and 30 minutes)
total_minutes = 6*60 + 30
for i in range(total_minutes):
# Every 30 minutes run schedule
if i % 30 == 0:
# This will start at 9:31AM and will run every 30 minutes
schedule_function(
myfunc,
date_rules.every_day(),
time_rules.market_open(minutes=i),
True
)
def myfunc(context,data):
pass
def handle_data(context,data):
pass
(code is from the help doc)
Another thing I just noticed is that you are getting 100 bars of history. Do you need this, or just need the days indicated in your stochastic function? Again, I haven't looked at your code, but you may want to consider only computing a certain part every 15 minutes. If you were really concerned, you may be able to make a modification to getStoch (I think this is the function that is taking up time?) so that it could give you the difference from the previous data given data from a new bar - this way it wouldn't have to go through extra days recomputing what it has already found. Probably not worth the effort though!
Disclaimer
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.