"newtrader" is an oTree-based project developed for the study "Trading Gamification and Investor Behavior" by Chapkovski, Khapko, and Zoican (2023). This study investigates the effects of gamification in trading platforms on investor behavior. Read the paper
This repository, structured into three apps, includes:
trader_wrapper
: A gamified platform for single traders.pretrade
: For displaying instructions and comprehension checks before the main program.post_experimental
: Launched post-main program for demographics and financial literacy quiz.
- Python < 3.9 (Due to limitations in otree 3.4.0)
- Dependencies in
requirements.txt
.
- Clone this repository.
- Install dependencies:
pip install -r requirements.txt
.
- Run:
otree devserver
- If first-time running, remove older files (Note: The following instructions are for macOS or other Linux-like systems.):
rm -rf __temp_migrations rm -rf db.sqlite3
- The launched server will be available at localhost:8000. To change the default port, run
otree devserver 1234
, and it will then be available atlocalhost:1234
.
The experiment's configuration is mostly defined in settings.py
through SESSION_CONFIGS
and SESSION_CONFIG_DEFAULTS
.
post
: For running the post-experimental survey with a financial quiz.full
: Runs the full set of apps (pretrade
,trader_wrapper
,post_experimental
), encompassing the entire experiment.trader
: To test the trading platform (trader_wrapper
) only.
Settings with their explanations:
training_round_name
: Name of the training round.for_prolific
: Boolean to indicate if the experiment is run on Prolific.prolific_redirect_url
: URL for redirection back to Prolific after experiment completion.prediction_at
: Tick number at which predictions are made.trading_at
: Tick number when trading starts.tick_frequency
: Seconds between ticks.awards_at
: Tick numbers at which awards are given.
This section includes descriptions of various configuration files used in the project:
blocks.yaml
: Describes platform design parameters for each trading round.financial_quiz.yaml
: Contains the financial quiz.treatments.yaml
: Outlines differences in price generation and gamification between participants.prices_markov_main_*.csv
&prices_markov_robust_*.csv
: Contain pregenerated prices based on Markov or martingale models, with indices corresponding to round numbers.
In addition to the standard oTree data structure, the trader_wrapper
app in this project includes an additional model to record every client-side event during trading sessions. The data model Event
is defined as follows:
class Event(djmodels.Model):
owner = djmodels.ForeignKey(to=Player, on_delete=djmodels.CASCADE, related_name='events')
name = models.StringField()
timestamp = djmodels.DateTimeField(null=True, blank=True)
body = models.StringField()
balance = models.FloatField() # Current state of bank account
tick_number = models.IntegerField()
n_transactions = models.IntegerField()
This model captures details such as the type of event (e.g., GAME_STARTS, awardForTransaction, GAME_ENDS, buy, sell), the exact timestamp, the update counter number, the number of transactions that have occurred so far, and the current balance. Each event is linked to the specific player (owner
) who generated it.
All this data can be downloaded in CSV format via the Data -> Third-party data export -> Events export
option.
The platform's user interface is built using Vue 2.x. Compiled files are located in _static/front/js
and _static/front/css
. Gifs displayed for user awards (based on transaction numbers set in settings) are in _static/img
.
The source code for the Vue app can be found at: newgamifiedtrader repository.
Contributions are welcome. Please refer to the contribution guidelines for more details.
This project is licensed under [appropriate license], allowing use and distribution per license terms.
This project supports research by Chapkovski, Khapko, and Zoican (2023). For more information, refer to the paper.