Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.generalmarket.io/llms.txt

Use this file to discover all available pages before exploring further.

Ticks & Backtesting

The past, dissected. Query historical tick results, view revealed bitmaps after a tick closes, and backtest strategies against simulated outcomes. History does not repeat — but it does rhyme, and the rhyme is sometimes worth money.

Get Tick History

GET /vision/batch/{id}/history Returns the most recent tick results for a batch (up to 100). Each entry: the outcomes, the participants, the volume matched. A ledger of settled arguments.
id
number
required
The batch ID to fetch tick history for.
curl https://generalmarket.io/api/vision/batch/1/history

Response Fields

FieldTypeDescription
batch_idnumberThe batch ID
tick_idnumberSequential tick number within the batch
resolved_atstring | nullISO 8601 timestamp when the tick was resolved
player_countnumber | nullNumber of players who participated in this tick
total_matchedstring | nullTotal volume matched between winners and losers, in wei
results_jsonobject | nullDetailed per-market results including outcomes and percentage changes

Errors

StatusCondition
500Database query failure

Get Revealed Bitmaps

GET /vision/reveal/{batch_id}/{tick_id} Returns all player bitmaps for a completed tick. Bitmaps are only available after the reveal window has expired — the sealed opinions of others, visible only after it is too late to act on them.
batch_id
number
required
The batch ID to query reveals for.
tick_id
number
required
The tick number to fetch revealed bitmaps for. Must be a completed tick past the reveal window.
curl https://generalmarket.io/api/vision/reveal/1/142

Response Fields

FieldTypeDescription
batch_idnumberThe batch ID
tick_idnumberThe tick number
bitmapsobject[]Array of revealed player bitmaps
bitmaps[].playerstringPlayer’s Ethereum address
bitmaps[].bitmap_hexstringThe raw bitmap as a hex string
bitmaps[].hashstringThe keccak256 hash of the bitmap (matches on-chain commitment)

Errors

StatusCondition
403The reveal window has not yet expired for this tick. The error message includes the deadline timestamp.
404Batch does not exist
The reveal window is a configurable delay after a tick ends, during which bitmaps remain sealed. Request too early and you receive a 403 with the deadline — a timestamp that says, in effect, “not yet.”

Backtest a Strategy

POST /vision/backtest Simulate a bitmap strategy against deterministic pseudo-random outcomes. Test your theory before paying for it. The backtest engine uses a deterministic PRNG seeded from market IDs and tick numbers, producing a consistent 50/50 base distribution. A controlled hallucination of the past.
batch_id
number
required
The batch ID to simulate against. The batch must exist so the engine knows which markets to simulate.
bitmap_hex
string
required
The prediction bitmap to test, as a hex string with 0x prefix. Each bit represents UP (1) or DOWN (0) for the corresponding market.
code
string
Optional Python strategy code. This field is accepted but currently ignored server-side — strategy code is executed client-side via Pyodide. Reserved for future server-side execution.
ticks
number
Number of ticks to simulate. Defaults to 50, maximum 200.
curl -X POST https://generalmarket.io/api/vision/backtest \
  -H "Content-Type: application/json" \
  -d '{
    "batch_id": 1,
    "bitmap_hex": "0xff00ab",
    "ticks": 100
  }'

Response Fields

FieldTypeDescription
win_ratenumberFraction of individual market bets that were correct (0.0 to 1.0), rounded to 4 decimal places
pnl_curveobject[]Cumulative PnL at each tick
pnl_curve[].ticknumberTick number in the simulation
pnl_curve[].pnlnumberCumulative PnL at this tick, normalized to a +/-1 range per tick
total_pnlnumberFinal cumulative PnL after all simulated ticks

Errors

StatusCondition
400Missing bitmap_hex field
400Invalid hex encoding in bitmap_hex
400Batch has no markets configured
404Batch does not exist
The backtest is deterministic — same inputs, same outputs, always. Useful for comparing strategies against each other. Useless for predicting the future — but then, what isn’t.