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

# Trade Model

> Complete reference for the Trade data structure.

The Trade model represents a buy, sell, or redemption transaction.

***

## Schema

```typescript theme={"dark"}
interface Trade {
  // Transaction
  signature: string;         // Solana transaction signature
  slot: number;              // Slot number
  timestamp: number;         // Unix timestamp
  block_time: number | null; // Block time (if available)
  
  // Participants
  market_address: string;    // Market being traded
  user_address: string;      // Trader's wallet
  
  // Trade Details
  trade_type: TradeType;     // Type of trade
  outcome_index: number;     // Outcome traded
  amount: number;            // USDC amount (base units)
  amount_usdc: number;       // USDC amount (decimal)
  shares: number;            // Shares traded
  price: number;             // Average price per share
  
  // Context
  market_cap_at_trade: number; // Market cap at trade time
  
  // Fees
  fees_paid: number;         // Fees (base units)
  fees_paid_usdc: number;    // Fees (decimal)
}
```

***

## Trade Types

```typescript theme={"dark"}
type TradeType = "buy" | "sell" | "redeem";
```

| Type | Description |
| - | - |
| `buy` | Purchase shares with USDC |
| `sell` | Sell shares for USDC |
| `redeem` | Claim winnings from resolved market |

***

## Amount Fields

Two representations are provided:

| Field | Unit | Example |
| - | - | - |
| `amount` | Base units (microlamports) | `100500000` |
| `amount_usdc` | USDC | `100.50` |

Similarly for fees:

| Field | Unit | Example |
| - | - | - |
| `fees_paid` | Base units | `1710000` |
| `fees_paid_usdc` | USDC | `1.71` |

***

## Price Calculation

The `price` field represents the average price per share for this trade:

$$
price = \frac{amount\_usdc}{shares}
$$

> [!NOTE]
>
> Due to the bonding curve, the price changes as shares are bought/sold. The reported price is the average across the entire trade.

***

## Market Cap Context

`market_cap_at_trade` captures the total market cap at the moment of execution. This is useful for:

* Historical analysis
* Slippage calculation
* Charting price impact

***

## Example

```json theme={"dark"}
{
  "signature": "5K7xYz9abc...",
  "slot": 234567890,
  "timestamp": 1704067200,
  "block_time": 1704067200,
  "market_address": "ABC123...",
  "user_address": "User456...",
  "trade_type": "buy",
  "outcome_index": 0,
  "amount": 100500000,
  "amount_usdc": 100.50,
  "shares": 9850,
  "price": 0.0102,
  "market_cap_at_trade": 1250.75,
  "fees_paid": 1710000,
  "fees_paid_usdc": 1.71
}
```

***

## Verification

Trades can be verified on-chain using the transaction signature:

```bash theme={"dark"}
solana confirm 5K7xYz9abc...
```

Or via Solana Explorer:

```
https://explorer.solana.com/tx/5K7xYz9abc...
```


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