Files
eventbook-exchange/docs/examples/clob-http.http
T

93 lines
3.6 KiB
HTTP

### Run against the demo database from clob-book.jsonl
GET http://127.0.0.1:9002/book?token_id=eb%3AYES%3Ademo
### Read both outcome books in one snapshot
POST http://127.0.0.1:9002/books
Content-Type: application/json
[{"token_id":"eb:NO:demo"},{"token_id":"eb:YES:demo","side":"BUY"}]
### Unknown token
GET http://127.0.0.1:9002/book?token_id=eb%3AYES%3Amissing
### History for one outcome in the last hour
GET http://127.0.0.1:9002/v2/prices-history?token_id=eb%3AYES%3Ademo&interval=1h&bucket_seconds=60&limit=1
### Replace the cursor placeholder with pagination.next_cursor from the previous response
GET http://127.0.0.1:9002/v2/prices-history?token_id=eb%3AYES%3Ademo&cursor={{next_cursor}}
### Last execution for one outcome
GET http://127.0.0.1:9002/last-trade-price?token_id=eb%3AYES%3Ademo
### Last executions for both outcomes from one SQLite snapshot
GET http://127.0.0.1:9002/last-trades-prices?token_ids=eb%3AYES%3Ademo%2Ceb%3ANO%3Ademo
### Batch last executions in JSON
POST http://127.0.0.1:9002/last-trades-prices
Content-Type: application/json
[{"token_id":"eb:YES:demo"},{"token_id":"eb:NO:demo"}]
### Fetch the active price increment by outcome ID
GET http://127.0.0.1:9002/tick-size?token_id=eb%3AYES%3Ademo
### Fetch the same market grid with the other outcome in the path
GET http://127.0.0.1:9002/tick-size/eb%3ANO%3Ademo
### Find the market and both outcome IDs from the NO token
GET http://127.0.0.1:9002/markets-by-token/eb%3ANO%3Ademo
### Load both outcome labels and their shared trading parameters
GET http://127.0.0.1:9002/clob-markets/demo
### Read the current difference between best ask and best bid
GET http://127.0.0.1:9002/spread?token_id=eb%3AYES%3Ademo
### Read both outcome spreads in one snapshot
POST http://127.0.0.1:9002/spreads
Content-Type: application/json
[{"token_id":"eb:YES:demo"},{"token_id":"eb:NO:demo"}]
### Load midpoint.jsonl into the same database first. Expected mid is "0.085".
GET http://127.0.0.1:9002/midpoint?token_id=eb%3AYES%3Amid-example
### A query-only batch GET returns 400 Invalid payload.
GET http://127.0.0.1:9002/midpoints?token_ids=eb%3AYES%3Amid-example%2Ceb%3ANO%3Amid-example
### Batch POST returns YES "0.085" and NO "0.915".
POST http://127.0.0.1:9002/midpoints
Content-Type: application/json
[{"token_id":"eb:YES:mid-example"},{"token_id":"eb:NO:mid-example"}]
### Read the resting YES bid in the midpoint.jsonl fixture ("0.08")
GET http://127.0.0.1:9002/price?token_id=eb%3AYES%3Amid-example&side=BUY
### Query-only batch GET returns 400 Invalid payload
GET http://127.0.0.1:9002/prices?token_ids=eb%3AYES%3Amid-example%2Ceb%3AYES%3Amid-example&sides=BUY%2CSELL
### Include both outcomes with a JSON body
POST http://127.0.0.1:9002/prices
Content-Type: application/json
[{"token_id":"eb:YES:mid-example","side":"BUY"},{"token_id":"eb:NO:mid-example","side":"BUY"}]
### CLOB SDK time series: asset ID, trailing hour, ten-minute fidelity
GET http://127.0.0.1:9002/prices-history?market=eb%3AYES%3Ademo&interval=1h&fidelity=10
### Explicit Unix-second window (the seeded exchange regression has fills at 121, 149 and 245)
GET http://127.0.0.1:9002/prices-history?market=eb%3AYES%3Ae&startTs=120&endTs=245&fidelity=1
### After replaying fees.jsonl, both outcome tokens report base_fee 30.
GET http://127.0.0.1:9002/fee-rate?token_id=eb%3AYES%3Acup
### The path form accepts an encoded token ID.
GET http://127.0.0.1:9002/fee-rate/eb%3ANO%3Acup
### The same market reports tbf 30 and an execution fee coefficient fd.r of 0.05.
GET http://127.0.0.1:9002/clob-markets/cup
### Load neg-risk.jsonl to query either token of a member of the election group.
GET http://127.0.0.1:9002/neg-risk?token_id=eb%3ANO%3Aa