Skip to content
🌐Network: Mainnet

Trading Data

Access historical trade data and OHLCV candlestick information for market analysis.

1. Get Recent Trades

Endpoint: GET /v1/trades

Description: Retrieve recent trade history for a market.

Query Parameters

curl -X GET \
  "https://api.o2.app/v1/trades" \
  -H "Accept: application/json"

Source: packages/api/src/app/routes/v1/trades.rs:35-38

2. Get Trades by Account

Endpoint: GET /v1/trades_by_account

Description: Retrieve trade history filtered by account or contract identity. Returns all trades where the specified account was either the maker or taker.

Query Parameters

curl -X GET \
  "https://api.o2.app/v1/trades_by_account" \
  -H "Accept: application/json"

Parameters: Provide either account OR contract (not both).

Use Case: Query all trades associated with a specific trading account, useful for account-specific workflows and trade history tracking.

Pagination: Use start_timestamp and start_trade_id to paginate through results.

Source: packages/api/src/app/routes/v1/trades.rs

3. Get Historical Price Bars (OHLCV)

Endpoint: GET /v1/bars

Description: Get historical candlestick/bar data for charts.

Query Parameters

curl -X GET \
  "https://api.o2.app/v1/bars" \
  -H "Accept: application/json"

Limits: Maximum 5000 bars per request (packages/api/src/domain/bars.rs:14-23)

Source: packages/api/src/app/routes/v1/bars.rs:25-28