from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = 'Huanren Zhang' doc = """ Investment task that measures risk preferences. Similar to Gneezy and Potter (1997) and Eckel and Grossman (2002,2008) """ class Constants(BaseConstants): name_in_url = 'risk' players_per_group = None num_rounds = 1 endowment = c(30) mult_factor=2.5 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): amount_invested = models.CurrencyField( doc="""Amount invested to the risky option""", min=0, max=Constants.endowment, ) success = models.BooleanField() random_draw = models.IntegerField() payoff_risk = models.CurrencyField( initial=0, doc = '''total payoff from risk''' )