My goal is to buy 3-5 Securities a month, selling them 12 months later.
My initial hope was that the Position object contained the date of purchase, in which case it'd be easy - close out any positions > 12 months old.
It seems I would have to write (to somewhere... a database or file?) the details of the opening trade, then when rebalancing check to see if 12 months has lapsed, but this seems cumbersome and I suspect there must be a more efficient approach.
Would a built-in function handle this case? Welcome any thoughts on the best approach. No need for detailed code... more of a conceptual question.
(Am new to Q, but familiar w/ securities markets and python, and have created a value/fundamental algo which will eventually be implemented in IB.)
Thank you