from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, Page, WaitPage ) cu = c doc = 'The game provides an opportunity to test endowment and bargaining effects.' class Constants(BaseConstants): name_in_url = 'Endowment_bargaining_game' players_per_group = 2 num_rounds = 2 endowment = c(1000000) class Subsession(BaseSubsession): pass def deal_agreement_choices(group): choices = ['Согласен', 'Не согласен'] return choices class Group(BaseGroup): bid_amount = models.CurrencyField(label='За сколько вы готовы купить?') ask_amount = models.CurrencyField(label='За сколько вы готовы продать?') deal_agreement_choices = deal_agreement_choices class Player(BasePlayer): player_gender = models.BooleanField(choices=[[True, 'Мужской'], [False, 'Женский']], label='Ваш пол') player_age = models.IntegerField(label='Сколько вам лет?', max=100, min=0) player_experience = models.StringField(choices=[['До 1 месяца', 'До 1 месяца'], ['1-3 месяца', '1-3 месяца'], ['3-6 месяцев', '3-6 месяцев'], ['6-12 месяцев', '6-12 месяцев'], ['Более года', 'Более года']], label='Ваш опыт инвестирования', widget=widgets.RadioSelect) player_money = models.CurrencyField(label='Ваши деньги') bid_amount = models.CurrencyField(label='Цена покупки') ask_amount = models.CurrencyField(label='Цена продажи') player_difference = models.FloatField() def custom_export(players): yield ['participant_code', 'id_in_group'] for p in players: pp = p.participant yield [pp.code, p.id_in_group]