Skip to main content

This project is a python implementation of the market mechanism described in the paper 'Shapley value based pricing for auctions and exchanges' (Lindsay 2018).

Project description

Market Design

This project is a python implementation of the market mechanism described in the paper "Shapley value based pricing for auctions and exchanges" (Lindsay 2018). The project uses a bidding language that extends the version in the paper to allow bidders to express their preferences more concisely.

Installing on Windows

Install git and Python 3.x if not already installed.

# Get a copy of the project. 
git clone https://github.com/luke777/marketdesign.git
# Set up and activate the virtual environment 
cd marketdesign
py -m venv env
env\Scripts\activate
py -m pip install -r requirements.txt
# Verify that the command-line solver runs
py solver.py examples\Lindsay2018_t1_seller_and_2_buyers.txt

If Windows PowerShell gives the error message "running scripts is disabled on this system", try executing the following Set-ExecutionPolicy Unrestricted -Scope Process

On Linux/macOS try using python3 instead of py to run python and source env/bin/activate instead of .\env\Scripts\activate to activate the virtual environment.

Command-line solver

The program solver.py reads in bids from a file and outputs the winning bids and payments. If the python virtual environment is not already activated, activate is as follows.
env\Scripts\activate
The solver can then be run.
py solver.py examples\Lindsay2018_t1_seller_and_2_buyers.txt

Three file formats are supported. The directory examples contains examples of each of the formats. The cases are taken from Lindsay 2018.

  • Text This format is the most concise. Bids are specified in a text file with one line per bidder.

  • CSV This format is convenient if bids are prepared in a spreadsheet.

  • JSON This format is relatively more verbose but allows bids to be easily prepared and analyzed using most programming languages.

By default, the results of solving the market are shown onscreen. The output can be directed to a file as follows.
py solver.py examples\Lindsay2018_t2.1_two_demand_types.csv -o output.json
The format of the output is determined by the filename extension. As with inputs, the supported formats are text (.txt), csv, and json.

Web solver

The program web-solver.py starts a micro web service that allows the market solver to be accessed online.

If the python virtual environment is not already activated, activate it with env\Scripts\activate
Then start the service with
py web-solver.py

Opening http://localhost:5000 in a browser should display links to the following.

  • A form for submitting bids in text format.
  • A form for uploading a file with bids in cvs format.
  • A form for submitting bids in json format.
  • An example of a graphical interface that lets users experiment with different bids. The bids are captured using javascript and sent to the server in json format.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marketdesign-0.0.1a1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marketdesign-0.0.1a1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file marketdesign-0.0.1a1.tar.gz.

File metadata

  • Download URL: marketdesign-0.0.1a1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for marketdesign-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 d935f1c61dbb041c0e0d3cb451f7ac64b39291e7f5929e0e255baa181554f52b
MD5 8ea65588b75d94e128e063c973afc34a
BLAKE2b-256 9e36fca9dabfe742cdb140d314c3e68750b9db6d05430ea0f38ab3010a15a5cc

See more details on using hashes here.

File details

Details for the file marketdesign-0.0.1a1-py3-none-any.whl.

File metadata

  • Download URL: marketdesign-0.0.1a1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for marketdesign-0.0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c3571145797f91ecca706365e1b4cf6e7f89272b07401a3753185fbe8853c62
MD5 c13f6ca60bc4a00791b8ffe4481656ae
BLAKE2b-256 da06c98345fe0e443daf3c874d9d763d5e6d97840a0560c7af31fe3530b2b174

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page