Skip to main content

biatec-router (Python)

Python client for Biatec Router, a DEX aggregator API for the Algorand blockchain.

At the time of writing it is the most efficient DEX aggregator on Algorand as it routes trades across Pact.Fi, Tinyman and Biatec DEX - the first concentrated-liquidity AMM on Algorand, which other aggregators don't support.

This mirrors the biatec-router npm package for Python developers: a thin HTTP client plus an ARC-14 authentication helper. It does not sign or submit transactions for you - you decode, sign and send the transaction group with py-algorand-sdk as shown below.

Install

pip install biatec-router

Authentication

Every endpoint requires an Authorization header carrying a signed ARC-0014 transaction for the realm BiatecRouter#ARC14. The transaction is a zero-amount payment with the realm in the note field - it is never submitted to the network, it only proves control of an Algorand account.

from algosdk.v2client import algod
from biatec_router import build_auth_header, RouterClient

algod_client = algod.AlgodClient("", "https://mainnet-api.4160.nodely.dev")
suggested_params = algod_client.suggested_params()

# private_key from mnemonic.to_private_key(...), ARC-76, or however you manage keys
auth_header = build_auth_header(private_key, suggested_params)

router = RouterClient(
    base_url="https://router.api.biatec.io",  # or https://testnet.router.api.biatec.io
    auth_header=auth_header,
)

Request a quote

output_amount = router.quote(from_asset=0, to_asset=31566704, amount=5_000_000)
print(output_amount)  # estimated USDC (base units) for 5 ALGO

routes = router.route(from_asset=0, to_asset=31566704, amount=5_000_000, max_routes=1)
print(routes)

Execute a swap

Always set receive_minimum when executing to protect your funds. Never use 0 outside of a preview.

import algosdk
from algosdk import transaction

response = router.route_txs(
    sender=account_address,
    from_asset=0,
    to_asset=31566704,
    swap_amount=5_000_000,
    receive_minimum=4_900_000,
    routes_count=1,
    max_hops=3,
)

route = response["routes"][0]
if not route.get("txsToSign"):
    raise RuntimeError("No transactions to sign in the route.")

# Decode, group and sign
txns = [algosdk.encoding.msgpack_decode(b64) for b64 in route["txsToSign"]]
group_id = transaction.calculate_group_id(txns)
for txn in txns:
    txn.group = group_id

signed = [txn.sign(private_key) for txn in txns]
txid = algod_client.send_transactions(signed)
algosdk.transaction.wait_for_confirmation(algod_client, txid, 4)

API

  • RouterClient(base_url=..., auth_header=..., timeout=30.0)
    • .quote(from_asset, to_asset, amount) -> int
    • .route(from_asset, to_asset, amount, max_routes=1) -> list[dict]
    • .route_txs(sender, from_asset, to_asset, swap_amount, receive_minimum, routes_count=1, max_hops=3) -> dict
    • .stats() -> dict
    • .snapshot() -> dict
    • Raises biatec_router.RouterApiError (with .status_code / .body) on non-2xx responses.
  • build_auth_header(private_key, suggested_params, realm="BiatecRouter#ARC14", sender=None) -> str
  • make_arc14_transaction(sender, suggested_params, realm="BiatecRouter#ARC14") / make_arc14_auth_header(signed_txn) - lower-level building blocks if you sign with something other than a raw private key (e.g. a wallet or AccountTransactionSigner).

Development

cd python
pip install -e ".[dev]"
pytest

See docs/PYPI_CICD.md in the repository root for how releases are published to PyPI.

Release files for biatec-router 1.0.1

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

Source distribution (sdist)

Source distribution for biatec-router 1.0.1
File Size Uploaded
biatec_router-1.0.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biatec-router 1.0.1
File Interpreter ABI Platform
biatec_router-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / biatec_router-1.0.1.tar.gz

Download URL biatec_router-1.0.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8e750bdcd3c13729a9c7e5d88fe261cc7f3d4373c742ca7ba20fdc48271755fd
BLAKE2b-256 checksum
How to use checksums
16515e3a15abdf9aa46d4a8383aa768462c1804e11f46718de346588199f8824
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / biatec_router-1.0.1-py3-none-any.whl

Download URL biatec_router-1.0.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c77386be3bfb7254b826efca40946a8fa395436ee9cb3d396fc20a46550e3cb4
BLAKE2b-256 checksum
How to use checksums
6c355cc19590c8d99bbb4bc96efb69c4ce76f4b0ee7e750149efe2db14813fc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

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