> ## 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.

# Bonding Curve

> How Orica calculates share prices using a linear bonding curve.

Orica uses a **Linear Bonding Curve** to price outcome shares. This mechanism ensures continuous liquidity and enables price discovery based on market demand.

***

## The Formula

The price of a share for a specific outcome is determined by the current supply of that outcome's shares.

$$
P = P_{base} + (S \times P_{slope})
$$

| Variable | Value | Description |
| - | - | - |
| $P$ | Calculated | Price in microlamports (USDC base units) |
| $P_{base}$ | 1,000 | Base price (0.001 USDC) |
| $S$ | Variable | Current supply of shares for this outcome |
| $P_{slope}$ | 10 | Price increase per share (0.00001 USDC) |

***

## Price Impact

> [tab] Buying
>
> When you buy shares, the supply increases, and the price rises.
>
> **Example**: If current supply is 100 shares:
>
> * Current price: $0.001 + (100 \times 0.00001) = $0.002 per share\$
> * After buying 50 shares, new supply is 150
> * New price: $0.001 + (150 \times 0.00001) = $0.0025 per share\$
>
> The total cost is the **integral** of the price function from the old supply to the new supply.

> [tab] Selling
>
> When you sell shares, the supply decreases, and the price falls.
>
> **Example**: If current supply is 150 shares:
>
> * Current price: $0.001 + (150 \times 0.00001) = $0.0025 per share\$
> * After selling 50 shares, new supply is 100
> * New price: $0.001 + (100 \times 0.00001) = $0.002 per share\$
>
> The USDC received is the integral of the price function from the new supply to the old supply.

***

## Market Cap

The **Market Cap** of an outcome is the total value of all shares, calculated as:

$$
MC = S \times (P_{base} + P_{slope} \times S)
$$

This represents the total USDC that would be required to buy all existing shares at the current curve.

***

## Calculating Prices in Code

The SDK provides a helper method:

```typescript theme={"dark"}
const market = await sdk.orica.fetchMarket(marketAddress);
const prices = sdk.orica.calculateMarketPrices(market);

// prices[0] = price of outcome 0
// prices[1] = price of outcome 1
// etc.

console.log(`Yes: $${prices[0].toFixed(4)}`);
console.log(`No: $${prices[1].toFixed(4)}`);
```

> [accordion] Manual Calculation
>
> ```typescript theme={"dark"}
> const CURVE_BASE_PRICE = 1_000; // 0.001 USDC in microlamports
> const CURVE_SLOPE = 10;         // 0.00001 USDC per share
> const USDC_SCALE = 1_000_000;   // 6 decimals
>
> function calculatePrice(supply: number): number {
>   const priceInMicrolamports = CURVE_BASE_PRICE + (CURVE_SLOPE * supply);
>   return priceInMicrolamports / USDC_SCALE;
> }
> ```

***

## Slippage

Large trades can experience **slippage** because the price changes as shares are bought or sold.

* **Buying**: You pay more per share on average than the starting price
* **Selling**: You receive less per share on average than the starting price

> [!NOTE]
>
> The larger your trade relative to the existing supply, the more slippage you will experience. Consider breaking large orders into smaller chunks.

***

## Price vs. Probability

In prediction markets, the price of an outcome can be interpreted as the market's implied probability of that outcome occurring.

* If "Yes" shares cost \$0.65, the market implies a **65% probability** of "Yes"
* If "No" shares cost \$0.35, the market implies a **35% probability** of "No"

> [!WARNING]
>
> This interpretation assumes a two-outcome market where prices sum to approximately \$1.00. Multi-outcome markets have more complex probability distributions.

***

## Next Steps

> [card] [Trading](https://docs.orica.markets/guides/trading.md)
>
> Execute trades using the SDK.

> [card] [Disputes](https://docs.orica.markets/guides/disputes.md)
>
> Learn about challenging resolutions.


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