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

# CCXT

> Trade Calibri markets through CCXT, the open-source trading library.

Calibri has a connector for [CCXT](https://github.com/ccxt/ccxt), so if your
tooling already speaks CCXT you can add Calibri with a few lines of code. It
lives in CCXT's prediction-market family, next to Polymarket and Kalshi, and
covers market data, order books, orders, balances and positions.

> [!NOTE]
>
> The connector is **waiting for review** in CCXT:
> [ccxt/ccxt#31370](https://github.com/ccxt/ccxt/pull/31370). Until it is
> merged and released you can use it straight from the pull request, as shown
> below. Once it ships, a normal `npm install ccxt` (and the Python, PHP, C# and
> Go packages) will include it.

## Use it from the pull request

Build the branch behind the pull request (JavaScript / TypeScript):

```bash theme={null}
git clone --branch calibri --depth 1 https://github.com/calibripredict/ccxt.git
cd ccxt
npm install
npm run tsBuild
```

Then point your project at that folder:

```bash theme={null}
npm install /path/to/ccxt
```

## Connect

Calibri is under `ccxt.prediction`. Use an [API key](https://docs.calibri.io/api-reference/authentication.md)
for anything beyond public market data.

```javascript theme={null}
import ccxt from 'ccxt'

const calibri = new ccxt.prediction.calibri({
  apiKey: process.env.CALIBRI_API_KEY,
  secret: process.env.CALIBRI_API_SECRET,
})

// Events matching a search, and every market with its outcomes
const events = await calibri.fetchEvents({ query: 'bitcoin' })
const markets = await calibri.fetchMarkets()

// Books are per outcome, e.g. "<MARKET>:YES"
const yes = markets[0].outcomes[0].outcome
const book = await calibri.fetchOrderBook(yes)

const balance = await calibri.fetchBalance()
```

Public calls such as `fetchEvents`, `fetchMarkets` and `fetchOrderBook` need no
key. To place orders from a [self-custody](https://docs.calibri.io/non-custodial/overview.md) account, also
pass `privateKey`: the key that signs your orders (see
[signed orders](https://docs.calibri.io/non-custodial/signed-orders.md)).

## Questions

The connector maps onto the same REST and WebSocket APIs documented here, so
anything in this reference applies. If something behaves differently through
CCXT, comment on the [pull request](https://github.com/ccxt/ccxt/pull/31370) or
contact us.


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