Skip to content

Instantly share code, notes, and snippets.

@z3t0
Created May 11, 2018 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z3t0/1e3870f88e246276f0e5ae3f417dcd08 to your computer and use it in GitHub Desktop.
Save z3t0/1e3870f88e246276f0e5ae3f417dcd08 to your computer and use it in GitHub Desktop.
def create_linear_stock(value=None):
if not value:
value = random.randint(1, 100)
stock = dict(locals())
stock['symbol'] = uuid4()
stock['slope'] = random.uniform(-1, 1)
# def tick(self): # I was trying this
def tick():
stock['value'] += stock['slope']
stock['tick'] = tick
return stock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment