Not sure why I'm getting this runtime error now as I'm sure it's worked for me before. Here's the code I'm using:
import random
def initialize(context):
set_universe(universe.DollarVolumeUniverse(floor_percentile=99.0, ceiling_percentile=100.0))
context.portSize = 2
def handle_data(context, data):
selected = random.sample(data, context.portSize)
log.debug('Sample assets: {selected}'.format(selected=selected))
and when I run it I get:
Runtime exception: ValueError: sample larger than population
Doesn't seem to matter the start/end dates or daily/minutely runs.
I've got to be missing something silly.