# Retrieve the Latest and Recent Market Activity for Prediction Markets

## Retrieve the Latest and Recent Market Activity for Prediction Markets

This tutorial shows how to pull **(a)** the _latest_ trade + quote snapshot and **(b)** _recent_ trades + quotes for a specific prediction market using FinFeedAPI’s Prediction Markets REST API.

## What you’ll build

By the end, you’ll be able to:

* Fetch the **current/latest** trade + quote 
* Fetch **recent trades and recent quotes** (lists) 
* Handle common cases like **null activity** and **404 market not found**

Endpoints used:

* `GET /v1/activity/:exchange_id/:market_id/current` → current trade + current quote (either may be null)
* `GET /v1/activity/:exchange_id/:market_id/latest` → recent trades + recent quotes (lists may be empty)

Base host (REST):

* `https://api.prediction-markets.finfeedapi.com`

## What you need before you start

* ✅ A **FinFeedAPI API Key**
* ✅ Any HTTP client:
  * Terminal (`curl`)
  * Postman / Insomnia
  * Browser (for simple GET requests)
* ✅ Completed the following tutorials:
  * [**Get Started: Authenticate and Make Your First Prediction Market Request**](https://www.finfeedapi.com/learn/academy/tutorials/your-first-prediction-market-request)
  * [**Discover Available Prediction Market Exchanges and Markets**](https://www.finfeedapi.com/learn/academy/tutorials/market-exchanges-and-markets)

## 🔐 Step 1 — Add authentication to your request

* Put API key in the query string: `?apikey=YOUR_API_KEY` or,
* Put API key in the Authorization header: `Authorization: API Key YOUR_API_KEY`

Example header:

```sh
Authorization: YOUR_API_KEY
```

Example query string:

```sh
?apikey=YOUR_API_KEY
```

  


## 🧭 Step 2 — Choose `exchange_id` and `market_id`

Both endpoints require:

* `exchange_id` (string)
* `market_id` (string)

If your system already knows the market you want, you can proceed. Otherwise, you’d typically discover these via the Markets endpoints (covered in a separate tutorial).

## ⚡ Step 3 — Get the _latest_ trade and _latest_ quote (snapshot)

### Endpoint

```sh
GET "https://api.prediction-markets.finfeedapi.com/v1/activity/:exchange_id/:market_id/current?apikey=YOUR_API_KEY"
```



### What it returns

A single object containing:

* `trade`: latest trade (or `null`)
* `quote`: latest quote (or `null`)

Trade fields include `price`, `quantity`, `timestamp`, `outcome`, and `side` (`Buy`/`Sell`).

Quote fields include `entry_time`, `recv_time`, `ask`, `bid`, `ask_volume`, `bid_volume`.  


### When to use `/current`

Use it when you want a **fast “now” view**:

* last print + current top-of-book
* quick UI refresh
* lightweight monitoring/alert checks

## 🧾 Step 4 — Get _recent_ trades and _recent_ quotes (lists)

### Endpoint

```sh
GET "https://api.prediction-markets.finfeedapi.com/v1/activity/:exchange_id/:market_id/latest?apikey=YOUR_API_KEY"
```

### What it returns

* `trades`: array (may be empty)
* `quotes`: array (may be empty)

Each trade item has the same shape as in `/current`.

Each quote item includes `entry_time`, `recv_time`, `ask`, `bid`, `ask_volume`, `bid_volume`.  


### When to use `/latest`

Use it when you want a **short rolling window** of activity:

* mini tape (recent trades)
* recent quote updates for spread/liquidity changes
* “what just happened?” context around a move

## 🧠 Step 5 — Handle common responses safely

### 200 OK with “no activity”

* `/current`: `trade` and/or `quote` can be `null`
* `/latest`: `trades`/`quotes` arrays can be empty

Treat this as normal: it can happen when a market is inactive or newly listed.

### 404 Not Found

Both endpoints can return `404` (e.g., market not found / no activity).

If you see 404:

* verify `exchange_id` spelling/case
* verify `market_id` exists on that exchange
* confirm the market hasn’t been retired/renamed on the upstream venue

## 🎉 Wrap-up

You now have two clean building blocks for “right now” prediction markets:

* `/current` for a snapshot of the latest trade + quote
* `/latest` for short rolling lists of trades and quotes