Asset IDs
Every tradeable asset on GX Exchange has a numeric index used in API requests. This page explains the mapping between human-readable symbols and numeric asset IDs.
Perpetual Asset Indices
Perpetual markets use zero-based integer indices assigned in the order they appear in the meta endpoint response. The index corresponds to the position in the universe array.
Querying Perpetual Indices
POST /info
Content-Type: application/json
{ "type": "meta" }Response:
{
"universe": [
{ "name": "BTC", "szDecimals": 5, "maxLeverage": 50, "onlyIsolated": false },
{ "name": "ETH", "szDecimals": 4, "maxLeverage": 50, "onlyIsolated": false },
{ "name": "SOL", "szDecimals": 2, "maxLeverage": 20, "onlyIsolated": false }
]
}| Asset | Index | Symbol |
|---|---|---|
| Bitcoin | 0 | BTC |
| Ethereum | 1 | ETH |
| Solana | 2 | SOL |
| … | n | universe[n].name |
The index is the array position.
universe[0]is asset index0.
Spot Asset Indices
Spot assets use a separate index space starting at 10000. Each spot token has a unique index assigned in the spotMeta endpoint.
Querying Spot Indices
POST /info
Content-Type: application/json
{ "type": "spotMeta" }Response:
{
"universe": [
{ "tokens": [10000, 10001], "name": "BTC-USDC", "index": 10000 }
],
"tokens": [
{ "name": "BTC", "szDecimals": 8, "weiDecimals": 8, "index": 10000 },
{ "name": "USDC", "szDecimals": 6, "weiDecimals": 6, "index": 10001 }
]
}Spot Index Ranges
| Range | Category |
|---|---|
0 — 9999 | Perpetual markets |
10000+ | Spot tokens |
Using Asset IDs in Orders
When placing orders via the exchange endpoint, use the numeric asset index in the a field:
{
"type": "order",
"orders": [
{
"a": 0,
"b": true,
"p": "67000.0",
"s": "0.01",
"r": false,
"t": { "limit": { "tif": "Gtc" } }
}
],
"grouping": "na"
}Here "a": 0 refers to BTC perpetual (the first entry in the meta universe).
For spot orders, use the spot token index:
{
"type": "order",
"orders": [
{
"a": 10000,
"b": true,
"p": "67000.0",
"s": "0.001",
"r": false,
"t": { "limit": { "tif": "Gtc" } }
}
],
"grouping": "na"
}GIP-1 and GIP-2 Deployed Assets
Assets deployed through GIP-1 (spot tokens) and GIP-2 (spot pairs) are assigned indices dynamically. After deployment, query the spotMeta endpoint to discover the assigned index.
Building a Symbol Map
Always query the meta or spotMeta endpoints at startup to build a local symbol-to-index mapping. Do not hardcode asset indices, as new markets are added over time and indices are assigned sequentially.
// TypeScript
async function buildAssetMap(client: GxClient) {
const meta = await client.info({ type: "meta" });
const perpMap = new Map<string, number>();
meta.universe.forEach((m: any, i: number) => perpMap.set(m.name, i));
const spotMeta = await client.info({ type: "spotMeta" });
const spotMap = new Map<string, number>();
spotMeta.tokens.forEach((t: any) => spotMap.set(t.name, t.index));
return { perpMap, spotMap };
}
// Usage
const { perpMap, spotMap } = await buildAssetMap(client);
const btcPerpIndex = perpMap.get("BTC"); // 0
const btcSpotIndex = spotMap.get("BTC"); // 10000# Python
def build_asset_map(info):
meta = info.meta()
perp_map = {m["name"]: i for i, m in enumerate(meta["universe"])}
spot_meta = info.spot_meta()
spot_map = {t["name"]: t["index"] for t in spot_meta["tokens"]}
return perp_map, spot_map
perp_map, spot_map = build_asset_map(info)
btc_perp_index = perp_map["BTC"] # 0
btc_spot_index = spot_map["BTC"] # 10000