Does your crypto app need to show what the market is doing, or does it need to change something in an account? Use a market data API for the first job and a trading API for the second. The difference is visible in exchange API documentation: a ticker returns a market observation, while a new-order endpoint submits an instruction to the exchange.
A price alert can run without an order-capable credential. A bot that actually trades needs two separate paths: one for the signal and one for the order lifecycle. A live price tells you what happened in the market; the order and fill records tell you what happened to your account.
Pick the interface by the side effect
On Binance Spot, the market API documents a symbol price ticker separately from the trading API's signed new-order operation. Both can refer to the same symbol, but their responses answer different questions. A ticker isn't a venue's promise to fill your order at that price. Likewise, the word “trade” in a public recent-trades feed refers to market prints, not a record of your own account's orders.
| You need to | Read or write |
|---|---|
| Show the last traded price, publish an alert, or update a chart | Read a ticker, trade feed, or candles |
| Estimate the spread or inspect visible liquidity | Read bid/ask or order book data |
| Submit, cancel, or reconcile an order | Use the venue's trading and account endpoints |
| Find out whether your order filled | Read the venue's private execution or order records |
Two sources of truth: a market feed describes the instrument; private order and fill records describe the account. This is a design diagram, not a product screenshot.
Build the price reader without a trading credential
For a snapshot, TickDB documents a ticker endpoint that accepts a symbol list and a market type. Its response includes a last traded price and a timestamp. The example below uses a TickDB data key held on the server. It does not send an order or include any exchange trading credentials. This example is based on the documented response, not a live fill or a coverage benchmark.
import json
import os
from decimal import Decimal
from urllib.parse import urlencode
from urllib.request import Request, urlopen
symbol = "BTCUSDT"
params = urlencode({"symbols": symbol, "type": "crypto"})
url = f"https://api.tickdb.ai/v1/market/ticker?{params}"
request = Request(url, headers={"X-API-Key": os.environ["TICKDB_API_KEY"]})
with urlopen(request, timeout=5) as response:
payload = json.load(response)
if payload.get("code") != 0:
raise RuntimeError("Ticker request returned an API error")
row = next((r for r in payload.get("data", []) if r.get("symbol") == symbol), None)
if row is None:
raise LookupError(f"No ticker returned for {symbol}")
last = Decimal(row["last_price"])
if not last.is_finite() or last <= 0:
raise ValueError("Invalid last traded price")
print({"symbol": symbol, "last_trade_price": str(last),
"provider_timestamp_ms": int(row["timestamp"])})
Keep the data key out of browser code. On a timeout, a missing symbol, or an old timestamp, show that the price is unavailable or stale rather than substituting zero. Define “stale” for your workload and confirm the provider's timestamp semantics; the timestamp alone is not a measured delivery latency. If you want top-of-book bid and ask, use that data directly rather than relabeling the last trade.
Keep execution independent even when a signal triggers an order
If you later add execution, give it a separate credential and process. Use only the permissions it needs. Track an order using the venue's order and execution records, including partial fills. After a network timeout, an order might have reached the exchange even though your process never received a reply. Reconcile before treating it as rejected or sending a replacement. Keep signal, order, and fill states distinct in your logs.
Also check the instrument, product type, and venue on each side. The same asset pair can refer to different instruments across venues or to spot versus a derivative. A price feed used as a reference does not necessarily represent the exact order book where you execute.
One practical acceptance test: take all exchange trading credentials out of the dashboard environment. It should still read prices, while independently failing to initiate an account action. For the separate execution service, test order-state handling in a sandbox where available. The price feed and the execution path can share an instrument mapping, but they should not share authority.
Sources checked November 20, 2026: TickDB Ticker Snapshot and Crypto Market Data API documentation; Binance Spot REST API Market and Trade documentation.


Top comments (0)