Core concepts
Assets and units
| Symbol | Meaning | Unit in the API | JSON type |
|---|---|---|---|
MLG | Gold (24k-equivalent) | milligram (1 g = 1000 mg) | integer in requests, decimal string in responses |
TMN | Iranian Toman | Toman (not Rial) | integer in requests, decimal string in responses |
- Prices are Toman per one unit of the base asset. On
MLG/TMNthat is Toman per milligram. Multiply by 1000 to show Toman per gram: a price of"10512"means 10,512,000 Toman per gram. - Every number in a response is a JSON string: prices, fees, totals, amounts and balances, e.g.
"10425.5"or"1000". Strings never have an exponent or trailing zeros ("500", not"500.00"). Gold balances can be fractional, e.g."2500.123". - Never use
floatfor money. Usedecimal.Decimalin Python, a decimal library in JavaScript. - In requests, send amounts (
base_amount,quote_amount) as JSON integers. A numeric string such as"1000"is also accepted, but send integers.target_pricemay be a number or a string with at most 2 decimals. - Timestamps are ISO 8601 in UTC with a
Zsuffix, e.g."2026-11-07T08:54:11.115210Z". In requests (expires_at,created_after,created_before) always include an offset; a timestamp without one is read as UTC. - IDs are UUID strings.
from decimal import Decimal
price_per_mg = Decimal("10512")
price_per_gram = price_per_mg * 1000 # Decimal('10512000')
quote_base_amount = int(Decimal("1000")) # send amounts back as integers
Markets
A market is a base/quote pair. v1 has a single market, MLG/TMN, but do not hard-code its ID. Always discover it from GET /markets/.
Each market has these settings, which admins can change at any time:
trading.enabled: the market-wide trade switch. Each oftrading.buy_enabled,trading.sell_enabledandtrading.limit_enabledalready includes it, so check the specific flag you need.limits.spotandlimits.limit: minimum and maximum order sizes in milligrams ("0"means no limit).fees: fees as percentages ("0.5"= 0.5%) for buy, sell, limit buy and limit sell, plus a minimum fee for each in milligrams.
Fee = max(percent / 100 × base_amount, min_fee_base) × price. The minimum fee is expressed in milligrams and converted to Toman at the trade price. Always use the fee the server returns in a quote rather than computing it yourself.
Admins can change these settings at any time, and every order re-checks them.
Quotes (price lock)
To trade, first request a quote for a side (buy or sell) and an amount (POST /quotes/):
- It locks the price for 30 seconds (
expires_at). After that you getquote_expiredand must request a new one. - A quote backs one order only (a second use gets
quote_used). - If an order is rejected (e.g.
insufficient_balance), nothing was created, and you may retry with the same quote while it is still valid. - Give the amount as
base_amount(milligrams) orquote_amount(Toman), exactly one of the two. - There are two kinds (
kind):spotfor spot orders, andlimitwhen you sent atarget_price. Each can only be used for the matching order type (quote_kind_mismatch). - Only quotes created through
POST /quotes/are accepted; price locks made in the Talano app are not.
GET /markets/{market_id}/price/ is indicative only and does not lock anything.
Order types
Spot (market) order: order_type: "ordinary"
Executes immediately at the quoted price against your wallet balance. Buys are paid from the Toman wallet, sells from the gold wallet. There is no payment gateway in the API: if the balance is too low you get insufficient_balance.
Limit order: order_type: "limit"
You set a target_price. The required funds are locked immediately and the order stays active until:
- the market reaches the target (
done), - you cancel it (
cancelled), or - its
expires_atpasses (expired).
A buy target must be below the current buy price, and a sell target above the current sell price.
Order statuses
| Status | Meaning |
|---|---|
pending | Accepted, being processed (short-lived) |
active | Limit order waiting for its target price (funds locked) |
done | Executed |
failed | Execution failed and no funds moved. Orders placed through the API never end up failed, because a failed settlement is rolled back (order_failed). Orders placed in the app can |
cancelled | Limit order cancelled by the user |
expired | Limit order passed its expires_at without executing |
The order endpoints show all your spot and limit orders, including ones placed in the Talano app (their client_id is null).
client_id (idempotency)
Every order request may carry an optional client_id: your own ID for the order.
- 1–64 characters of
[A-Za-z0-9_-], unique per user (shared across spot and limit orders). - Sending the same request again (same
client_id,quote_id,base_amountand endpoint) never creates a second order. You get the existing order back with200instead of201. - The same
client_idwith anything different gets409 client_id_conflict. - After a timeout, look the order up with
GET /orders/by-client-id/{client_id}/.
Always set client_id in bots so network retries are safe. Details in the idempotency guide.
Pagination
GET /orders/ is paginated with limit (default 20; values above 100 are capped at 100) and offset. next and previous are full URLs or null:
{
"count": 137,
"next": "https://service.talano.ir/api/public/v1/orders/?limit=20&offset=20",
"previous": null,
"results": []
}
Follow next until it is null.