from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = '' class Constants(BaseConstants): name_in_url = 'Invest' players_per_group = None num_rounds = 40 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Invest = models.IntegerField(initial=0, label='您现在打算买进多少股票', min=0) Guess = models.IntegerField(label='您认为这个股市中出现“牛市”的概率是百分之多少?(0至100中选择)', max=100, min=0) price = models.FloatField(initial=10) Cash = models.FloatField(initial=1000) sell = models.IntegerField(initial=0, label='您现在打算卖出多少股票?') Stock = models.IntegerField(initial=0) Total = models.FloatField(initial=1000) Right = models.IntegerField(initial=0) q = models.IntegerField(initial=2) def Price_history(self): return [g.price for g in self.in_previous_rounds()] def custom_export(players): yield ['participant_code', 'id_in_group'] for p in players: pp = p.participant yield [pp.code, p.id_in_group]