Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ formatSize("0.00123456789", szDecimals); // "0.00123"
For spot markets, `getSzDecimals` returns the `szDecimals` of the **base** token — which is what both formatters expect
for an order on that pair.

Outcome markets carry no `szDecimals` metadata, so `getSzDecimals` always returns `5` for them.
Outcome markets carry no `szDecimals` metadata. Their shares trade in whole units, so `getSzDecimals` always returns `0`
for them.

### Spot pair IDs

Expand Down
6 changes: 3 additions & 3 deletions src/utils/_symbolConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ export class SymbolConverter {
if (!slug) return;

this._nameToAssetId.set(slug, 100000000 + 10 * outcome.outcome + sideIdx);
// Outcome markets are absent from szDecimals metadata; they are all 5
this._nameToSzDecimals.set(slug, 5);
// Outcome markets are absent from szDecimals metadata; shares trade in whole units
this._nameToSzDecimals.set(slug, 0);
});
});
}
Expand Down Expand Up @@ -355,7 +355,7 @@ export class SymbolConverter {
* converter.getSzDecimals("BTC"); // → 5
* converter.getSzDecimals("HYPE/USDC"); // → 2
* converter.getSzDecimals("test:ABC"); // → 0
* converter.getSzDecimals("btc-above-61720-yes-jun-08-0600"); // → 5
* converter.getSzDecimals("btc-above-61720-yes-jun-08-0600"); // → 0
* ```
*/
getSzDecimals(name: string): number | undefined {
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/symbolConverter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ Deno.test("SymbolConverter outcome markets", async (t) => {
});

await t.step("getSzDecimals()", () => {
assertEquals(converter.getSzDecimals("nba-finals-game-3-san-antonio"), 5);
assertEquals(converter.getSzDecimals("2026-world-cup-champion-argentina-yes"), 5);
assertEquals(converter.getSzDecimals("nba-finals-game-3-san-antonio"), 0);
assertEquals(converter.getSzDecimals("2026-world-cup-champion-argentina-yes"), 0);
});
});