Do you have any feature for scheduling? Which would be similar to Quantopian schedule_function?

Scheduling function features in IBridgePy give you full control over when your algorithm trading strategies execute. Unlike platforms limited to US equities, IBridgePy supports custom scheduling for any security or commodity with different trading hours across global markets.

Scheduling function for algorithmic trading automation

No. The main products that quantopian trades are US equities and they have clear market open and close time. Therefore, quantopian provides schedule_function either before market opens or after market closes. In IBridgePy, you can trade any securities or commodities that IB supports and they may have totally different trading hours. The solution is to make your own schedule_functions.

EXCLUSIVE OFFER

Extra 7% OFF All Quantra Courses

Level up your quant trading skills with courses from Quantra by QuantInsti — Python for trading, machine learning strategies, options trading, and more.

HUI7 Browse Courses → Use code HUI7 at checkout

Custom Scheduling Trading Functions Example

Please see the follow example. Something is scheduled before market opens and something else is scheduled after market closes.

def handle_data(context, data):
    sTime=get_datetime() 
    # sTime is the IB server time. 
    if sTime.weekday()<=4:  # Only trade from Mondays to Fridays
        if sTime.hour==9 and sTime.minute==29 and context.machineState=='sleep':
            # schedule actions before market opens at 9:29AM EST
            do_something()
            context.machineState='idle'
        
        if sTime.hour==15 and sTime.minute==59 and context.machineState=='idle':
            # do thing during trading hours
            do_something_else()
            context.machineState='afterTrade'

        if sTime.hour==16 and sTime.minute==10 and context.machineState=='afterTrade':
            display_results()
            context.machineState='sleep'

Learn more from Interactive Brokers platform documentation.

Need help building this strategy?

Our Rent-a-Coder team builds custom automated trading programs. From simple scripts to complex multi-account strategies — we handle it all.

EXCLUSIVE OFFER

Extra 7% OFF All Quantra Courses

Level up your quant trading skills with courses from Quantra by QuantInsti — Python for trading, machine learning strategies, options trading, and more.

HUI7 Browse Courses → Use code HUI7 at checkout

Ready to Automate Your Trading?

Download IBridgePy free or let our coders build your strategy.

Download Free Hire a Coder