A futures market for trading on the status of software bugs and issues.
This project has three prerequisites on the development system: bash, curl, and Docker (or a Docker-compatible container system). See "Getting started".
This project has two priorities: correctness and testability.
-
we use a database schema that makes it as easy as possible to express market operations as simple queries.
-
we use constraints and triggers at the database level to avoid putting the market into a hard-to-understand state even in the event of an application bug
-
we put a simple object-oriented layer on top of the database, with methods to expose what is happening
-
this all makes it possible to write test code in natural language, to make it straightforward to translate use cases and user stories into tests.
-
Database transactions are market transactions. The whole transaction should fail if there is a database inconsistency or error.
This software is an open source implementation of a market design research project described in A market for trading software issues. This work has been funded by the Alfred P. Sloan Foundation Digital Technology grant on Open Source Health and Sustainability (https://sloan.org/grant-detail/8434). Funding for open access publishing of the paper was provided by the University of Nebraska at Omaha Libraries' Open Access Fund.
All prices are expressed as the price of the fixed side. In the UI prices will be displayed in the range 0 to 1, which translates nicely into "the market believes that the probability of this bug getting fixed is P." Internally prices are stored as integers, 0 to 1000.
Internally, account balances are stored as millitokens (1000x the amount shown in the UI).
Offer and contract quantities (in the "offer" and "position" tables) are stored as numbers of units. One unit represents a payout of one token (1000 millitokens) to the winning side when the contract is resolved.
The position table uses negative numbers for UNFIXED positions, positive numbers for FIXED. There are no zero positions.
Install Docker (or a compatible container tool that provides the
docker
command) from the package
manager and start it with the service manager. Check your
distribution's instructions.
Test that you can connect with:
docker ps
If you get an error, you may need to add yourself to
the docker
group and restart Docker.
sudo groupadd docker && sudo gpasswd -a ${USER} docker && sudo systemctl restart docker
newgrp docker
Install Docker Desktop for Mac. (You do not need to make a Docker Hub account, just start Docker.)
Run the tests in a container.
./test.sh
(Docker must be running and you must be able to connect to it.)
This script will attempt to copy data from the live site, then start a local copy in a container.
./web.sh
Visit the site at: http://localhost:5000/
Your changes in the src
directory will show up in
the container, and Flask is configured to auto-reload
when you modify anything.
This script is only for development systems where you aren't using Docker for other things. Don't run this script on a production system.
./cleanup.sh
It keeps the base Debian images and images with extra system packages installed (because these images take a while to build and don't change often) and removes all the other images.
The New and Improved Flask Mega-Tutorial, by Miguel Grinberg covers all the background material you will need to know. We encourage pull requests that are still at the "work in progress" stage, and will help you get them ready to merge.
Bootstrap: Widely used web front-end component library.
PostgreSQL: Widely used RDBMS.
Python 3: Language runtime.
Python packages
-
Altair: Graphing.
-
Authlib: OAuth support.
-
psycopg2: Widely used adapter for PostgreSQL.
-
flask: Full-featured but relatively simple web development framework.
-
flask-bootstrap: Package to integrate Bootstrap with Flask templates.
-
flask-wtf: Flask support for WTForms
-
loginpass: Wrapper for OAuth, with support for GitHub.
-
WTForms: Form building and validation package with CSRF protection
Vega: front end visualizations
GitHub: Used for login.
FIXME: CDNs for Bootstrap and Vega resources?
Altair: Declarative Visualization in Python
Authlib: Python Authentication
Flask, A Python Microframework
Getting started with Docker (on Fedora Linux)