from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random class Constants(BaseConstants): name_in_url = 'double_auction_intro' players_per_group = None num_rounds = 1 instructions_template = 'double_auction_intro/Instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Q1_1 = models.IntegerField(label="") Q1_2 = models.FloatField(label="") Q2 = models.IntegerField(label="",choices=[ [1, "No transaction is possible."], [2, "The transaction takes place and you sell to that buyer 2 packages at 10 units of currency A."], [3, "The transaction takes place and you sell to that buyer 2 packages at 18 units of currency A."], [4, "The transaction takes place and you sell to that buyer 3 packages at 10 units of currency A."], [5, "The transaction takes place and you sell to that buyer 3 packages at 18 units of currency A."], [6, "We do not have enough information to say whether a transaction can take place."] ]) Q3 = models.IntegerField(label="",blank=True,choices=[ [1, '500 units of currency A and 1350 units of currency B.'], [2, '1250 units of currency A and 100 units of currency B.'], [3, '500 units of currency A and 350 units of currency B.'], [4, '500 units of currency A and 600 units of currency B.'] ]) def Currency_symbol(self): if self.session.config['experiment_country'].upper() == 'CAD': #return dollar sign return '$' elif self.session.config['experiment_country'].upper() == 'EUR': #return euro sign return '€' def Currency_name(self): if self.session.config['experiment_country'].upper() == 'CAD': # return dollar sign return 'Canadian dollar' elif self.session.config['experiment_country'].upper() == 'EUR': # return euro sign return 'Euro' def Currency_exchange_on(self): if self.session.config['currency_exchange_on'] == 1: # return dollar sign return 1 elif self.session.config['currency_exchange_on'] == 0: # return euro sign return 0 def Currency_contact_info(self): if self.session.config['experiment_country'].upper() == 'CAD': # return dollar sign return 'email address' elif self.session.config['experiment_country'].upper() == 'EUR': # return euro sign return 'IBAN' def inflation_info(self): if self.session.config['inflation_on'] == 1: return "" else: return "hidden"