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

# Quickstart

> Start fetching market data and placing trades in minutes.

This guide walks you through the essential steps to integrate with Orica, whether you want to read market data or execute trades.

> [!NOTE]
>
> Orica markets are resolved by [Claude 4.5 Sonnet](https://openrouter.ai/anthropic/claude-sonnet-4.5) with research powered by [Firecrawl](https://www.firecrawl.dev/). Human oversight is provided through the dispute system.

***

## Reading Data with the API

The Orica API requires no authentication for read operations. You can start fetching data immediately.

```bash cURL theme={"dark"}
curl https://api.orica.markets/markets
```

```typescript TypeScript theme={"dark"}
const response = await fetch("https://api.orica.markets/markets");
const markets = await response.json();

for (const market of markets) {
  console.log(market.question, market.status);
}
```

```python Python theme={"dark"}
import httpx

response = httpx.get("https://api.orica.markets/markets")
markets = response.json()

for market in markets:
    print(market["question"], market["status"])
```

> [!NOTE]
>
> The API returns markets sorted by creation date (newest first). Use `limit` and `offset` query parameters for pagination.

***

## Installing the SDK

For building transactions and interacting with on-chain state, install the SDK for your language.

> [tab] TypeScript
>
> ```bash bun theme={"dark"}
> bun add @neko/orica-sdk @solana/web3.js @coral-xyz/anchor
> ```
>
> ```bash npm theme={"dark"}
> npm install @neko/orica-sdk @solana/web3.js @coral-xyz/anchor
> ```
>
> ```bash yarn theme={"dark"}
> yarn add @neko/orica-sdk @solana/web3.js @coral-xyz/anchor
> ```
>
> Links: [GitHub](https://github.com/neko/orica-ts-sdk) · [Docs](https://neko.github.io/orica-ts-sdk/) · [NPM](https://github.com/neko/orica-ts-sdk/pkgs/npm/orica-sdk)

> [tab] Python
>
> ```bash uv theme={"dark"}
> uv add git+https://github.com/neko/orica-py-sdk
> ```
>
> ```bash pip theme={"dark"}
> pip install git+https://github.com/neko/orica-py-sdk
> ```
>
> Requires Python 3.12+
>
> Links: [GitHub](https://github.com/neko/orica-py-sdk) · [Docs](https://neko.github.io/orica-py-sdk/)

***

## Initializing the SDK

The SDK can automatically fetch program IDLs from the blockchain.

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> import { Connection } from "@solana/web3.js";
> import { OricaSDK } from "@neko/orica-sdk";
>
> const connection = new Connection("https://api.mainnet-beta.solana.com");
> const sdk = await OricaSDK.createFromChain(connection);
> ```

> [tab] Python
>
> ```python theme={"dark"}
> from orica_sdk import OricaSDK
> from solana.rpc.async_api import AsyncClient
>
> connection = AsyncClient("https://api.mainnet-beta.solana.com")
> sdk = await OricaSDK.create(connection)
> ```

***

## Fetching Markets

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> // Fetch all markets
> const markets = await sdk.orica.fetchAllMarkets();
>
> for (const { publicKey, account } of markets) {
>   console.log("Question:", account.question);
>   console.log("Status:", account.status);
> }
>
> // Fetch single market with metadata
> const market = await sdk.orica.fetchMarketWithMetadata(marketAddress, {
>   includeMetadata: true,
> });
>
> console.log("Description:", market.metadata?.reasoning);
> ```

> [tab] Python
>
> ```python theme={"dark"}
> # Fetch all markets
> markets = await sdk.orica.fetch_all_markets()
>
> for address, market in markets:
>     print(f"Question: {market.question}")
>     print(f"Status: {market.status.value}")
> ```

***

## Calculating Prices

The SDK provides a helper to compute the current share price for each outcome based on the bonding curve.

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> const market = await sdk.orica.fetchMarket(marketAddress);
> const prices = sdk.orica.calculatePrices(market);
>
> market.optionNames.forEach((option, i) => {
>   console.log(`${option}: $${prices[i].toFixed(4)} per share`);
> });
> ```

> [tab] Python
>
> ```python theme={"dark"}
> market = await sdk.orica.fetch_market(market_address)
> prices = sdk.orica.calculate_prices(market)
>
> for i, option in enumerate(market.option_names):
>     print(f"{option}: ${prices[i]:.4f} per share")
> ```

***

## Executing a Trade

To buy shares, you need a connected wallet and a USDC token account.

> [tab] TypeScript
>
> ```typescript theme={"dark"}
> import { BN } from "@coral-xyz/anchor";
> import { Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
> import { getAssociatedTokenAddress } from "@solana/spl-token";
>
> // Get user's USDC account
> const globalState = await sdk.orica.fetchGlobalState();
> const userUsdc = await getAssociatedTokenAddress(
>   globalState.usdcMint,
>   wallet.publicKey
> );
>
> // Build buy instruction
> const instructions = await sdk.orica.buildBuy(
>   wallet.publicKey,
>   userUsdc,
>   marketAddress,
>   new BN(5_000_000), // 5 USDC (6 decimals)
>   0 // Outcome index (e.g., 0 = "Yes")
> );
>
> // Send transaction
> const tx = new Transaction().add(...instructions);
> const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
>
> console.log("Trade executed:", signature);
> ```

> [tab] Python
>
> ```python theme={"dark"}
> from solana.transaction import Transaction
> from spl.token.instructions import get_associated_token_address
>
> # Get user's USDC account
> global_state = await sdk.orica.fetch_global_state()
> user_usdc = get_associated_token_address(wallet.pubkey(), global_state.usdc_mint)
>
> # Build buy instruction
> instructions = await sdk.orica.build_buy(
>     user=wallet.pubkey(),
>     user_usdc=user_usdc,
>     market_address=market_address,
>     amount=5_000_000,  # 5 USDC (6 decimals)
>     outcome_index=0,   # Outcome index (e.g., 0 = "Yes")
> )
>
> # Send transaction
> tx = Transaction()
> tx.add(*instructions)
> signature = await connection.send_transaction(tx, wallet)
>
> print(f"Trade executed: {signature}")
> ```

> [!WARNING]
>
> Always verify the market status before trading. You cannot trade on markets that are `closed`, `resolved`, or `disputed`.

***

## Real-Time Updates

Connect to the WebSocket for live price updates.

```typescript theme={"dark"}
const ws = new WebSocket("wss://api.orica.markets/ws/markets/YOUR_MARKET_ADDRESS");

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
  
  if (message.type === "update") {
    console.log("New prices:", message.data.market_caps);
  }
};
```

***

## Next Steps

> [card] [Markets](https://docs.orica.markets/guides/markets.md)
>
> Deep dive into market structure and lifecycle.

> [card] [Trading](https://docs.orica.markets/guides/trading.md)
>
> Understand buy, sell, and redemption mechanics.

> [card] [API Reference](https://docs.orica.markets/api-reference/introduction.md)
>
> Full REST and WebSocket documentation.

> [card] [SDK Reference](https://docs.orica.markets/sdk/introduction.md)
>
> Complete SDK method reference.


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