Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Buying at the open and selling at the close

Hey all,

I'm having trouble trying to figure out how to make an algorithm that will place an order at the open of a day and then will sell at the close based on certain requirements. At the moment, every minute it repeats my logic and will buy or sell. Any ideas on how to fix this?

2 responses

For example, I'd like to buy 100 shares of a stock at the market open and then sell those shares at the end of the day based on certain criteria.

Have a look at schedule_function() on the help page.

https://www.quantopian.com/help#ide-schedulefunction