Markets
Overview
Section titled “Overview”The Markets API provides endpoints for interacting with Ethos prediction markets. This includes a market’s transaction history and the market holdings of an address.
Endpoints
Section titled “Endpoints”Get Market Transaction History
Section titled “Get Market Transaction History”GET /api/v1/markets/:profileId/tx/historyDescription: Retrieves the transaction history for a specific market based on its associated profile ID.
Authentication Required: No
Parameters
Section titled “Parameters”Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
profileId |
integer | Yes | Profile ID of the market to retrieve transaction history for. |
Responses
Section titled “Responses”Success Response
Code: 200 OK
Returns an array of transaction history objects, each containing the transaction hash, timestamp, type, and amount.
Returns a paginated list of transaction history objects for the specified market.
{ "ok": true, "data": [ { "txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "timestamp": "2025-03-30T10:00:00.000Z", "type": "BUY", "amountWei": "1000000000000000000" }, { "txHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", "timestamp": "2025-03-29T14:30:00.000Z", "type": "SELL", "amountWei": "500000000000000000" }, // ... more transaction history objects ] "data": { "values": [ { "eventId": 851534, "marketId": 8, "actorAddress": "0x57E5D96c50ceE6bFa0Fc12dD7892Cf50B5892e91", "type": "SELL", "voteType": "trust", "votes": 17, "funds": "111418815322905231", "txHash": "0x1b833c4fa432df3b0bef27df41fcd993bc903f147b0ba9ebcf3c82ef0005353c", "timestamp": 1743213959 }, { "eventId": 844872, "marketId": 8, "actorAddress": "0x7B3D5e9Ab82D3390792793468854975004440Cf6", "type": "SELL", "voteType": "trust", "votes": 45, "funds": "296984191472517380", "txHash": "0xbd7d708ab9b979b0499ef148f5ad940643610982d01cd42530809b5e9223bbdd", "timestamp": 1743188997 } // ... more transaction objects ], "total": 150, "limit": 50, "offset": 0 }}| Property | Type | Description |
|---|---|---|
ok |
boolean | Success status |
data |
array | Array of transaction history objects |
data[].txHash |
string | Transaction hash |
data[].timestamp |
string | Timestamp of the transaction (ISO 8601 format) |
data[].type |
string | Transaction type (BUY or SELL) |
data[].amountWei |
string | Transaction amount in wei |
data |
object | Paginated response object |
data.values |
array | Array of transaction history objects |
data.values[].eventId |
integer | Unique identifier for the event |
data.values[].marketId |
integer | Profile ID of the market |
data.values[].actorAddress |
string | Ethereum address of the actor performing the transaction |
data.values[].type |
string | Transaction type (BUY or SELL) |
data.values[].voteType |
string | Type of vote (trust or distrust) |
data.values[].votes |
integer | Number of votes involved in the transaction |
data.values[].funds |
string | Transaction amount in wei |
data.values[].txHash |
string | Transaction hash |
data.values[].timestamp |
integer | Timestamp of the transaction (Unix timestamp) |
data.total |
integer | Total number of transactions available |
data.limit |
integer | Maximum number of transactions returned in this response |
data.offset |
integer | Number of transactions skipped (for pagination) |
Error Response
Code: 404 Not Found (Example: Market not found)
{ "ok": false, "error": { "code": "NOT_FOUND", "message": "Market not found" }}Example
Section titled “Example”Request
http GET https://api.ethos.network/api/v1/markets/1/tx/history- This endpoint is useful for fetching transaction history data for a specific market when its profile ID is known.
- If the requested
profileIddoes not correspond to an existing market, the request will fail with a 404 error. - The transaction history data is sorted by timestamp in descending order.
- Pagination parameters (
limit,offset) can be added as query parameters (e.g.,?limit=10&offset=20). The default limit is likely 50, offset 0. - A
voteTypeFilterquery parameter can be used to filter by ‘trust’ or ‘distrust’.
Get Address Market Holdings
Section titled “Get Address Market Holdings”GET /api/v1/markets/holdings/:addressDescription: Retrieves the market holdings for a specific Ethereum address.
Authentication Required: No
Parameters
Section titled “Parameters”Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address |
string | Yes | Ethereum address to retrieve market holdings for. |
Responses
Section titled “Responses”Success Response
Code: 200 OK
Returns an array of market holding objects, each containing the market profile ID, balance in wei, and market information.
{ "ok": true, "data": [ { "marketProfileId": 1, "balanceWei": "10000000000000000000", "market": { "marketProfileId": 1, "creatorAddress": "0x9E2218375567BB466b81E38E1a8b599b6250408C", "positivePrice": "13394648448485010", "negativePrice": "6605351551514990", "trustVotes": 1717, "distrustVotes": 16, "createdAt": "2024-09-14T00:00:00.000Z", "updatedAt": "2025-03-30T04:35:04.439Z", "basePrice": "10000000000000000", "creationCost": "100000000000000000", "liquidity": "1000", "configType": "NORMAL", "profile": { "primaryAddress": "0x9E2218375567BB466b81E38E1a8b599b6250408C", "avatarUrl": "https://pbs.twimg.com/profile_images/1797826077194096640/d_YEoB8n.jpg", "ethosScore": 1711, "name": "Ethos", "twitterUsername": "ethos_network" }, "stats": { "marketCapWei": "7836838875288201409", "volumeTotalWei": "11279993864858341235", "volume24hWei": "10606200508522432", "priceChange24hPercent": 0 } } }, { "marketProfileId": 8, "balanceWei": "5000000000000000000", "market": { // ... market information for market profile ID 8 } }, // ... more market holding objects ]}| Property | Type | Description |
|---|---|---|
ok |
boolean | Success status |
data |
array | Array of market holding objects |
data[].marketProfileId |
integer | Profile ID of the market |
data[].balanceWei |
string | Balance of the holder in wei |
data[].market |
object | Market information |
Error Response
Code: 400 Bad Request (Example: Invalid address)
{ "ok": false, "error": { "code": "VALIDATION_ERROR", "message": "Validation error", "fields": [ { "code": "invalid_address", "message": "Invalid Ethereum address", "path": ["address"] } ] }}Example
Section titled “Example”Request
http GET https://api.ethos.network/api/v1/markets/holdings/0x9E2218375567BB466b81E38E1a8b599b6250408C- This endpoint is useful for fetching market holding data for a specific Ethereum address.
- If the requested
addressis not a valid Ethereum address, the request will fail with a 400 error. - The market holding data is sorted by balance in descending order.