from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'investment_game' players_per_group = 2 num_rounds = 72 other_players = range(0,players_per_group,1) sample_size = 20 returns = 'https://ckurb.s3-us-west-2.amazonaws.com/returns_N2P24_0201n_0201t_00000101n.json' practice_rounds = 4 class Subsession(BaseSubsession): treatment = models.StringField() #sample = models.StringField() practice_question_answer = models.FloatField() practice_question_text = models.LongStringField() practice_question_x = models.FloatField() def creating_session(self): import random if self.round_number == 1: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A30201N2.json' self.practice_question_text = 'What is your payoff if the other participant does Not Invest?' self.practice_question_answer = -1.13 self.practice_question_x = -0.13 elif self.round_number == 2: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A30201N2.json' self.practice_question_text = 'What is your payoff if the other participant Invests?' self.practice_question_answer = -0.13 self.practice_question_x = -0.13 elif self.round_number == 3: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A30201N2.json' self.practice_question_text = 'What is the probability that the other participant faces lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value' self.practice_question_answer = 0.01 self.practice_question_x = -0.13 elif self.round_number == 4: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A30201N2.json' self.practice_question_text = "Suppose the other participant's return is 0.70; what probability does the other participant assign to you having a lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.77 self.practice_question_x = -0.13 elif self.round_number == 5: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A20201N2.json' self.practice_question_text = 'What is your payoff if the other participant invests?' self.practice_question_answer = 0.60 self.practice_question_x = 0.60 elif self.round_number == 6: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A20201N2.json' self.practice_question_text = "Suppose the other participant's return is 0.2; what probability does the other participant assign to you having a lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.23 self.practice_question_x = 0.60 elif self.round_number == 7: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A20201N2.json' self.practice_question_text = "Suppose the other participant's thinks your return is 0.4; what probability does the other participant think you assign to their having a lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.38 self.practice_question_x = 0.60 elif self.round_number == 8: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A20201N2.json' self.practice_question_text = "What is the highest probability that either participant assigns to the other participant having a lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.79 self.practice_question_x = 0.60 elif self.round_number == 9: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A200000101N2.json' self.practice_question_text = "What is the highest probability that either participant assigns to the other participant having a lower return? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.5 self.practice_question_x = 1.5 elif self.round_number == 10: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A200000101N2.json' self.practice_question_text = "What is the minimum payoff you could achieve from investing?" self.practice_question_answer = 0.5 self.practice_question_x = 1.5 elif self.round_number == 11: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A200000101N2.json' self.practice_question_text = "What is the maximum payoff you could achieve from investing?" self.practice_question_answer = 1.5 self.practice_question_x = 1.5 elif self.round_number == 12: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A200000101N2.json' self.practice_question_text = "What is the probability that the other participant's return is at least as high as yours? (decimal, not percent) Hover the mouse over each bar on the chart to see its value" self.practice_question_answer = 0.5 self.practice_question_x = 1.5 elif self.round_number <= Constants.sample_size + 3*Constants.practice_rounds: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A30201N2.json' elif self.round_number <= 2*Constants.sample_size + 3*Constants.practice_rounds: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A20201N2.json' elif self.round_number <= 3*Constants.sample_size + 3*Constants.practice_rounds: self.treatment = 'https://ckurb.s3-us-west-2.amazonaws.com/A200000101N2.json' class Group(BaseGroup): pass class Player(BasePlayer): choice = models.BooleanField(widget=widgets.RadioSelect,) practice_question = models.FloatField() def practice_question_max(self): return self.subsession.practice_question_answer + 0.01 def practice_question_min(self): return self.subsession.practice_question_answer - 0.01