EDIT 2017-02-01: See note at the bottom.
One that applies only to those on the SEC list right now. Editing down to the point where it doesn't all make sense yet gives you the idea.
context.cent_5 = cent_5()
def balance(context, data):
c = context
cash = c.portfolio.cash
for sec in c.portfolio.positions:
if not data.can_trade(sec): continue
amt = int(c.worst[sec] * cash)
prc = cent_set(c, sec, data.current(sec, 'price'), amt)
order_target(sec, 0, style=LimitOrder(prc))
def cent_set(c, sec, prc, amt):
if sec.symbol not in c.cent_5: return prc
elif amt > 0: return .5 * round(float(prc)/.5) + .05
elif amt < 0: return .5 * round(float(prc)/.5)
else: return prc
return ['AAC', 'AAMC', 'AAME', 'AAN', 'AAOI', 'AAON', 'AAPC', 'AAV', 'AAWW', 'AB', 'ABAX', 'ABCB', 'ABCD', 'ABCO', 'ABEO', 'ABG', 'ABIL', 'ABIO', 'ABM', 'ABTL', 'ABTX', 'ABUS', 'ABY', 'AC', 'ACAT', 'ACBI', 'ACCO', 'ACET', ...
EDIT 2017-02-01: This was originally the 500 stocks on the SEC list, however I just noticed at https://www.sec.gov/oiea/investor-alerts-bulletins/ia_ticksize.html they now talk about 1400 stocks, while pointing to NYSE containing a list of over 800 stocks and NASDAQ also with a list of over 800 stocks while the list at http://tsp.finra.org/finra_org/ticksizepilot/TSPilotSecurities.txt now has 2351. And the target is likely to move again.