Python SDK for the Ito Markets public API — prediction market data, baskets, and backtesting.
Project description
ito-markets — Python SDK for Ito Markets
Thin, typed Python wrapper for the Ito Markets public API. Access prediction market baskets, individual market data, historical orderbook snapshots, and run backtests — all with a single pip install.
Install
pip install ito-markets
# or with pandas support:
pip install ito-markets[pandas]
Quick Start
from ito import ItoClient
client = ItoClient("ito_...") # your API key from Settings
# List all baskets
baskets = client.baskets.list()
for b in baskets["data"]:
print(f"{b['basket_id']}: ${b['stats']['current_price']:.2f}")
# Get a single market
market = client.markets.get("will-btc-reach-100k")
print(market["data"]["title"], market["data"]["last_price"])
# Price history
history = client.markets.history("will-btc-reach-100k", days=90)
for point in history["data"]["series"]:
print(point["date"], point["close_price"])
# Bulk prices for multiple markets
prices = client.data.prices(["market-a", "market-b", "market-c"], days=30)
# Historical L2 orderbook
book = client.data.orderbook(
venue="polymarket",
market="will-btc-reach-100k",
start="2026-06-01T00:00:00Z",
end="2026-06-01T01:00:00Z",
limit=5000,
)
# Run a backtest on a thematic basket
result = client.backtests.run(
strategy_id="crypto_updown_roll_timing",
dataset_id="clickhouse:ito_hot.platform_orderbook_l2",
venues=["polymarket"],
date_range={"start": "2026-05-01T00:00:00Z", "end": "2026-06-01T00:00:00Z"},
basket_id="middle-east-conflict", # only markets in this basket
params={"roll_trigger": "liquidity_spread_score"},
)
print(f"P&L: ${result['data']['metrics']['pnl_usd']:.2f}")
API Key
- Go to institutional.itomarkets.com
- Sign up / log in
- Go to Settings -> generate an API key
- Use the key (starts with
ito_) in the client constructor
Available Endpoints
Baskets (9 endpoints)
| Method | Description |
|---|---|
client.baskets.list() |
All baskets with current prices |
client.baskets.get(id) |
Single basket details |
client.baskets.price(id) |
Current price + underlyer snapshot |
client.baskets.history(id) |
Price time series |
client.baskets.chart(id) |
OHLC chart data |
client.baskets.metrics(id) |
Returns, volatility |
client.baskets.underlyers(id) |
Component markets |
client.baskets.overrides() |
Manual overrides |
client.baskets.volume_daily() |
Daily traded volume |
Markets (3 endpoints)
| Method | Description |
|---|---|
client.markets.search() |
Filtered listing by volume |
client.markets.get(id) |
Single market detail |
client.markets.history(id) |
Daily price series |
Research Data (2 endpoints)
| Method | Description |
|---|---|
client.data.orderbook(venue, market) |
Historical L2 snapshots |
client.data.prices(market_ids) |
Bulk daily close prices |
Backtesting (9 endpoints)
| Method | Description |
|---|---|
client.backtests.strategies() |
Available strategies |
client.backtests.create_strategy(...) |
Create custom strategy |
client.backtests.custom_strategies() |
List custom strategies |
client.backtests.datasets() |
Available datasets |
client.backtests.execution_models() |
Fill models |
client.backtests.validate(...) |
Dry-run validation |
client.backtests.plan(...) |
Multi-window experiment |
client.backtests.submit(...) |
Submit for execution |
client.backtests.run(...) |
Submit + poll to completion |
Features
- Typed: Full type hints for IDE autocompletion
- Retries: Automatic retry with exponential backoff on 429/5xx
- Errors: Typed exceptions (
ItoAuthError,ItoRateLimitError, etc.) - Context manager:
with ItoClient(...) as client:for clean resource management - Lightweight: Only dependency is
httpx
Development
git clone https://github.com/Ito-Markets/ito-python.git
cd ito-python
pip install -e ".[dev]"
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ito_markets-0.1.0.tar.gz.
File metadata
- Download URL: ito_markets-0.1.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11e2c2da0a241415513017d35b0054bd7038578e92361d55173efd9208cea26f
|
|
| MD5 |
2f8c0c37e4d51f0d68d9a385c62850d5
|
|
| BLAKE2b-256 |
948f606a8399f23af07681f9ce236a163aa033259a683f813624ac916d77f16f
|
Provenance
The following attestation bundles were made for ito_markets-0.1.0.tar.gz:
Publisher:
publish.yml on Ito-Markets/ito-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ito_markets-0.1.0.tar.gz -
Subject digest:
11e2c2da0a241415513017d35b0054bd7038578e92361d55173efd9208cea26f - Sigstore transparency entry: 1917995056
- Sigstore integration time:
-
Permalink:
Ito-Markets/ito-python@8bb50a2f5dc68fc39718711ee4ee058e01179866 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Ito-Markets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bb50a2f5dc68fc39718711ee4ee058e01179866 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ito_markets-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ito_markets-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dd627f37ef1dd2c585fa9ff6c5bd5e75f9074879cd65a49e771f7c32d79b757
|
|
| MD5 |
0fb0d39b4ffa0b8a7b8b4cf271ad9a76
|
|
| BLAKE2b-256 |
3feae73dbe85ee14d7feced140ec68da88bf8e7cd8c64c79f1829818b1f444f0
|
Provenance
The following attestation bundles were made for ito_markets-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Ito-Markets/ito-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ito_markets-0.1.0-py3-none-any.whl -
Subject digest:
0dd627f37ef1dd2c585fa9ff6c5bd5e75f9074879cd65a49e771f7c32d79b757 - Sigstore transparency entry: 1917995240
- Sigstore integration time:
-
Permalink:
Ito-Markets/ito-python@8bb50a2f5dc68fc39718711ee4ee058e01179866 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Ito-Markets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8bb50a2f5dc68fc39718711ee4ee058e01179866 -
Trigger Event:
release
-
Statement type: