Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trade resolution of Quantopian and Robinhood PTD

I am curious what is the highest possible trading frequency on Quantopian?

Is it every 1 minute? If so, does that mean my code runs once every minute or just that trades go out every one minute.

For example, if I set up a while loop inside the code that keeps buying or selling based on some condition until market close, how often will this code actually make the trades? Will the while loop run once each minute or just that trades will go out after every minute?

I am new to Quantopian so still trying to figure out.

Also, I use robinhood and have DT status with margin account. Just to confirm, Quantopian won't stop me from going into PTD status, correct?

Thank you!

3 responses

Take a look at the handle_data function: https://www.quantopian.com/help#ide

It runs once per minute. Each minute, the stock data is refreshed and any orders that your code placed during the previous minute will be executed.

Also take a look at the scheduling function: https://www.quantopian.com/help#ide-schedulefunction

Thanks for that info. Any experience using WHILE loops? Is it recommended not to use those and instead use the scheduling function to run every minute?

You can't effectively use a loop to do what you want within a scheduled or handle_data function because it will time out. The platform framework limits the amount of time spent in these functions and is one way to ensure data is always current (ie can't spend more than a minute there).

Use handle_data or schedule_function.