Python SDK for the Talarion prediction market maker API
Project description
Talarion SDK
Trade against language models on custom prediction markets. This is the official Python client for the Talarion API — async, typed, and ready to roll.
Installation
pip install talarion
Want to go off the rails and interact with the Escrow contract directly from an EOA? We got you:
pip install talarion[eoa]
Requires Python 3.10+.
Quick Start
import asyncio
from datetime import datetime, timezone, timedelta
from talarion import TalarionClient
async def main():
async with TalarionClient(api_key="tlrn_...") as client:
# Spin up a brand new prediction market
instrument = await client.generate_instrument(
query="Will BTC hit 100k?",
resolution_time=datetime.now(timezone.utc) + timedelta(days=7),
)
# Get a price quote
quote = await client.get_quote(
instrument.instrument_id,
buy_yes=True,
amount=10.0,
user_id="user-123",
)
print(f"Price: {quote.price}, Amount: {quote.amount}")
asyncio.run(main())
That's it. You just created a market and got a quote. Our proprietary mm is on the other side.
EOA Direct Interaction
For EOA wallets that skip the Safe/relay flow and talk to the Escrow contract directly. All defaults point at Polygon mainnet — zero config needed:
import asyncio
from talarion import TalarionClient
from talarion.eoa import build_approve_usdc_tx, build_create_trade_tx, sign_and_send
RPC = "https://polygon-rpc.com"
PK = "0xYourPrivateKey"
EOA = "0xYourWalletAddress"
# One-time USDC approval (defaults to Polygon USDC + Talarion Escrow)
approve_tx = build_approve_usdc_tx()
sign_and_send(approve_tx, PK, RPC)
async def main():
async with TalarionClient(api_key="tlrn_...") as client:
# Submit an order — for EOAs, operation_sequence comes back as None
result = await client.submit_order(
instrument_id="instr_abc123",
user_id="user-123",
caller_address=EOA,
amount=10.0,
price=0.65,
buy_yes=True,
)
# Build the on-chain tx from the submit result and fire it off
trade_tx = build_create_trade_tx(result)
tx_hash = sign_and_send(trade_tx, PK, RPC)
print(f"Trade created: {tx_hash}")
asyncio.run(main())
Docs
Full reference with examples, type definitions, and the EOA module API lives at docs.talarion.tech/sdk.
License
MIT
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
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 talarion-0.1.3.tar.gz.
File metadata
- Download URL: talarion-0.1.3.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cd39494d6feba58f82b7d0a19f4ac4b074e99566121c2e829169da5ec9b8bb
|
|
| MD5 |
8d770940b67810fbe48633f22ad45ef6
|
|
| BLAKE2b-256 |
b223b2429af2ecc4d8f82a7c100e29d3571ab014b99a72ba626c023904234a75
|
File details
Details for the file talarion-0.1.3-py3-none-any.whl.
File metadata
- Download URL: talarion-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e270c5f9a6600d33c14fad22cc25c5ae276bdf4c1acf732c8cf922a0ee73195
|
|
| MD5 |
aa98bc25f3da7d162c72a8e028b7c2be
|
|
| BLAKE2b-256 |
718e5b0fbf2cdb965624a957ff99701854bf998131842c1cb36d120c6a88b4ef
|