API reference · Research

Run a bench

POST/v1/research/bench

One built-in strategy over every replayable event the filters keep, with a row per event and intervals across events.

On this page

Auth. An API token: Authorization: Bearer lb_… (create one). Signed-in web sessions work too.

Limits. One Sim run (20 a month on Free, 100 on Builder, unlimited on Standard).

Parameters

Body

NameTypeRequiredDescription
strategystringnoA built-in strategy name. Default hold_none.
paramsobjectnoThe strategy's parameters.
latency_msarray of integernoUp to 6 latencies in ms; default [250, 2250, 5250].
starting_cashnumbernoPaper cash in USD per event. Up to 10,000,000. Default 1000.0.
maker_fee_ratenumbernoThe maker fee rate. 0 to 0.5. Default 0.0175.
queue_positionbooleannoMake resting orders wait behind the size recorded at their price. Default false.
taker_delay_msintegernoA venue speed bump on taking orders, in ms. 0 to 60,000. Default 0.
test_fractionnumbernoShare of events, by start time, held out as the later split. Default 0.3.
speakerstringnoOnly events of this speaker key.
seriesstringnoOnly events with markets in this series.
sinceintegernoEvents that started at or after this ms epoch.
untilintegernoEvents that started before this ms epoch.
event_idsarray of stringnoExactly these events. Up to 200 items.
limitintegernoAt most this many events. 1 to 200. Default 50.
codestringnoRefused. Bench your own file locally with langbot research bench -s my_bot.py.

Request

Terminal
curl -X POST "https://api.langbot.ai/v1/research/bench" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"strategy": "quote_both_sides", "latency_ms": [250, 2250], "limit": 20}'

Response

201 Created

JSON
{
  "v": 1,
  "strategy": { "name": "quote_both_sides", "params": {} },
  "latency_ms": [250, 2250],
  "events": [ { "event_id": "ev_kxearningsmentiongs_26oct13", "markets_traded": 3, "by_latency": [ { "latency_ms": 250, "net": 12.4, "fees": 1.9, "fills": 14 } ] } ],
  "aggregate": {
    "n_events": 20,
    "by_latency": [ { "latency_ms": 250, "n": 20, "net_total": 61.0, "net_mean": 3.05, "net_ci90": [-1.2, 7.4], "share_positive": 0.6, "p_value_mean": 0.18 } ]
  },
  "skipped": [],
  "caveats": ["20 events"]
}

Each event replayed is one Sim run; past your allowance the rest are listed in skipped, not refused. Results describe the record, not what real orders would get.

Errors

StatuscodeWhen
401auth_requiredNo token was sent.
401token_invalidThe token was not recognised (mistyped, revoked or expired).
422validation_errorA parameter failed validation; detail[].loc names it.
429quota_exceededThis month's Sim runs are spent; quota.resets_at says when they reset.
429rate_limitedOver your request budget; wait Retry-After seconds.

Every error body is {"detail": …, "code": "…"}; branch on code. All codes: Errors.