Python API client for Manifold Markets.
This is still a work in progress.
frompymanifoldimportManifoldClient# List marketsclient=ManifoldClient()
markets=client.list_markets()
# Get market by slugslug="will-bitcoins-price-fall-below-25k"market=client.get_market_by_slug("will-bitcoins-price-fall-below-25k")
# Get market by idid="rIR6mWqaO9xKLifr6cLL"market=client.get_market_by_id(id)
# Create a betbetId=client.create_bet(contractId="BxFQCoaaxBqRcnzJb1mV", amount=1, outcome="NO")
# Create a marketclient=ManifoldClient(api_key=API_KEY)
market=client.create_binary_market(
question="Testing Binary Market creation through API",
initialProb=99,
description="Going to resolves as N/A",
tags=["fun"],
closeTime=4102444800000,
)
# Find optimal Kelly betfrompymanifold.utilsimportkelly_calcmarket=client.get_market_by_slug("for-this-study-published-in-nature")
utils.kelly_calc(
market=marketsubjective_probability=0.8balance=800initial_market_probability=0.5
)- Publish a version of this package to PyPI
- Add instructions for running tests that require an API key (e.g. setting the
MANIFOLD_API_KEYenvironment variable) - Generalize
kelly_betto correlated markets
$ poetry run pytest