Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Take a position at close and square it off it at a price.

Hi

I am Quantopian newbie and am trying to implement an idea to understand the platform better.

I take a position at close (lets says 30 mins prior to close)(buy/sell), fix a price benchmark and liquidate my positions from next day onwards whenever price hits that threshold. I believe I can keep track of order at which a position was executed, use it to calculate a threshold and then liquidate my position based on that. However I am struggling to see how can something like this can be implemented in Quantopian. Any help will be appreciated. Thanks!

1 response

context.account has information like average cost

the template gives an example on how to schedule functions

use order function of type limit to set a limit order. in your case it would be the price target.

documentation covers this. search for the right key words and you'll find it.