Skip to main content

manifoldpy

CircleCI Documentation Status PyPI version codecov

Tools for analyzing Manifold Markets data. Currently has bindings for their API, and code for computing various accuracy metrics (Brier score, log score, calibration).

Full Documentation.

Calibration

This is the most recent calibration graph for Manifold Markets. Markets with less than 4 unique traders are excluded. The calibration is generated from the probability halfway between market open and market close.

Midmarket calibration

Installation

The package is on PyPI as manifoldpy. It can be installed with:

pip install manifoldpy

However, you may want to install the most up-to-date version from github instead if you encounter any issues:

pip install --upgrade https://github.com/vluzko/manifoldpy/tarball/main

Basic Usage

Get a list containing every market:

from manifoldpy import api
markets = api.get_all_markets()

Manifold also has a POST API that lets you make/resolve/bet on markets. This requires you to have an API key (which you can generate on your Manifold profile page). Here's an example for making a bet on a binary market:

from manifoldpy import api
# Amount to spend
amount = 100
# The ID of the market to bet on
contract_id = "8Lt9ZTHCPCK58gtn0Y8n"
# The outcome you want to bet on.
outcome = "YES"
api.make_bet(YOUR_API_KEY, amount, contract_id, outcome)

If you want to avoid passing the key every time, you can instead create an APIWrapper and use that:

from manifoldpy import api
wrapper = api.APIWrapper(YOUR_API_KEY)
amount = 100
contract_id = "8Lt9ZTHCPCK58gtn0Y8n"
outcome = "YES"
wrapper.make_bet(amount, contract_id, outcome)

Get a market's history of probabilities:

from manifoldpy import api
market = api.get_market("market_id")
times, probabilities = market.probability_history()

Generate a basic calibration graph:

from manifoldpy import api, calibration
full_markets = api.get_full_markets()
binary = [
    m for m in full_markets if isinstance(m, api.BinaryMarket) and m.isResolved
]
df, histories = calibration.build_dataframe(binary)

yes_markets = df[df["resolution"] == "YES"]
no_markets = df[df["resolution"] == "NO"]

# Calibration at start
yes_probs = yes_markets["start"]
no_probs = no_markets["start"]
calibration = calibration.market_set_accuracy(yes_probs, no_probs)

There are additional examples for analyzing market calibration in the scripts/ directory.

Metadata

Release files for manifoldpy 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for manifoldpy 1.1.2
File Size Uploaded
manifoldpy-1.1.2.tar.gz 17.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for manifoldpy 1.1.2
File Interpreter ABI Platform
manifoldpy-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / manifoldpy-1.1.2.tar.gz

Download URL manifoldpy-1.1.2.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1d97d1c63a8c32fe9ecc0a43d18ea3292c44d864acab6c3e9ddd766a92185f4c
BLAKE2b-256 checksum
How to use checksums
8d20fd448781cb7766e0f8b84936575c8f36fd2b2511c472f57f2dd35927d8cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0rc2

Release files / manifoldpy-1.1.2-py3-none-any.whl

Download URL manifoldpy-1.1.2-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c47e4b06cbde5c6c5653352d00fd9d5bc2033e30f7fc46d302fee442c0195588
BLAKE2b-256 checksum
How to use checksums
80735c5f2d371bc2451cea9f9721787f6a06bee6ef833b2e9752acf6faf381c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0rc2

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page