from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random from .machine_learning_algo import prediction_generator doc = """ A market game experiment to study learning based on machine learning. Essential market mechanism based on Kuhnen (2015) """ class Constants(BaseConstants): name_in_url = 'machine_teaching_questionnaire_without_ml' players_per_group = None num_rounds = 1 fixed_payoff = 3 high_payoff = 5 low_payoff = 1 instructions_template = 'Finance_experiment_questionnaire_without_ML/instructions_.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass #################### # QUESTIONNAIRE #################### class Player(BasePlayer): #################### # QUESTIONNAIRE #################### ##### GENERAL q_age = models.IntegerField(label='How old are you?') q_female = models.IntegerField(label='Please indicate your gender.', choices=[ [0, 'Male'], [1, 'Female'], [-1, 'Other'], ], widget=widgets.RadioSelect ) q_work = models.IntegerField(label='How many years of working experience do you have?') q_news = models.IntegerField(label='How many newspaper subscriptions do you have?', choices=[ [0, 'None'], [1, '1-2'], [2, '3-5'], [3, 'More than 5'], ], widget=widgets.RadioSelect ) q_degree = models.IntegerField(label='Please indicate your highest degree.', choices=[ [0, 'No graduation'], [1, 'Secondary school'], [2, 'High school'], [3, 'Bachelor'], [4, 'Master'], [5, 'Ph.D.'], ], widget=widgets.RadioSelect ) ##### RISK AVERSION q_risk_aversion_1 = models.IntegerField( label='I enjoy being daring', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_risk_aversion_2 = models.IntegerField( label='I take risks', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_risk_aversion_3 = models.IntegerField( label='I am looking for danger', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_risk_aversion_4 = models.IntegerField( label='I know how to get around the rules', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_risk_aversion_5 = models.IntegerField( label='I am ready to try everything out', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_risk_aversion_6 = models.IntegerField( label='I am looking fo adventure', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) ##### Alo aversion q_algo_aversion_1 = models.IntegerField( label='I intend to use machine learning systems for managing investments', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_algo_aversion_2 = models.IntegerField( label='Using machine learning systems for managing investments is something I would do', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_algo_aversion_3 = models.IntegerField( label='I would rather use machine learning systems rather than any human financial advisor', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) ##### Technology anxiety q_tech_anxiety_1 = models.IntegerField( label='I feel apprehensive about using technology', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_tech_anxiety_2 = models.IntegerField( label='Technical terms sound like confusing jargon to me', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_tech_anxiety_3 = models.IntegerField( label='I have avoided technology because it is unfamiliar to me', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) q_tech_anxiety_4 = models.IntegerField( label='I hesitate to use most forms of technology for fear of making mistakes I cannot correct', choices=[ [1, '1 (I completely disagree)'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 (I completely agree)'], ], widget=widgets.RadioSelect ) ##### Financial knowledge q_finance_1 = models.IntegerField( label='How knowledgeable are you about investment matters?', choices=[ [1, 'Not at all knowledgeable'], [2, 'Not very knowledgeable'], [3, 'Moderately knowledgeable'], [4, 'Fairly knowledgeable'], [5, 'Very knowledgeable'], ], widget=widgets.RadioSelect ) q_finance_2 = models.IntegerField( label='If long-term interest rates were to rise, what effect do you think this would have on the value of a fund invested in fixed income securities (Bonds)?', choices=[ [1, 'Value of bonds would rise'], [2, 'Value of bonds would fall'], [3, 'Value of fund would stay the same'], [4, 'I do not know'], ], widget=widgets.RadioSelect ) q_finance_3 = models.IntegerField( label='If an investment earns a return of 7% per year, roughly how long do you think it will take for the value of that investment to double?', choices=[ [1, '5 Years'], [2, '10 Years'], [3, '15 Year'], [4, '20 Years'], [5, 'I do not know'], ], widget=widgets.RadioSelect ) ##### LOSS AVERSION q_loss_aversion_1 = models.IntegerField( label='If the coin turns up heads, then you lose 2 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) q_loss_aversion_2 = models.IntegerField( label='If the coin turns up heads, then you lose 3 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) q_loss_aversion_3 = models.IntegerField( label='If the coin turns up heads, then you lose 4 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) q_loss_aversion_4 = models.IntegerField( label='If the coin turns up heads, then you lose 5 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) q_loss_aversion_5 = models.IntegerField( label='If the coin turns up heads, then you lose 6 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) q_loss_aversion_6 = models.IntegerField( label='If the coin turns up heads, then you lose 7 Euros; if the coin turns up tails, you win 6 Euros', choices=[ [1, 'Accept'], [0, 'Reject'], ], widget=widgets.RadioSelect ) # q_risk_aversion = models.IntegerField( # label='Please tell us, in general, how willing or unwilling you are to take risks, using a scale from 1 to 7, where 1 means you are completely unwilling to take risks and 10 means you are very willing to take risks. You can also use any number between 0 and 10 to indicate where you fall on the scale, using 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10.', # choices=[ # [0, '0'], # [1, '1 (I completely disagree)'], # [2, '2'], # [3, '3'], # [4, '4'], # [5, '5'], # [6, '6'], # [7, '7 (I completely agree)'], # [8, '8'], # [9, '9'], # [10, '10'], # ], # widget=widgets.RadioSelect # ) q_cs_study = models.IntegerField(label='Do you have a background in computer science?', choices=[ [0, 'No'], [1, 'Yes'], ], widget=widgets.RadioSelect ) q_coding_skill = models.IntegerField( label='Please tell us, in general, about your programming skills, using a scale from 0 to 10, where 1 means no skills at all and 10 means expert. You can also use any number between 0 and 10 to indicate where you fall on the scale, using 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10.', choices=[ [0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7 '], [8, '8'], [9, '9'], [10, '10'], ], widget=widgets.RadioSelect ) q_subscr = models.IntegerField( label='How many different subscriptions of digital services do you have (e.g. Amazon Prime, Netflix, Spotify, Disney+,...)?') #################### # TRIALS #################### trial_1 = models.IntegerField(initial=-1, label='I invest into the', choices=[ [0, 'Bond'], [1, 'Stock'], ], widget=widgets.RadioSelect ) trial_2 = models.IntegerField(initial=-1, label='I invest into the', choices=[ [0, 'Bond'], [1, 'Stock'], ], widget=widgets.RadioSelect )