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

75 lines
2.8 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
### Midpoints for YES and NO are "0.085" and "0.915".
GET http://127.0.0.1:9002/midpoints?token_ids=eb%3AYES%3Amid-example%2Ceb%3ANO%3Amid-example
### Same query with a JSON body
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 best ask to buy YES in the midpoint.jsonl fixture ("0.09")
GET http://127.0.0.1:9002/price?token_id=eb%3AYES%3Amid-example&side=BUY
### Read BUY and SELL for the same outcome (0.09 and 0.08)
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"}]