This is the strategy logic in *backtrader* to do it. There aren't many requirements in the original post (for example there is no exit criterion), so the assumption is that there is an unlimited supply of cash, which can be added to the broker for the new acquisitions.
Thanks for your reply and for the backtrader project. I should have written that the strategy is to own the N most oversold stocks each day. Then the exit criterion is to sell the stock when it is no longer one of those N most oversold.