← All articles

Kraken renamed tokenized stock pairs on 24 Nov. Build a pair map that survives it in Node.js/TS

If your Node.js code builds a map of Kraken’s tokenized stock pairs from the AssetPairs endpoint, check it against Kraken’s changes of 24 and 26 November 2026. On 24 November, the SPV entries for tokenized assets switched to their own names. Before that, they shared names with the rebased x entries, such as AAPLx/USD.

With @siebly/kraken-api 1.1.12, select the SPV or rebased entry explicitly when building the pair map. Iteration order can otherwise determine which instrument gets the shared key.

What changed

From the Kraken API changelog:

  • 24 November 2026, Spot REST v1. SPV entries for tokenized assets in Assets and AssetPairs now use SPV names instead of the rebased x names. In AssetPairs, the SPV pair entry (Kraken’s example is AAPLSPVUSD) now has altname: "AAPLSPVUSD" (was AAPLxUSD), wsname: "AAPLSPV/USD" (was AAPLx/USD) and base: "AAPLSPV" (was AAPLx). In Assets, the SPV entry’s altname is now AAPLSPV (was AAPLx). The rebased x entries (AAPLx, AAPLxUSD) and all other fields are unchanged.
  • 26 November 2026, Spot REST v1. Assets and AssetPairs accept an optional include_spv parameter. It defaults to true, so responses do not change if you leave it out. include_spv=false leaves out the SPV entries, and the rebased x entries are still returned. It only affects full listings, and is ignored when you filter with pair (or asset for Assets).

Kraken’s advice: if you match SPV entries by altname, wsname or base, update your mapping. If you only use the rebased entries, you can pass include_spv=false instead.

What the live endpoint returns

A public request to GET /0/public/AssetPairs?aclass_base=tokenized_asset returned 356 pairs: 178 SPV entries and 178 rebased x entries, all quoted in ZUSD. With include_spv=false added, it returned the 178 x entries only. These are the two AAPL entries, trimmed to the relevant fields:

"AAPLxUSD": {
  "altname": "AAPLxUSD",
  "wsname": "AAPLx/USD",
  "aclass_base": "tokenized_asset",
  "base": "AAPLx",
  "quote": "ZUSD",
  "pair_decimals": 2,
  "lot_decimals": 8,
  "tick_size": "0.01",
  "status": "online"
},
"AAPLSPVUSD": {
  "altname": "AAPLSPVUSD",
  "wsname": "AAPLSPV/USD",
  "aclass_base": "tokenized_asset",
  "base": "AAPLSPV",
  "quote": "ZUSD",
  "pair_decimals": 2,
  "lot_decimals": 8,
  "tick_size": "0.01",
  "status": "online"
}

Why a pair map can go wrong

Before 24 November, the SPV entry and the rebased entry both had wsname: "AAPLx/USD" and base: "AAPLx". A map keyed on either field held only one of the two, whichever was written last, without any error. Since 24 November the names are different, so the same code now picks the x entry every time. If your code relied on the SPV entry under the old names, it no longer finds it there.

Either way, the code never told you anything. The fix is a map that:

  • decides on purpose which entries it includes,
  • refuses to overwrite an entry when two share a key, and
  • takes precision from each pair instead of hard-coding it.

A pair map that survives renames

The example below loads tokenized pairs with SpotClient.getAssetPairs(), keeps only the rebased x entries, and keys them on wsname. It throws if two entries share a wsname, and formats prices and quantities from each pair’s own precision. AssetPairs is a public endpoint, so the client needs no API keys.

import { SpotAssetPair, SpotClient } from '@siebly/kraken-api';

const client = new SpotClient();

export interface PairInfo {
  key: string; // AssetPairs result key, e.g. AAPLxUSD
  wsname: string; // e.g. AAPLx/USD
  altname: string;
  base: string;
  quote: string;
  pairDecimals: number;
  lotDecimals: number;
  tickSize?: string;
  ordermin: string;
  status?: string;
}

// Since 24 Nov 2026, SPV entries use SPV names (AAPLSPVUSD,
// wsname AAPLSPV/USD, base AAPLSPV). Before that they reused
// the x names, so they collided with the rebased entries.
function isSpvEntry(pair: SpotAssetPair): boolean {
  return pair.base.endsWith('SPV');
}

export async function loadTokenizedPairMap() {
  const res = await client.getAssetPairs({
    aclass_base: 'tokenized_asset',
  });

  const byWsname = new Map<string, PairInfo>();

  for (const [key, pair] of Object.entries(res.result)) {
    if (isSpvEntry(pair)) continue;

    const { wsname } = pair;
    if (!wsname) {
      throw new Error(`Pair ${key} has no wsname`);
    }

    // Never let one entry silently replace another.
    const existing = byWsname.get(wsname);
    if (existing) {
      throw new Error(
        `Duplicate wsname ${wsname}: ${existing.key} and ${key}`,
      );
    }

    byWsname.set(wsname, {
      key,
      wsname,
      altname: pair.altname,
      base: pair.base,
      quote: pair.quote,
      pairDecimals: pair.pair_decimals,
      lotDecimals: pair.lot_decimals,
      tickSize: pair.tick_size,
      ordermin: pair.ordermin,
      status: pair.status,
    });
  }

  return byWsname;
}

function decimalsOf(value: string): number {
  const dot = value.indexOf('.');
  return dot === -1 ? 0 : value.length - dot - 1;
}

// Price: pair_decimals, then snapped to tick_size if present.
// Integer maths at a fixed scale avoids float drift.
export function formatPrice(info: PairInfo, price: number): string {
  const tick = info.tickSize;
  const scale = Math.max(
    info.pairDecimals,
    tick ? decimalsOf(tick) : 0,
  );
  const factor = 10 ** scale;
  let units = Math.round(price * factor);

  if (tick) {
    const tickUnits = Math.round(Number(tick) * factor);
    if (tickUnits > 0) {
      units = Math.round(units / tickUnits) * tickUnits;
    }
  }

  return (units / factor).toFixed(info.pairDecimals);
}

// Quantity: round down to lot_decimals, so you never send
// more than you meant to.
export function formatQty(info: PairInfo, qty: number): string {
  const factor = 10 ** info.lotDecimals;
  const units = Math.floor(Number((qty * factor).toFixed(2)));
  return (units / factor).toFixed(info.lotDecimals);
}

async function main() {
  const pairs = await loadTokenizedPairMap();
  console.log('tokenized pairs:', pairs.size);

  const aapl = pairs.get('AAPLx/USD');
  if (!aapl) throw new Error('AAPLx/USD not listed');

  console.log(aapl.key, aapl.status);
  console.log('price', formatPrice(aapl, 231.456));
  console.log('qty', formatQty(aapl, 0.123456789));
}

main().catch((e) => {
  console.error(e);
  process.exit(1);
});

How it works

  • Loading. getAssetPairs({ aclass_base: 'tokenized_asset' }) calls GET /0/public/AssetPairs and returns the pairs as an object keyed by pair name. Each value is typed as SpotAssetPair. The SDK throws if Kraken returns a non-empty error array.
  • Skipping SPV entries. isSpvEntry() drops entries whose base ends in SPV. In the live data, every SPV entry matched this and no rebased entry did. If you need the SPV entries instead, flip the check and key them on their own wsname, such as AAPLSPV/USD.
  • Duplicate check. If two entries ever share a wsname again, the map throws when it is built, at startup, instead of quietly keeping one of them.
  • Prices. formatPrice() rounds to pair_decimals and then snaps to tick_size when the pair has one. Both matter: in the live data, NFLXxUSD has pair_decimals: 3 but tick_size: "0.01", so a price rounded to 3 decimals alone could fall between ticks.
  • Quantities. formatQty() rounds down to lot_decimals, so a computed size never grows when you round it. Check it against ordermin before you send an order.
  • Status. The map keeps status. In the live data most tokenized pairs were post_only, a few were online, and two were cancel_only. Check it before you place an order.

About include_spv

You could ask Kraken to leave the SPV entries out with include_spv=false. The parameter is not in the SDK’s SpotGetAssetPairsParams type in the current release, so the example filters on the client instead. Typed support for it is queued for an upcoming release. The client-side filter is worth keeping even after that, because Kraken ignores include_spv when you request specific pairs with pair.

Diagnose missing or duplicated instruments

Symptom Likely cause Fix
Lookups by AAPLSPV names fail, or old SPV lookups return a different pair SPV entries were renamed on 24 Nov 2026 Key SPV entries on the new names (AAPLSPV/USD, AAPLSPV), or skip them
Map size is twice what you expected SPV and x entries now have distinct names, so both are stored Filter on base, or pass include_spv=false once it is typed
Different pair under the same key from one run to the next Two entries shared a key, and the last one won Throw on duplicate keys when building the map
Orders rejected for price or size precision Hard-coded decimals, or tick_size ignored Use pair_decimals, tick_size and lot_decimals from each pair
  • Choose which entries you want (rebased x or SPV) explicitly.
  • Key on one field, and throw on duplicates.
  • Rebuild the map at startup and on a schedule, not once at deploy time.
  • Read the changelog for renames like this one.

Further reading