Skip to main content

Standalone implementation of Augur's consensus mechanism

Project description

https://travis-ci.org/AugurProject/pyconsensus.svg?branch=master https://coveralls.io/repos/AugurProject/pyconsensus/badge.png https://badge.fury.io/py/pyconsensus.svg

Python implementation of the Augur consensus mechanism, which is a modified version of Sztorc consensus (https://github.com/psztorc/Truthcoin). Mathematical details can be found in the Augur whitepaper at http://augur.link/augur.pdf.

Donations: 14sqtQRWuWqa7SCtS1iSjt1FexSxfwnw7G

Installation

The easiest way to install pyconsensus is to use pip:

$ pip install pyconsensus

Usage

To use pyconsensus, import the Oracle class:

from pyconsensus import Oracle

# Example report matrix:
#   - each row represents a reporter
#   - each column represents an event in a prediction market
my_reports = [[ 0.2,  0.7,  -1,  -1 ],
              [ 0.3,  0.5,  -1,  -1 ],
              [ 0.1,  0.7,  -1,  -1 ],
              [ 0.5,  0.7,   1,  -1 ],
              [ 0.1,  0.2,   1,   1 ],
              [ 0.1,  0.2,   1,   1 ]]
my_event_bounds = [
    {"scaled": True, "min": 0.1, "max": 0.5},
    {"scaled": True, "min": 0.2, "max": 0.7},
    {"scaled": False, "min": -1, "max": 1},
    {"scaled": False, "min": -1, "max": 1},
]

oracle = Oracle(reports=my_reports, event_bounds=my_event_bounds)
oracle.consensus()

Tests

Unit tests are in the test/ directory. Julia simulations are in the sim/ directory:

$ julia runsim.jl

Project details


Download files

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

Files for pyconsensus, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size pyconsensus-0.4.1.tar.gz (21.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page