> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# PredictionTrade

> A single prediction trade. Reference for the PredictionTrade type in the Codex API: every field, its type, and the operations that return it.

## GraphQL

```
type PredictionTrade {
  marketId: String!
  sortKey: String!
  outcomeId: String!
  outcomeLabel: String!
  protocol: PredictionProtocol!
  tradeType: PredictionTradeType!
  maker: String
  timestamp: Int!
  outcomeIndex: Int
  priceUsd: String
  priceCollateral: String
  amount: String
  amountCollateral: String
  amountUsd: String
  transactionHash: String
  blockNumber: Int
  networkId: Int
  exchangeAddress: String
  exchangeTradedOnAddress: String
  collateralTokenAddress: String
  transactionId: String
  predictionMarket: PredictionMarket
  traderId: String
}

enum PredictionProtocol {
  POLYMARKET
  KALSHI
}

enum PredictionTradeType {
  TRADE
  BUY
  SELL
  BUY_COUNTERPARTY
  SELL_COUNTERPARTY
  POSITION_REDEEMED
}

type PredictionResolution {
  result: String
  source: String
}

type PredictionSubSubcategory {
  name: String!
  slug: String!
}

type PredictionSubcategory {
  name: String!
  slug: String!
  subcategories: [PredictionSubSubcategory!]
}

type PredictionCategory {
  name: String!
  slug: String!
  subcategories: [PredictionSubcategory!]
}

enum PredictionMetadataType {
  SPORTS
}

type SportsTeam {
  abbreviation: String!
  altAbbreviations: [String!]
  name: String
  league: String
  logo: String
  alias: String
  color: String
  providerId: Int
  isHome: Boolean
}

enum SportsTimezone {
  UTC
}

type SportsMarketEnrichedMetadata {
  sportsMarketType: String
  league: String
  teams: [SportsTeam!]
  gameStartDate: String
  gameStartTime: String
  gameStartTimeSeconds: Int
  gameStartTimezone: SportsTimezone
}

type PredictionMarketEnrichedMetadata {
  metadataType: PredictionMetadataType!
  sports: SportsMarketEnrichedMetadata
}

type PredictionMarket {
  id: String!
  protocol: PredictionProtocol!
  venueMarketId: String!
  venueMarketSlug: String
  eventId: String
  venueEventId: String
  question: String
  label: String
  suggestedLabel: String
  eventLabel: String
  rules: String
  rules2: String
  venueOutcomeIds: [String!]!
  outcomeIds: [String!]!
  outcomeLabels: [String!]
  resolution: PredictionResolution
  imageLargeUrl: String
  imageThumbUrl: String
  imageSmallUrl: String
  createdAt: Int
  updatedAt: Int
  opensAt: Int
  closesAt: Int
  resolvesAt: Int
  resolvedAt: Int
  observedAt: Int!
  networkId: Int
  exchangeAddress: String
  categories: [PredictionCategory!]
  winningOutcomeId: String
  enrichedMetadata: PredictionMarketEnrichedMetadata
}
```

### Used By

**Returned by**

* [onPredictionTradesCreated](https://docs.codex.io/api-reference/subscriptions/onpredictiontradescreated.md): Streams new prediction trades as they are ingested.
* [predictionTrades](https://docs.codex.io/api-reference/queries/predictiontrades.md): Returns prediction trades with cursor-based pagination.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.